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

Implementing an authoritative server

The strategy that we'll use for this server will be to run two game loops for two different purposes. The first loop is the physics update, which we'll run close to the same frequency as the clients' loop. The second loop, which we'll refer to as the client sync loop, is run at a slower pace, and at each tick, it will send the entire game state to every connected client.

At this point, we'll only focus on getting the server working as we've described. The current implementation of the clients will continue to work as it did, managing the entire game logic locally. Any data a client receives from the server (using the game sync loop) will only be rendered. Later in the book, we'll discuss the concept of client ...

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