Summary

The focus of this chapter was to reduce the perceived latency between the authoritative server and the clients that it runs. We saw how client prediction can be used to give the player immediate feedback while the server determines the validity of a player's requested move and intent. We then looked at how to incorporate the lockstep method on the server so that all the clients are updated together, and every client can also deterministically reproduce the same world state that is calculated by the game server.

Finally, we looked at the two ways to correct a bad client prediction. The methods we implemented are teleportation and linear interpolation. Using these two error-correction methods allows us to show the player a close approximation of what should happen as a result of his or her input, but it also makes sure that their multiplayer experience is accurate and identical to what other players are experiencing.

In the next chapter, we will take a step into the future and play with some of the newer HTML5 APIs, including the Gamepad API, which will allow us to ditch the keyboard and use the more traditional game pad to control our games, Full-screen mode API, and WebRTC, which will allow us to do true peer-to-peer gaming and skip the client-server model for a while, and much more.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.107.25