During the process of refactoring my network code I realized that my clients are connecting to only one server, and this one server has no outlet to any other servers. This means that players would only be able to chat and play with other players who are connected to the same exact machine. This is obviously a problem if I intend for my game to support a lot of players across multiple regions. So I began writing code for master servers.
There are now 4 different servers each with their own independent process: Login, Lobby, Game, and Master Lobby. The lobby server will receive packets (i.e. ChatMessage) from clients, then relay that packet to the Master Lobby server which then relays the packet to all Lobby servers in a region who then relay the packet to any clients they are connected with. Similar behavior will be put in place for requesting a list of games – the client asks for a list of games in a specific region, the Lobby server relays the request to the Master Lobby server, the Master Lobby server then tells all game servers in that region to send their games to the client.
I’m no expert in networking and this is all a big experiment, I’m not sure how well this is going to work out in the long run. If it doesn’t work then it’ll be a lesson learned and I’ll be rewriting the networking code all over again.
The refactoring process for Login and Lobby servers is just about done. I can move onto gameplay pretty soon and begin implementing fancy networking models and re-creating all the gameplay interface to support the new HTML system.
If you like my blog please consider following on Facebook where I post the same weekly blogs and an occasional screenshot or video.
http://facebook.com/aggressivegamingcom
↧