Skip to main content
Version: 5.x

Agones

When using the kubernetes configuration environment, agones becomes the default game server provider as it provides the easiest way to test your game when Redwood is running in Kubernetes.

Agones is an open source extension to Kubernetes developed by Google that provides "batteries-included" mechanisms for scaling game servers along with server orchestration. It's a popular, battle-tested system to use when self-hosting your game servers.

Redwood provides an out-of-the-box solution so you can get started using Agones without needing to understand Fleets, Fleet Autoscalers, Game Server Allocations, etc. However, we recommend reviewing Agones documentation to learn more, especially if you're planning to use Agones in production.

Preparing the Game Server​

Before you can use Agones, you need prepare the game server so it can be containerized to be used within the Kubernetes environment. This boils down to a couple steps:

  1. Package the Server target for Linux.
  2. Copy the output folder (e.g. LinuxServer) to the RedwoodBackend/dist/game-servers folder (create it if it doesn't exist).
    • You can change the name of the folder to something else (e.g. RedwoodBackend/dist/game-servers/LinuxServer-MyGame); you will need to override the associated Realm Instance Config game-servers.local-dir for the realm you're configuring.

From here, the Pulumi deployment scripts will be able to package the game server into a Docker container and prepare the Agones fleet during Kubernetes deployment.

You can see more details about this process in Deploying Locally to Kubernetes.

Fleet configuration​

The default Agones Fleet used is defined in RedwoodBackend/config/node/default/realm/instances/redwoodBase.yaml with the game-servers.agones.fleet config variable. Redwood simplifies the configuration to specifying the name of the image (which automatically refers to values of other config variables), the resources limits/requests to be used, and how the Agones Ready Buffer Autoscaler is configured.

Redwood currently doesn't support other types of autoscalers, but it should be easy for you to add support for them by modifying RedwoodBackend/packages/deployment/src/agones/agones.ts (the autoscaler is created in the installFleet() function). If you have a Premium Support subscription, reach out and we should be able to help with adding support for the autoscaler type you need.

Redwood deploys one fleet per realm (in the realm's namespace, realm-<realm-key> by default), so every server in a realm uses the same game server image and resources. Supporting multiple fleets per realm (e.g. different machine sizes per profile) is a less trivial modification, but definitely feasible, and we encourage Premium Support subscribers to reach out if you need this.

Other Agones-related settings in the Realm Instance Config:

VariableDefaultMeaning
game-servers.agones.arguments""Extra command-line arguments for the packaged game server
game-servers.agones.allocation-timeout-seconds60How long to wait to allocate a server before giving up (e.g. if the fleet is at its maximum or there are no nodes available; consider a larger bufferSize if this happens due to demand)
game-servers.agones.fleet.eviction-safeNeverThe Agones eviction setting for the fleet's game servers
game-servers.agones.fleet.game-server-container-details.resources500Mi/90m requests, 1Gi/500m limitsKubernetes resource requests and limits for each game server
game-servers.agones.fleet.autoscaler.policy.bufferbufferSize: 1, minReplicas: 0, maxReplicas: 10The Buffer autoscaler policy: how many idle ("warm") servers to keep ready, and the fleet's bounds

Scaling Agones​

Redwood installs Agones with its Helm chart (version 1.53.0 by default). By default, the Agones system is set to not install the Ping or Allocator services; the Controller and Extensions services are also set to only have 1 replica. You can see the available configuration variables in RedwoodBackend/config/node/default/deployment/dependencies/agones.yaml to change these. For example, you may need to increase the number of replicas for the Controller service as your CCUs grow. Reach out if you have questions about scaling Agones.