Sign in to follow this  
Followers 0
bobrules

Interpolation And Latency's effect on it

3 posts in this topic

Hi guys. My computer is currently broken so I'm using a friend laptop at the moment, but once it's fixed I want to continue my simple network game.
I was reading the article on http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking and wish to do something similar as my pure extrapolation model has a very bad jerk when the user stops moving.

If I'm not mistaken it works like this - assuming packets sent every 50 ms -
- Client 1 presses Right at time 0 ms.
- Client 1 delays moving itself for 2 times of packet travel - 100 ms.
- Server receives information and send to all other clients.
- Client 2 waits until there's at least 2 ( 3 ? ) packets arrive initially and interpolate client 1's position from last received packet - 2 to last received packet - 1

Is this the correct implementation ?

Also say client 1's latency is huge - say 500 ms, would this affect how client 2 sees client 1? Would it still be smooth, just that client 2 will see client 1 as it was 500 ms later?

Thank you all!
0

Share this post


Link to post
Share on other sites
[quote name='bobrules' timestamp='1296464585' post='4767393']
Is this the correct implementation ?[/quote]Pretty much, you've missed out client-side prediction though;

With a round-trip ping of 100ms:
[b] at time 0 ms[/b]
- Client 1 presses Right - sending a move command to the server.
- Client 1 moves it's own camera to the right - by executing the same move command that it sent.
[b] at time 50 ms[/b]
- Server receives information and uses it in the next update loop
- Server sends new game world information to all clients
[b] at time 100 ms[/b]
- Client 1 compares it's predicted position to the server's new position. If there is a large difference, then the camera smoothly snaps back to the server's position.
- Client 2 waits until there's at least 2 packets worth of data about client 1's position [i](assuming for this example there isn't 2 packets yet)[/i]
[b]at time 150 ms[/b]
- Client 2 interpolates client 1's position from the 2nd last received packet to the last received packet[quote]Also say client 1's latency is huge - say 500 ms, would this affect how client 2 sees client 1? Would it still be smooth, just that client 2 will see client 1 as it was 500 ms later?[/quote]Assuming a client-server design, then the server is simulating client 1's character, and can send updates to client 2 as fast as usual. The server is always the authority on all rules - clients don't move themselves, they just send "I'm holding the move key" messages to the server, and also [i]predict[/i] the outcome of these messages locally [i](and the local predictions can/will be overwritten by the server's version of events)[/i].
0

Share this post


Link to post
Share on other sites
Because of transmission latency, you have to choose one of these main options:

1) Guess about the future. Use forward extrapolation. Remote viewers will see entities out of place, and starting/stopping will be late/over-shooting.
2) Display in the past. Delay the display enough to cover any transmission latency/jitter. Remote viewers will see things in the right place, but later.

These are the two options, because information can't magically teleport faster than light between computers :-) The rest has to be handled with game design.
1

Share this post


Link to post
Share on other sites
Ahh Thanks everyone for your help! Hopefully my computer will up and running so I can test this for sure. :)
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0