Getting Started with VR

On multiplayer for VR, here’s some tips from our dev team.

The general gist of how to set it up is:

  • Make sure that the CameraComponent has bLockToHMD true for the owning client only. will make sure that the owning client uses his own HMD position at all time. Make sure bLockToHMD is false for all non-owning clients. will mean their camera will do nothing, by default.
  • Every tick, get the CameraComponent’s relative transform on the owning client, and replicate that to the server via a server replicated event
  • Replicate that to client from the server, via a multicast event
  • In that multicast event on the client, set the CameraComponent’s RelativeTransform to the one that was replicated.
  • Repeat the same process for motion controllers, if needed! They don’t need the bLockToHMD flag though.

Voila! Lots of people have done in UE4, and there was even a Stanford course (CS211) that was offered that was all about multiplayer in UE4 with VR. LayoutVR also made a whole course on that, and has a great set of lessons, if people want to sign up (http://layoutvr.com/).

Also, don’t forget to check out Couch Knights on the launcher’s Learn tab for a pre-made online VR experience you can take apart and learn from. Though it was built for DK2, it still uses replication in a way that is relevant for modern VR systems.