Single/Multiplayer, Touch & Vive blueprint only Template

I’m using my Gloves in this Template
maybe I made a mistake because I made a static mesh and then cleared the Skeleton mesh. I’m not using any pickup or interactive thing just Collision so it’s okay
the problem here the left hand is looking different, it’s like more transparent than the right. the right one is looking fine, both are making Collision in a right way so there’s no problem in terms of Programming it’s just the way it looks. and fix ? the Opacity 15 in the VR_Settings and I can’t even find where you use it to delete it if it’s what causing the problem. it’s in a one hand although, the Left

Good! Looking forward for it

Definitely interested :slight_smile:

@xN31 So… the gods were not with me. Good news is that I think I found the solution to the problem that bugged me since.

So how it works is that everyone locally controlled spawns a local Avatar, and bring his Oculus ID to a shared array of Oculus IDs. Then a remote Avatar is spawned on every client/listen server and is controlled via the Oculus packets. While this is happening, things related to my custom-made pawn are sent the usual way. The difference is that head and hand meshes are no longer replicated. Inputs are sent to the pawn and Oculus packets.

In short, it works well now (with VOIP). The only thing is that I somewhat broke X,Y, A and B buttons inputs on client side don’t know why. Working on that this w-e. So close!

Thank you for this template !

I followed all the steps for oculus but when I delete the following code in AvatarMaster : “Add Steam VRChaperone Component” I get these compiler errors.
So what have I done wrong or what else should I do?

Play-testing multiplayer VR

Hey !
Thanks so much for the awesome work you’ve put into getting such a template out there for the devs community to learn from and use.
Our studio has recently released an indie VR title on steam (Save 80% on Galactic Core: The Lost Fleet (VR) on Steam).
The last week few weeks have all about learning and designing what’s necessary to evolve it into a VR multiplayer game (we’re thinking dedicated servers).
In any case, I’ve been struggling to find an efficient way of play-testing VR multiplayer in the editor.
I mean even the most basic things, like checking if a replicated actors behaves as expected, if all client’s received some RPC call, if game is consistent between clients

  • How do you get that done?
  • Is it possible to some how perform testing using a single PC and headset (even if one client just runs a keyboard/mouse version of the game)?
  • Any debugging tools /tips you could share from your experience?

Hi !

Thank you for your amazing plugin !

I was using the 2.3 under Unreal 4.15, and it saved me a lot of work !

Replication works great, it’s easy to customise, and the documentation is clear !

I just have a trouble:
I am using the Null Subsystem (I connect with other computers on IP via LAN).
On the 2.3, VoIP was working well, but on the version 3.0, I can’t make it work oO

I followed your instructions, but I’m stucked. Did I missed something ?

(I posted a question on the AnswerHub about it but… Still no answers :confused: => LAN VoIP doesn't work - Platform & Builds - Unreal Engine Forums)

@Osuvox Delete everything in the Vive Tracker functions (in pink) – don’t forget to erase also the OnRepTrackerSpace repnotify function.

@gMacGeorges

I’m doing a little guide right now. Will put it there sometime tonight.

Sorry for the Avatar integration. The reason for the delays are that I’ve a perfectly working project with Avatars in Editor, LAN and Steam.

But I’ve learned the hard way that events fire not in the same speed and order on Oculus Network; so I have to painfully do build after build and test them on the Oculus network, and then place small delays in front of some functions.

Of course the problem is encountered only with clients. After having cursed Oculus endlessly, I’m nearly finished modifying the functions.

Hi!

Thanks for the awesome template! I’ve been tinkering with it for a week or so now and got the multiplayer working over LAN. As of now I have two questions:

  1. I’m floating in the air about 20 cm so if an object drops onto the floor, I can’t reach to it. (the physical floor stops the controller) What’s the recommended way of adjusting the height? I’ve tried setting player start to floor level, setting base eye height to 0, and adjusting the VR origin Z position.
    If I set player start to -20 on Z it kinda works but when I teleport it’s back to “normal” of course. If I alter the VR origin Z position it messes up with the motion controllers.

  2. After a few minutes of multiplayer, the client player starts to get really laggy. (this is done on an other computer with another set of vive) I’m a complete beginner to networking. Any ideas what is happening there?

Thanks!

I’m using Vive!

Version 3.1 - July 26, 2017

What’s new in version 3.1?
*** Simplification of functions, most delays removed

  • 2 versions: Steam/Lan and Oculus Avatars, single and multiplayer (experimental)
  • VOIP over Oculus Network
  • Find friend’s sessions on Oculus Network**

[SIZE=3]Files found on the OneDrive at [/SIZE]Microsoft OneDrive - Access files anywhere. Create docs with free Office Online. , and on GitHub at GitHub - ProteusVRpublic/ProteusTemplate: Single/Multiplayer VR Template for Touch/Vive Controllers and Avatars

Read the pdf file included! A 3.1 packaged version (non Avatars) is also found on the OneDrive.

So let’s have a conversation on the Oculus Network and the Avatars…

Using Oculus Network

Ø Plugins/Virtual Reality/Oculus Rift and Oculus Library must be selected
Ø Plugins/Online Platform/Online Subsystem Oculus must be selected
Ø GameInfoInstance/Oculus Network must be selected
Ø Each player must be connected to Oculus Home with a different account
Ø The file /Config/DefaultEngine.ini must contain the following changes:

*[OnlineSubsystem]
;DefaultPlatformService=Steam
DefaultPlatformService=Oculus
;bHasVoiceEnabled=true
PollingIntervalInMs=20
VoiceNotificationDelta=0.2

[OnlineSubsystemSteam]
bEnabled=false
SteamDevAppId=480
GameServerQueryPort=27015
bRelaunchInSteam=false
GameVersion=1.0.0.0
bVACEnabled=1
bAllowP2PPacketRelay=true
P2PConnectionTimeout=90
Achievement_0_Id=

[/Script/OnlineSubsystemSteam.SteamNetDriver]
;NetConnectionClassName=OnlineSubsystemSteam.SteamNetConnection

[OnlineSubsystemOculus]
;Enable this if using Oculus Network
;Then enter you app ID
bEnabled=true
OculusAppId=1111111111111111

[/Script/OnlineSubsystemOculus.OculusNetDriver]
NetConnectionClassName=OnlineSubsystemOculus.OculusNetConnection

[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
; Uncomment the next line if you are using the Null Subsystem
;+NetDriverDefinitions=(DefName=“GameNetDriver”,DriverClassName=“/Script/OnlineSubsystemUtils.IpNetDriver”,DriverClassNameFallback=“/Script/OnlineSubsystemUtils.IpNetDriver”)
; Uncomment the next line if you are using the Steam Subsystem
;+NetDriverDefinitions=(DefName=“GameNetDriver”,DriverClassName=“OnlineSubsystemSteam.SteamNetDriver”,DriverClassNameFallback=“OnlineSubsystemUtils.IpNetDriver”)
; Uncomment the next line if you are using the Oculus Subsystem
+NetDriverDefinitions=(DefName=“GameNetDriver”,DriverClassName=“OnlineSubsystemOculus.OculusNetDriver”,DriverClassNameFallback=“OnlineSubsystemUtils.IpNetDriver”)
*
The 16-digits App ID is your Oculus App ID found in your App Oculus dashboard URL (i.e. https://dashboard.oculus.com/application/111111111111111/build). For more information on publishing your game on Oculus platform see https://developer3.oculus.com/documentation/publish/latest/ .

IMPORTANT:
Ø Plugins/Virtual Reality/Steam VR must be deselected
Ø Plugins/Online Platform/Online Subsystem Steam must be deselected
Ø **In AvatarMaster/Set Boundaries for Chaperone & Guardian, delete the functions related to SteamVR Chaperone, Vive Tracker and TrackerSpace RepNotify

****OCULUS AVATARS
**
Ø Use the Template, Oculus Avatar Version (latest is 3.1)
Ø All previous considerations related to using Oculus Network still apply
Ø **In MainMenuPC, Using Oculus Subsystem AND Using Oculus Avatar must be selected
**
**Put the following in DefaultInput.ini:
**
*+ActionMappings=(ActionName=“AvatarLeftTrigger”,Key=MotionController_Left_Trigger,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+ActionMappings=(ActionName=“AvatarRightTrigger”,Key=MotionController_Right_Trigger,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+ActionMappings=(ActionName=“AvatarLeftGrip1”,Key=MotionController_Left_Grip1,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+ActionMappings=(ActionName=“AvatarRightGrip1”,Key=MotionController_Right_Grip1,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+AxisMappings=(AxisName=“MoveForward”,Key=W,Scale=1.000000)
+AxisMappings=(AxisName=“MoveForward”,Key=S,Scale=-1.000000)
+AxisMappings=(AxisName=“MoveForward”,Key=Up,Scale=1.000000)
+AxisMappings=(AxisName=“MoveForward”,Key=Down,Scale=-1.000000)
+AxisMappings=(AxisName=“MoveForward”,Key=Gamepad_LeftY,Scale=1.000000)
+AxisMappings=(AxisName=“MoveRight”,Key=A,Scale=-1.000000)
+AxisMappings=(AxisName=“MoveRight”,Key=D,Scale=1.000000)
+AxisMappings=(AxisName=“MoveRight”,Key=Gamepad_LeftX,Scale=1.000000)
+AxisMappings=(AxisName=“TurnRate”,Key=Gamepad_RightX,Scale=1.000000)
+AxisMappings=(AxisName=“TurnRate”,Key=Left,Scale=-1.000000)
+AxisMappings=(AxisName=“TurnRate”,Key=Right,Scale=1.000000)
+AxisMappings=(AxisName=“Turn”,Key=MouseX,Scale=1.000000)
+AxisMappings=(AxisName=“LookUpRate”,Key=Gamepad_RightY,Scale=1.000000)
+AxisMappings=(AxisName=“LookUp”,Key=MouseY,Scale=-1.000000)
+AxisMappings=(AxisName=“MoveForward”,Key=MotionController_Left_Thumbstick_Y,Scale=-1.000000)
+AxisMappings=(AxisName=“MoveRight”,Key=MotionController_Left_Thumbstick_X,Scale=1.000000)
+AxisMappings=(AxisName=“AvatarLeftTrigger”,Key=OculusTouch_Left_Trigger,Scale=1.000000)
+AxisMappings=(AxisName=“AvatarRightTrigger”,Key=OculusTouch_Right_Trigger,Scale=1.000000)
+AxisMappings=(AxisName=“AvatarLeftIndexPointing”,Key=OculusTouch_Left_IndexPointing,Scale=1.000000)
+AxisMappings=(AxisName=“AvatarRightIndexPointing”,Key=OculusTouch_Right_IndexPointing,Scale=1.000000)
+AxisMappings=(AxisName=“AvatarLeftThumbUp”,Key=OculusTouch_Left_ThumbUp,Scale=1.000000)
+AxisMappings=(AxisName=“AvatarRightThumbUp”,Key=OculusTouch_Right_ThumbUp,Scale=1.000000)
+AxisMappings=(AxisName=“AvatarLeftTriggerAxis”,Key=MotionController_Left_Trigger,Scale=1.000000)
+AxisMappings=(AxisName=“AvatarRightTriggerAxis”,Key=MotionController_Right_Trigger,Scale=1.000000)
+AxisMappings=(AxisName=“AvatarLeftGrip1Axis”,Key=MotionController_Left_Grip1,Scale=1.000000)
+AxisMappings=(AxisName=“AvatarRightGrip1Axis”,Key=MotionController_Right_Grip1,Scale=1.000000)

+ActionMappings=(ActionName=“AvatarLeftFaceButton1”,Key=MotionController_Left_FaceButton1,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+ActionMappings=(ActionName=“AvatarRightFaceButton1”,Key=MotionController_Right_FaceButton1,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+ActionMappings=(ActionName=“AvatarLeftFaceButton2”,Key=MotionController_Left_FaceButton2,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+ActionMappings=(ActionName=“AvatarRightFaceButton2”,Key=MotionController_Right_FaceButton2,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
*
**SINGLE PLAYER AVATAR **
Ø In MainMenuPC, Is Single Players should be selected
· Use MainMenuGM as game mode and GameInfoInstance on all maps

**MULTIPLAYER - EXPERIMENTAL **
Connect the same way as Steam
Steam can still be running, do not interfere with process
LAN doesn’t work with Avatars
Multiplayer mode is experimental.
What works for now: VOIP, spawning local and remote Avatar
What still doesn’t work: remote Avatars are still controlled by each locally-controlled player.
How the Avatars Works
The appearance of every person’s avatar is stored in his or her Oculus user profile as an Avatar Specification. The Avatar Specification identifies the meshes and textures that make up a person’s avatar. Before we retrieve this specification data, we have to initialize both the Platform SDK and the Avatar SDK using our app ID. Avatar Specifications are indexed by Oculus user ID. An app has easy access to the Oculus user ID of the currently logged in user. Template uses a third-person avatar which depicts hands, body, and base cone.
When logging in, the Oculus ID and Entitlement are fired in the MainMenuPC, the Oculus ID and name are sent to GameInfoInstance. When the menu widgets spawn, they retrieve this information. The host then starts and register in a map. Other clients go through the SteamLan widget. This widget relies on OculusLogin c++ class to find an Oculus session. Note that only friends that have installed the game (or registered beta users) will appear.
When spawning in a level, each player spawns 4 avatars: 1 for himself (AvatarMaster, based on ProteusLocal), and 3 AvatarRemote, based on ProteusRemote: 1 remote for the locally-controlled listen-server, 1 remote for the pawns, and it also make previously spawned clients to fire a copy of the non-locally controlled remote Avatar. In the AvatarMaster pawn, the VOIP is also enabled.
How Avatar is rendered (from Oculus):
· Retrieve the avatar specification for the Oculus user
· Set the Avatar capabilities
· Iterate through the avatar specification to load the static avatar assets (mesh and textures) into the avatar.
· Apply the vertex transforms to determine the position of the avatar component.
· Apply the material states to determine the appearance of the avatar component.
· For each render part of an avatar component:
· Get the OpenGL mesh data and tell the renderer to use the Avatar shader program you compiled earlier.
· Calculate the inputs on the vertex uniforms.
· Set the view position, the world matrix, the view matrix, and the array of mesh poses.
· Transform everything in the joint hierarchy.
· Set the material state.
· Draw the mesh, depth first so that it self-occludes.
· Render to the color buffer.
· When there are no more components to render, the avatar render is complete.

Controlling the Remote Avatar – Still in development
Each player spawns a copy of Remote Avatar for each other players, and this copy is attached and possessed by these players. For this version, all Remote are driven by the inputs and transforms originating from the locally-controlled authority or client. The avatar packet recording system saves avatar movement data as packets: each time a packet is recorded, our code places the packet into a memory stream we are using as a stand-in for a real network layer. The remainder of our code receives the packet from the memory stream and plays it back on our loopback avatar object.
I’m working now on sending this data stream not to the memory buffer and back, but through the network to other players. Other avenue would be to use another copy of ProteusLocal, duplicate local inputs and transforms and send these back to the Avatar copies spawned by other clients.

**Opening the Avatar Project
**
Ø You must have Visual Studio 2015 or 2017 properly installed
Right-click on .uproject/Generate Visual Studio Project files
Click on .uproject; required files should then be created.
If it doesn’t work, open the .sln file with Visual Studio, rebuild the project, then you can open the project.

Packaging Avatars Project
Check the following options:
Packaging/Include Prerequisites
Packaging/Share Material Shader Code
Packaging/Share Material Native Librairies
Packaging/Include List of Maps to include in a packaged build (select your maps)
Additional Asset Directories to Cook/select the Content/Avatars directory

Side Note:

I’ve added “Oculus Network Delays” when using Oculus Network, because it is painfully needed. You can remove them on Steam / LAN.
Also: I’ve left many debug functions like my my debug cube and test pawn. The first was intensively used as a fake Avatar when developing without being connected (read: working in the countrysisde with my laptop beside a lake); the latter was also intensively used for replication testing.
I’ve left them here because they can be handy, but it would take you a big 5 minutes erasing their related functions and variables.

So I’ve just a little stretch do do before enabling full avatar remote control (read: hooking Oculus data stream through the Oculus network)

Please give me feedback and enjoy summer!!!

Many asked questions on RPCs. Here’s what I used (mainly) as a guide to RPCs inside AvatarMaster and MotionControllerBP:

&stc=1

&stc=1

&stc=1

There are of course other ways to do it, using remote roles, but I found these to be the most reliable on Steam and Oculus Network.

Also, it is also possible to reach each locally-controlled clients through the locally-controlled server, as seen in one of the Avatar Remote spawning function. Hope that it would help. :cool:

@SycoZ Does your room scale has been correctly done in SteamVR? Try also to delete and re-apply the navmesh. If not you can pm me I’ll probably find the problem in no time!

I would do some testing just to be sure that the teleport splines are correctly deleted and they are not accumulating; I would also check for any memory leak / garbage collection.

I’ll do some further test on that. If it doesn’t go away, I can check it.

Recalibrating the room again did solve the floating problem. Funny because it was the first thing I tried originally :confused: Thanks!

I’ll check if the lagginess has something to do with the teleportation! When testing we noticed the client side experienced the teleport fade if the server user teleported. Could be something there.

I quickly tried the 3.1 template just now. For some reason I can’t see the controllers/hands in the main menu map, even though they work fine in multimap. Maybe something to do with the gamemode? I set them correctly in the project settings map & modes.
You said there were 2 versions, for Steam/Lan and Oculus. Is there some setting to make it work properly with Vive now? I also got a bunch of blueprint errors regarding the motion controllers.

1)Be sure that everybody sees everybody (check in Windows Explorer/Network to be sure)
2)Close Steam on all computers (check in the tray to be sure)

On the 3.1 template version the Avatar Master isn’t seemingly created in the Main Menu map at all? That explains the missing motion controllers.

In 3.0 I can’t seem to figure out the lagginess problem. It’s actually jagged from the beginning for the client side and the teleportation is also not working correctly for the client. For me it seems like a replication issue, kind of like the server is correcting the locally controlled players position every tick, although the logic in the blueprints don’t suggest that is happening.
It’s also not a performance issue. When I switched around the host pc and client pc, the problem was now on the other pc (the client again). We are not logged into Steam and we can see each others computers in the windows explorer network.

Any ideas?

@Sycoz My bad for the bugs. The thing is that I alternated a lot between the Oculus-Avatar and standard version, forgetting to reconnect some links along the way:

In MainMenuPC one link was missing:

&stc=1

And in AvatarMaster 2 links were not connected:

&stc=1

&stc=1

I did my final QA tests with only a rift, so these problems did not surface since they only affected Vive. With that you should be good to go. I’ll upload right now a 3.1.1 corrected versions now.

As of the lag, try the new version and report back. I’ll test it also today.

Thanks for the quick update! That solved the 3.1 specific problems and now the VR keyboard is there too, which is cool! :slight_smile:

For some reason now on our other pc the motion controllers aren’t initialized properly. (can’t see them) They however work in the 3.0 build so it’s not a problem with the actual controllers. This also doesn’t happen every time and on my own pc (which is faster) this problem doesn’t happen at all. I used the same packaged version for both. I’m thinking could this be because of some of the removed delays that might affect some machines?

The one or two times I got them to work and tested the LAN, the lagginess was still there. So far I’ve been only trying the LAN option (with Steam closed) so I figured I’d try connecting through Steam, if it worked better. So what I did with v3.0 and 3.11:

  1. Connect both pc:s to different Steam accounts
  2. Host Steam game on pc1
  3. Find Steam game on pc2 (choose “internet” and refresh)
  4. At this point the list shows the pc1 server name on both “LAN” and “internet” the same way. If I try to connect, the connection seemingly fails and pc2 is stuck at MainMenu (with no Menu widget left)

Am I missing something? Seems like it is trying to connect through LAN even when I create a Steam session and choose internet. I’ve tried your packaged build, and my own with checking settings and DefaultEngine.ini according to the manual, with same results.
In short, I can’t get the Steam hosted session to work, only LAN.

@SycoZ It seems there is a problem right now with Steam and UE4.

I tried previous packaged builts (version 3.0, 2.3 and 2.2) with which I did many Steam sessions and they do not work today. I’ll try to find a solution somewhere, the problem is that it cannot find a Steam session.

I don’t think there is any bug with the template. If someone has a hint of what’s going on, give us a shout.

Note that it’s not the first time, I remember one specific time that I’ve been unable to find Steam sessions one day and the next day it was ok, with the same built. :frowning:

SteamVRHome is conflicting with the SteamSubsystem loading. If you turn SteamVRHome off it loads correctly currently.

@mordentral thanks you’re the best!

I cannot test it now but I’ll test it tonight. I thought it could have been the latest Oculus Home version since it adds the executable to the list of apps. My other hypothesis was that app480 was overloaded (more than 5k connected right now).

I must add that your advanced sessions plugin gave me some hint to the way I currently try to hijack the Oculus Avatar plugin to capture each player input – f** the Oculus recording packets function it only gave me headaches.

Thanks again!