Jump to content
  • Advertisement
Sign in to follow this  
bobrules

Server simulating clients and lag

This topic is 2771 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Reading the valve docs, it appears to me that Client A sends a snapshot to Server, say, every 50 ms.

Server simulates all clients every tick, and every 50 ms, sends client snapshots to all clients.

What I was wondering, if the above is correct, is what does server send to Client B regarding Client A?
Does the server take the snapshot it received from Client A, simulate it for a bit using the keypress information in the snapshot, and send that to client B?

If Client A were to have sent a snapshot with keypress Left and a few ms later press Right, then the simulated position on the Server would be incorrect wouldn't it?
If so would Server tell Client A where Server believes Client A is to correct it?

Also is the interpolation used only on clients, ie, the server doesn't have to apply any interpolation as noone really needs to see what it sees?

Thanks all! Network programming sure is a different beast.

Share this post


Link to post
Share on other sites
Advertisement

If Client A were to have sent a snapshot with keypress Left and a few ms later press Right, then the simulated position on the Server would be incorrect wouldn't it?
The server is never incorrect. The clients are almost always incorrect.
Clients only send inputs to the server. The server sends the game state to clients.
What I was wondering, if the above is correct, is what does server send to Client B regarding Client A?[/quote]Each client receives the full state of every (visible) player, including themselves.
Player state is stuff like position, rotation, velocity, animation, etc...
Does the server take the snapshot it received from Client A, simulate it for a bit using the keypress information in the snapshot, and send that to client B?
If so would Server tell Client A where Server believes Client A is to correct it?[/quote]The snapshots sent from client to server only contain inputs - the server can't "simulate the snapshots".
All client key-presses are fed into the servers simulation. The state of that simulation is then sent to all clients.
Yes, if the clients local predicted simulation is wrong, the it will be corrected using the server's version.
Also is the interpolation used only on clients, ie, the server doesn't have to apply any interpolation as noone really needs to see what it sees?[/quote]Yes, interpolation is only used on the graphical representation of things (on the client-side).
The only exception to this is server-side lag compensation, where player positions are interpolated backwards in time, to guess where the player thought they were when they fired their gun. That's another whole complex layer on top of the basics though.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!