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\$

1 Answer 1

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\$
4
  • \$\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, 2019 at 8:21
  • \$\begingroup\$ @LeftOver Amazon advertises how well Docker works with AWS. \$\endgroup\$
    – Philipp
    Jun 24, 2019 at 8:32
  • \$\begingroup\$ @LeftOver The technical details about how to manage AWS instances in an automatic way apears to be a separate in-depth question specific to the AWS API. You might want to ask this as a separate question. Also, it's no longer really gamedev specific, so you might want to ask on stackoverflow.com or serverfault.com. \$\endgroup\$
    – Philipp
    Jun 24, 2019 at 10:51
  • \$\begingroup\$ @LeftOver The reason why it is so difficult to get a price for "500 monthly players" is because it's a completely meaningless metric for a server hoster. They don't know how long each of these 500 players will be connected and they don't know how resources each player will consume while they are playing. That's why they let you pay by the metrics which do have a meaning for them: Storage capacity, RAM, CPU, bandwidth. How much do you need of those? That's what you need to figure out by measuring it. \$\endgroup\$
    – Philipp
    Jun 24, 2019 at 10:55

You must log in to answer this question.