Game Development Community

Networking - Lag on Camera with Oculus Rift

by NiN-NiN · in Torque 3D Beginner · 03/01/2014 (3:56 am) · 9 replies

Hi All

I am a bit confused and would like to see if anyone has any idea or even solutions for this

I created the FPS demo and ran a networked game over the internet and I used Oculus rifts to look around but the camera lag is pretty bad for anyone that isn't the host.

Interesting using the mouse to look around works fine and if you tab to 3rd person the to first looking around seems to be fine for a few seconds then goes back to lagging which makes you feel very sick in the rift.

I am stumped cause this is all the rift is doing as far as i'm away

function OVRSensorRotEuler(%pitch, %roll, %yaw)
{
   //echo("Sensor euler: " @ %pitch SPC %roll SPC %yaw);
   $mvRotZ0 = %yaw;
   $mvRotX0 = %pitch;
   $mvRotY0 = %roll;
}

$mvRotIsEuler0 = true;
$OculusVR::GenerateAngleAxisRotationEvents = false;
$OculusVR::GenerateEulerRotationEvents = true;
moveMap.bind( oculusvr, ovr_sensorrotang0, OVRSensorRotEuler );

As far as I can tell it's sending it's data to yaw, pitch and roll and the mouse is sending data to this as well yet doesn't lag in when in a network game.

I found a few things on here and applied the new settings for packet sizes etc as it was said they are set to be used on a 14.4k modem but that still didn't fix the issue.

Does anyone have any idea?

One more thing this is using the extendedmove class not the standard could that maybe the issue with it being networked?

#1
03/01/2014 (5:21 am)
Latency can vary a lot of the internet, so I would be a little weary about sending occulus input over it, especially when you've got the connection between the controlling client, server, and the rest of the clients to factor in.

In any case what I can determine from the code is its sending the absolute rotation and then calculating a relative rotation from that. When the client receives a move packet it sets mDelta on the camera object to smooth out movement between ticks. When the server receives a move packet it just sets the new rotation and doesn't interpolate unless newtonMode is set. I'm guessing in any case it won't send a new move packet to the rest of the clients until the controlling client sends one (though don't quote me on that, my torque networking knowledge has gotten a little fuzzy).

My suggestion: check out the latency with the network graph which can be opened by calling "toggleNetGraph();". If you get a spike, that might be an indicator thats whats causing your problems.
#2
03/30/2014 (1:24 pm)
Hey Nin-Nin,

I'm curious if there was anything special you did to get the Rift working in client/server.

Because although the Rift is working awesome in our game in single player, when I load up a dedicated server and connect in, my Rift head tracking does not work :(

Granted, our game is pretty customized beyond the stock FPS demo, but still... It's not a matter of lag or anything - I get no head tracking at all.

Any ideas anyone?
#3
04/07/2014 (5:13 am)
I haven't had a chance to check this out with someone else with a rift but I haven't stopped looking at this issue just might take a while to do more testing.

As for you paul I just used the rift template for 3.0 and it works out of the box so i'm not even sure why your headtracking wouldn't be working

Did you use the template or went from scratch from the fps demo?
#4
04/07/2014 (6:11 am)
We are using our own project and integrated the changes described on github...

Works perfectly in single player and we are even able to toggle between Rift and non-Rift mode by using ctrl-R... this is using some extra functions posted by another user.

But when i load up a dedicated server and then a client on same machine, the head tracking is no go. Picture is OK in both eyes but no head tracking.

Have not tried hosting on one machine and then connecting a client from a different machine, maybe that would be different. But dedicated server and client on same machine definitely does not work.

Will keep testing to see.

P
#5
04/07/2014 (5:22 pm)
Ohhh I think I know what the issue might be paul

If you are using it on the same machine the dedicated server will be taking control of the rift so when you open the client it won't work.

Try the dedicated server on then open up any other rift game or app and you will probably notice that headtracking won't work cause it's in use.

At least that's what I am assuming but try that first to see if the dedicated server is taking control of the rift
#6
04/07/2014 (5:27 pm)
That makes perfect sense!

Yes it is on same machine... will test later with server running on another machine to see if that solves it :)

Regarding original post about lag... you can throttle the network settings right up without issue I've found... set both packet sizes in client prefs.cs to 1024, and a packet size of 450. That is allowing us to run multiplayer AFX build with no lag on lan.

Cheers
P
#7
04/07/2014 (5:30 pm)
I tried that I think the issue isn't lag cause of packet size I think how the rift send sit position it's reading the positions but not making a smooth transition so when you turn left sometimes it goes from straight to full left no in between so it seems like it's trimming or ignoring part of the position data.

Let me know how it goes i'd love to know :)
#8
04/08/2014 (3:10 pm)
OK, so you were 100% correct - if I run the server on another machine, then when I connect to it as a client my Rift works as it should :)

Phew, I thought I was going crazy there for a bit lol.

All in all, I did not notice any lag with the Rift on... Moving my head around did not seem to stutter at all. But I didn't stay in long - only a couple of minutes to make sure I could still mount vehicles and look around, etc. And I did not test switching between 1st and 3rd person views.

Will be posting the Beta of our game on April 22nd, you can download it then and try it in the Rift and let me know if your Rift performance is any better than the stock build :)

Cheers
Paul
#9
04/08/2014 (3:49 pm)
That's great news :)

I think it's when you have two or more people with a rift you will notice the lag it's the same as when i tested it whoever hosted didn't have lag everyone else did but they could play fine with the mouse with no lag

You need to see if you can get two people with a rift on at the same time to test it out i recommend you test that first to make sure your not having the shudder issues with the rift

I look forward to see if the performance is any better than stock :)

Congrats on getting the game out I can't wait to give it a good once over