[Multiplayer ARPG] Master Servers

Published by August 11, 2017 5:24 pm 3 Comments Category:

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.

3 Comments

  • Jaron August 11, 2017 7:52 pm

    It might be beneficial to research how cluster computers communicate on a lan, I assume you could use a similar model to handle the fetching of available servers and handling the chat and such. Then you may not have to scrap all of your other work, just have it routed through a node server.

  • Jaron August 11, 2017 7:53 pm

    Just a thought

  • Crayz August 11, 2017 11:38 pm

    I’ll look into that, thanks. All oold netcode was due for a rewrite anyways so I don’t mind scrapping it, and my new code should make it easy to implement some cluster communication stuff if it comes to it

Leave a Reply

Your email address will not be published. Required fields are marked *