O'Reilly logo

Multiplayer Game Development with HTML5 by Rodrigo Silveira

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

Fixed-time step

The first thing that we'll update in our server's code is the game loop, and the first thing that it'll do differently is that it will no longer have the concept of delta times. In addition, we will need to queue up all input from each client between update cycles so that we have the data to update the game state with, when we run the physics update.

Since we're now using a consistent time step, we have no need to keep track of delta times on the server. As a result, the server also has no concept of delta times from the clients' perspective.

For example, imagine a racing game where a player is driving at, say, 300 pixels per second. Suppose this particular client is running the game at a frequency of 60 frames per second. Provided ...

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