Synchronizing different clients
Until now, we learned about computer networking and set up a connection between multiple instances of our game. The next step is to change the scenes and code within our game to account for multiple players. We want to accomplish two things:
- Firstly, if the server instances a new scene, such as a new projectile, we want that scene to be instanced on every client
- Secondly, we want to synchronize values, such as the position of each player character, between all clients
We’ll first look at which Godot Engine nodes can help us achieve these two goals while updating the player character to be used in multiplayer. After that, we’ll update the entity spawner, enemy, collectible, and projectile scenes, too. Most of these changes will be quite small.
Updating the player scene for multiplayer
Because the player is the most important entity in the game, let’s start by updating them for multiplayer. This way, we can...