Allocating based on GameServer Player Capacity

Find a GameServer that has room for a specific number of players.

Counters and Lists will eventually replace the Beta functionality of Player Tracking, which will subsequently be removed from Agones.

If you are currently using this Beta feature, we would love for you to test (and ideally migrate to!) this new functionality to Counters and Lists to ensure it meet all your needs.

This document will be updated to utilise Counters and Lists in the near future.

Using this approach, we are able to be able to make a request that is akin to: “Find me a GameServer that is already allocated, with room for n number of players, and if one is not available, allocate me a Ready GameServer”.

Common applications of this type of allocation are Lobby servers where players await matchmaking, or a persistent world server where players connect and disconnect from a large map.

Player Capacity Allocation Diagram

Example GameServerAllocation

The below allocation will attempt to find an already Allocated GameServer from the Fleet “lobby” with room for 10 to 15 players, and if it cannot find one, will allocate a Ready one from the same Fleet.

apiVersion: "allocation.agones.dev/v1"
kind: GameServerAllocation
spec:
  selectors:
    - matchLabels:
        agones.dev/fleet: lobby
      gameServerState: Allocated
      players:
        minAvailable: 10
        maxAvailable: 15
    - matchLabels:
        agones.dev/fleet: lobby

Next Steps

  • Have a look at all commands the Client SDK provides.
  • Check all the options available on GameServerAllocation.
  • If you aren’t familiar with the term Pod, this should provide a reference.

Last modified July 17, 2024: Introduce external resource(s) on multiplayer game programming to docs (#3884) (03a0a4c)