I have a game server which is going to run on a few instances.
World 1, World 2, World 3
Each world is a server that runs on a different IP Address.
There is a list of what the game should have:
- Connection to the game, authenticating the user.
- Ability to see all connected players, display what world each player is connected to.
- Ability to message a player, even if hes connected to a different world server.
- Ability to send global message to all servers.
There are two approaches to make this that I can think of:
Approach 1 - Login Server TCP/IP
Create a middle-man server. When a client connects to a world, that world server will send a login request packet for the entered user credentials and the login server will check against the database and respond with the result of the authentication, if succeed, the user will be authorized in the world.
Login Server will always update all worlds with the list of the online players, and the state of each player, what world he is on, etc.
- When sending a message to player Y from player X when both are on different worlds, the world server will send a message to login server, and login server will pass it to the target world of that player so the player in the other world will receive the message.
Approach 2
Work the same as approach 1 but instead of a login server, have an HTTP API server, and update each other with events using Redis server. Why do I think that this is better? Because it will be easier to integrate a web application to the game, so allow users connected and chat with each other via a web application.
In order to do that in approach 1, you need to add a new tunnel to your TCP/IP login server to support WebSocket connections.
Sorry for the bad drawings.
Is approach 2 possible? What do u think is a better approach and if there is some other approach you can think of?