Please note: Although this question involves a link to the Source Engine, its really a generic question about client-server interactions in multi-player games, and I think can be answered by anyone with such experience.
So I just started reading this article on multiplayer networking and only got through the first paragraph before I already had a slew of questions. Most of these questions can all be addressed if I simply could get help understanding the diagram at the top of the page:
Here is my understanding of the first paragraph, regarding snapshots:
A snapshot is something sampled on the server and broadcasted out to all connected clients. Ideally, in a perfect world with zero latency, clients could send updates to the server, and the server could broadcast each and every update back out to all the other clients. However this is not a perfect world, latency does exist and is both chaotic and unpredictable; and so by servers sending these snapshot "heartbeats" out at regular frequencies, all clients can receive updates at the same rate, consistently. Yes? No? Kinda/sorta?
Assuming I'm more or less correct about the underlying purpose of snapshots, then I'm trying to understand what is happening in that diagram above:
- The client is currently at
Tick=115
, but the server is atTick=130
, but why?! Why is the client behind? - Why does the client "buffer snapshots for 100ms"? What's going on there? Is that just the time it takes (roughly) to process a snapshot from the server?
- Why is the server simulating the world (and what does that even mean?!) at 33Hz but only sending out snapshots at 20 Hz?
I know these are a lot of tiny/small questions but think they can be addressed with a single answer explaining what is happening in the diagram. Thanks in advance!
cl_updaterate
below) and adjusts depending on network conditions. The client tick is behind the server tick because the server state is authoritative: the client can project world state beyond the last received tick, but client tick 115 occurs when the client receives and processes the packet containing server tick 115 (unless it has already received a later packet, since this is UDP). \$\endgroup\$