My Online Multiplayer Game Architecture

Hello,

I had to explain to someone about how my networked game is structured and I came up with a simple diagram (I made in a few minutes) showing different parts of the projects and technologies that are used. Not perfect though!

Putting it here anyway hoping someone might find it helpful! :slightly_smiling_face:

Diagram is made in https://app.diagrams.net

15 Likes

Why microservices?

1 Like

Well, it is not like the real-world microservices we see in an enterprise, there is no discovery server, and no load balancing,…

They are simply two stand-alone spring boot apps communicating via REST API. If I ever want to make multiple networked games, then there will be a master server for each game but I am going to have only one account server.

2 Likes

Looks great, thanks for sharing, keep us updated with this!

So, as far as I understood, those microservice APIs are meant to manage the Game databases through account servers via REST APIs, Right?

1 Like

Hi, looks ok. Its always a lot of work with microservices. But worth for bigger projects. At least with structure like this you can add more microservices that will help. For example split match making/etc.

1 Like

Thanks, guys for joining the discussion, I appreciate your feedback.

The account server has its own database (MongoDB Atlas) to only keep user login info and account balance (I am still not 100% certain if I want to add a wallet or not).

The master server also has its own database (again using MongoDB Atlas). This server will keep a dynamic list of online game servers and their IP address, when a client wants to connect to a game server hosted by a friend it will ask for the connection info from the master server. It also contains features like a social profile (for friends list,…), and store boards,… It will also contain a virtual shop for buying special items. Unlike physical village shops that use in-game coins, virtual shop will use real currency.

So for example when a player buys an item from the virtual shop (master server), the master server will make a REST request to the account server to check the player balance and process item purchasing.

I may also consider saving player inventory data and stats on the master server as well so when he connects with a different device his inventory items and stats will be synced.

Finally, the game server is a JME server and runs game systems simulation (Physics, AI,…) with ECS (I am using Simsilica libraries like Zay-ES, SiO2, SimEthereal,… ). Entities data (npcs, enemies,…) is persisted in an embedded and fast (hybrid) SQL database (HSQLDB) that is handled behind the scene by Zay-ES.

When a game server is started it must register itself on the master server so it will be visible to other players for connecting.

5 Likes