1
\$\begingroup\$

I'm trying to find a way to design a game server architecture for a real time mobile game. The design should be cost effective but still to some extend scaleable (later on).

Mobile client flow:

Connects to a distributor server which was given by DNS LB and gets grouped with x players. If y players are reached, the distributor server needs to contact a control server, which starts or uses a already running game server. The control server sends back the ip and port to the distributor server which then sends it to the grouped players. The players then connect to the given game server. After the game the players will be send together to a new or same distributor server.

I wonder how the real server (VMs) for the game servers can be managed in a dynamic matter. I have looked at AWS EC2 instances, but if we have 500 players with 6 players per group that play 6 hours per day, we would need ~84 EC2 t3.small (2 vCPU, 2GiB RAM) instances running. This will cost ~1,160.00 USD monthly. With this price it would be favorable to have real VMs and not dynamic cloud instances I guess?

enter image description here

Explanation of the components

Distributor:

Mobile clients will connect to these to get grouped with other players. It's like a lobby where players will sit until X players are reached or eg. a countdown ran out.

Control Server:

Need to take care of started server (VMs) and handle game server start requests from the distributors.

Game Server:

Is an authoritive like server client with physics etc. One game server (software) for X players in a group. Players will connect to these from the distributor after the lobby "phase".

Question:

How can this be dynamic scaleable/cost effective and is this a useable architecture? I see one problem with the control server because it must take care of N game server vms and N distributors. But if we scale the control server, then every control server needs to know the same as every other.

(If anything is missing or can be improved, please let me know. English is not my native language so it's a bit challenging to express my goal in such a complicated topic like this)

\$\endgroup\$
0
\$\begingroup\$

Do you really need a full-fledged VM for every 6 player game session? This is going to generate a lot of overhead. It might be far more efficient to run multiple server processes on the same virtual server and even more efficient to let your game server software handle multiple games in parallel in one process.

  • You are saving the overhead of running multiple full-fledged operating systems and runtime environments as well as the overhead of spinning up and shutting down AWS instances all the time (Yes, Amazon got pretty good at this, but still...)
  • You are saving RAM and inter-server network load because the games can share data when they are running on the same process.
  • You are utilizing CPU time more efficiently because a more powerful server running multiple games can handle CPU load spikes generated by a single game far more gracefully than a small server running only that one game.

In order to allow horizontal scaling on multiple physical servers, the control server should be able to handle multiple gameserver hosts which each handle multiple sessions and be capable of load-balancing between them.

\$\endgroup\$
  • \$\begingroup\$ Hey, I thought about VM in the sense of a Amazon EC2 instance with 2 vcores or so. I don't need them now theoretically, but how can I auto scale it without the cloud server instances? The game server is a Unity headless instance, which I think is better suited for one game per game server so it can also be easier scaled with time. I can have one or two bigger root servers where X game servers can be running than. It would be fine in the beginning, but what if I need auto up and down scaling of game servers after the beginning? \$\endgroup\$ – Left Over Jun 24 at 8:17
  • \$\begingroup\$ @LeftOver This is more of a topic for system administrators than game developers, but I heard good things about technologies like Docker and Kubernetes which allows you to move arbitrary server applications around physical or logical servers. \$\endgroup\$ – Philipp Jun 24 at 8:21
  • \$\begingroup\$ I have used docker before, but I would need bare metal root server too or am I wrong? And the control server would need to manage the containers/pods and some sort of scaling rules? \$\endgroup\$ – Left Over Jun 24 at 8:29
  • \$\begingroup\$ @LeftOver Amazon advertises how well Docker works with AWS. \$\endgroup\$ – Philipp Jun 24 at 8:32
  • \$\begingroup\$ Thanks, so I think the Amazon Elastic Container Service might be it. But it's really difficult to get a price overview for like 500 Monthly players (*1). I wonder how to manage the instances, so that a distributor can choose or start a container with the game server inside? Edit: *1 One can assume that these players are only active for very few hours, so I can calculate with that but it's not really precisely. \$\endgroup\$ – Left Over Jun 24 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.