Tavant Logo

Agones – a Kubernetes-centric Game Server Toolkit

Share to

A typical multiplayer gaming deployment and its maintenance can be a complex process. Unlike web applications, game servers have a complex lifecycle. They need to connect to the clients directly, and the latency needs to be at the lowest for a better user experience. Other challenges include aspects like scaling for surges, planning, and continuous delivery of games changes to players across different regions, and the list goes on. Choosing the right solution becomes important to reduce the overall complexity.

Kubernetes is one of the commonly used container orchestration and clustering solutions. It allows automating application deployment, scaling, and management. However, Kubernetes does not address several game-specific needs. Most companies end up writing custom solutions to allocate game servers, manage players, and auto-scaling. Though Kubernetes can work, it involves a certain degree of custom implementation.

Agones

Agones is an open-source platform for deploying, hosting, scaling, and orchestrating dedicated game servers for multiplayer games, built on top of Kubernetes. Agones replaces custom/proprietary cluster management and game server scaling solutions with an open-source solution to focus on more important aspects of building a multiplayer game. Agones can run on any cloud or on-premise and scale as needed. This helps use any existing on-premise infrastructure, while the cloud can be used for spikes during peak hours.

Architecture 

Agones integrates with Kubernetes and exposes certain APIs, making it easy to handle the game-specific needs of clustering. Agones focuses on online multiplayer fast-paced games requiring dedicated, low-latency game servers with the state usually held in memory for match’s duration. These game servers have a short lifetime; a dedicated game server runs for a few minutes or hours. These fast-paced games are sensitive to latency, hence requiring dedicated game servers also need a direct connection to a running game server process hosting IP and port, rather than going through load balancers.

Agones allows Kubernetes’ tooling and APIs to create, run, manage, and scale dedicated game server processes within Kubernetes clusters. Agones also supports out of the box metrics and log aggregation to track and visualize what is happening across all the game servers.

Agones Integration

Agones provides command-line integration through Kubernetes kubectl. But we likely want to interact with Agones programmatically. This allows Matchmaker to interact directly with Agones to provision a dedicated game server. Agones gives two ways to integrate, one Kubernetes APIs and another directly with Agones API using their SDKs. Agones SDKs are available in various programming languages like Unreal engine, Unity, C++, Node.js, GO, etc.

The above diagram shows the game server allocation workflow. Matchmaker requests a game server through Kubernetes APIs where Agones intercepts the call to serve the request. Agones changes the game server’s status to Allocated and returns the game server IP and port details to the Matchmaker, which in turn is sent to the game client. Allocated game servers are not touched by Kubernetes for scaling down or termination if the status remains ‘Allocated.’ Once the game client finishes the session, the shutdown API called the game server is marked back to the ‘Ready’ state.

Google Game Servers

It is easy to run a cluster in a region or a zone. However, if we wish to run it in multiple areas around the world, things get more complicated. Google Cloud Game Servers is a management layer that sits on top of open-source Agones. It provides a great set of functionalities and features that make it easy to orchestrate and scale multiple clusters of Agones around the world while still not locking into a specific vendor package. It gives a lot of flexibility and power to run the game servers precisely the way we want to. The following diagram shows an example of the deployment of more than one Agones cluster across different cloud providers and on-premise data centers.

Here Realms are a grouping of game server clusters defined by users based on latency, region, etc. Game server clusters are Agones clusters that have registered themselves with Google Cloud Game Servers so that Google Game Servers are aware of them. The rest of the Agones cluster functionalities remain the same. We can run the game servers on the Agones cluster the way we want while GCP deals with autoscaling and managing the fleets.

Downsides 

Agones is a relatively newer framework that recently came out of the beta release. Agones still does not support Windows game servers, which means all the multiplayer games running on Windows will have to wait. Some of the basic game specific functionalities like player handling were added only recently as part of the alpha release. Still away from multi-cluster policies or multi clusters across the globe, and the only workaround is using GCP Game Server.  

In essence

Overall, Agones can be a great open-source tool for deploying, orchestrating, and scaling dedicated game servers. Currently, there are no other ‘openly available’ tools in the industry, and the open-source community seems to be excited about this. Though there are other SaaS services like GameLift by AWS and Playfab by Azure, with the SaaS services, we will not be able to use on-premise infrastructure. The features provided may not in-line with what we are looking for, while open-source tools are primarily shaped by the community. Agones is here at the right time, and it is just a matter of time before its popularity explodes.

Tags :

Let’s create new possibilities with technology