Logging the player in to the server
In this section, we will implement a different type of logging system. This time, the players don’t have a lobby screen where they wait for other players to join a game and start a match. No, here the world is always active; it doesn’t start only when the players ask the server to start the match or the game. And this type of connection requires a different approach.
The major problem is that since the game world is always active and running, the players who join this world need to sync their game instance to the server’s game instance. This includes the position of objects, new objects that usually are not part of the world, for instance, other players and the number of objects (in our case, how many asteroids are currently available), and many other factors necessary to build a shared world.
It all starts with the player authentication, because now the server and the client are in different parts of the game life cycle...