O'Reilly logo

Unity Multiplayer Games by Alan Stagner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required