Posters Name: Kagato
Posters Email: email@example.com
Subject: Q3 Networking Made Easy
UKGamer has posted an article entitled "Q3 Networking made easy", in which they break down workings behind Quake3 networking, dispelling a few common misconceptions, "explaining exactly what timenudge actually does, and just how arQon's famous '50ms code' makes Q3 all that much better". Snip:
Consider a single client joining a server, or at a map_restart. At that instant, the server sends the client a packet of information called a snapshot. This packet includes the position of each entity on the map that your client can see, and it's current velocity, i.e. it's speed and resultant direction. At this point, the client stores this information and does nothing with it, despite the real world obviously continuing on and the entities moving across the map.It's a tad long, but an interesting read if you've always wondered how some of the stuff actually works.
After a set amount of time, the default being 50 milliseconds, (though this can be changed as I'll explain later) the server sends the client another snapshot, with updated information for each entity. At this point, the client then interpolates the information from the two snaps. In essence, it looks at where each entity was in the first packet, where it is in the second packet, and then draws a path across the map for each. It does this using a simple expression of movement against time, referencing time elapsed at the point the renderer calls for each frame to be drawn against the time stamps in the two snapshots themselves. This gives it an idea of how far through this movement described by the two snapshots the entity should be, relative to how long it is now after the last snapshot was received. This is why, despite only receiving 20 snapshots of information a second, that the client is capable of rendering any number of frames per second the user wishes. Remember however, this movement has of course already happened relative to real time. As each frame is rendered and time passes, the game world obviously moves on, but the client is oblivious of this until the next snapshot is received, when the process starts over.