How to setup multiplayer for both normal first-person and VR players?

I have the basics of a multiplayer game and would like to allow players to choose to play in either normal first-person or VR mode (potentially being different character types).

When I start the game in the VR Preview, the camera in my first-person character handles the different rendering automatically.

I did a few quick tests to see how UE4 would handle dynamically turning on VR mode (with my HTC Vive), if I did not start the game as a VR Preview. I added some console command execution nodes to turn on stereo rendering and such after spawning the character through blueprints, and then I started the game in normal preview window and as a standalone. In both cases, moving the Vive changed the angle of the character’s view on my monitor, but nothing was rendered to the headset. When I added a “fullscreen” command, it did render to the Vive, but the views for each eye were not correct. It looked like I was looking at the screen cross-eyed.

What is needed to optionally allow both first-person and VR? Where is this split in functionality best implemented? Would I create two different characters/pawns? Would I need different scenes/gamemodes? Should I use logic in the character and controller to handle the differences in normal versus VR players?

It seems that the “cross-eyed” view may be due to having multiple play windows running. I’ll have to check if the same happens with 1 window.

Anyways, the question seeking implementation advice still stands.

What happens if you package your game and play it without your console command implementation? Does the packaged game run as a VR game only or a non-VR game only?

At some point I will have to figure this out for my own project as well. So please let us know your solution if you happen to figure it out by yourself.

I’ll try it out when I get a chance and let you know. I think there’s a command-line option “-vr” though to choose how the game launches (also may be an .ini setting).

Aren’t there launch options in UE4? Then maybe you could launch the game with 2 different shortcuts. One with the -vr launch option and one without. Of course that wouldn’t work if -vr is not a launch option.

Yeah, that’s what I’m saying. I’m pretty sure there is a -vr option, but I was having trouble finding the source where I had read that. I’m more interested in the functionality split within the game though. For example, one player character with handling for each case or 2 different player characters, one for each, which is chosen based on your launch settings. I’m thinking of a bunch of ways to handle this, but not sure about a more proper implementation. Perhaps already described methods for making cross-platform multiplayer games would answer my question.

I believe the correct way for implementing multiple Default Pawn Classes might be to create your own Gamemode class and override the GetDefaultPawnClassForController() function. Sorry, that I can only guess, but I hope that helps.

Rama has a plugin for checking the connected HMD Device Type. That should be useful. However I am not sure if it returns none if the Engine is not in VR mode, but a HMD Device is connected.

Hi there! I know this is delayed, but if you’re using a Vive with 4.11 or later you will get eh cross-eyed thing. It’s fine with the Oculus, however- I have both so I was fortunate enough to be able to switch. They said there isn’t a timeline for the fix :frowning: