In the next part of this multiplayer game tutorial the client is made dumb and the server authoritative.
"This is a continuation of the multiplayer game tutorial series with Phaser in the client and Node.js in the server. In the first part:
- We successfully set up the developing environment.
- We connected the clients and the server with Socket.io and Express.js.
- We synced all client movements so that the server has one game state.
However, remember that our implementation is very naive because we’re sending our client position directly to the server, and we are broadcasting that position back to the rest of the connected players.
What’s a solution then? We can make our game “Server Authoritative”. This means that all the important data is stored and calculated in the server. We can make our game more secure by sending inputs to the server instead of the position. And then, we can calculate the new position of the player and broadcast it to other players. However, there is one problem. Note that we are using physics for following mouse pointers. It’s not as simple as pressing the arrow keys to move the player. This means that we need a physics system in the server as well!."
The first book on the creation of HTML5 cross platform games using Phaser 3 and other free software.
- By Emanuele Feronato
- 155 Pages
- 28 Source Code Examples
- Build a complete game from start to finish
- Cross Platform
- Scaling for devices