The client-side prediction
If a game employs server-authoritative physics, it usually also needs to employ client-side prediction of player-controlled objects in order to hide the effects of lag. However, this is a more difficult problem than it appears at the outset.
Let's say the server periodically broadcasts the state of all objects. If a player is predicting their own object (and sending inputs to the server), what happens when the player receives a server update? Usually, especially when moving, they snap backward to where they were a moment ago in a motion deemed "rubber-banding". This is because there is always a lag between the client and server.
- Client sends input to server and begins moving (resulting in picture 2).
- Server receives message and starts moving player (resulting in picture 3).
- Server sends current position to client (snapping client back to the old position as shown by the dotted circle). The way Source engine and other games handle this involves a fair...