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 ...

Get Unity Multiplayer Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.