Beta features require the
CountsAndLists feature gate to be enabled in your Agones installation. These APIs are stable but may still evolve based on feedback.Overview
The Beta SDK provides Counters and Lists for advanced capacity management. These features enable sophisticated tracking of game server resources beyond simple player counts. Package:agones.dev.sdk.beta
Use Cases
Counters
Counters track numeric values with capacity limits:- Player slots by class: Track warriors, mages, healers separately
- Resource consumption: Monitor memory, CPU, or bandwidth usage
- Match statistics: Count rounds played, objectives completed
- Session types: Track ranked matches, casual matches, etc.
Lists
Lists track string values with capacity limits:- Player IDs by team: Separate red team, blue team players
- Active sessions: Track match IDs or room names
- Feature flags: Store enabled features for the server
- Map rotation: Track available or played maps
Counters
Counters are named numeric values with a count and capacity. They support get, set, increment, and decrement operations.Counter Structure
GetCounter
Retrieves the current state of a counter.Request
The name of the counter to retrieve.
Response
The counter name.
The current count value.
The maximum capacity.
Example Usage
UpdateCounter
Updates a counter’s count and/or capacity. This method can set absolute values or increment/decrement.Request
The counter update specification.
Response
The counter name.
The updated count value.
The updated capacity.
Error Codes
NOT_FOUND: Counter doesn’t existOUT_OF_RANGE: Count would be outside [0, capacity]
Example Usage
Lists
Lists are named collections of string values with a capacity limit. They support get, update, add, and remove operations.List Structure
GetList
Retrieves the current state of a list.Request
The name of the list to retrieve.
Response
The list name.
The maximum capacity.
Array of string values currently in the list.
Example Usage
UpdateList
Updates a list’s values and/or capacity. This overwrites all existing values.Request
The list specification with updated values.
Field mask specifying which fields to update (e.g., “capacity”, “values”). If a field is in the mask but not set in the request, it’s set to the default value (0 for capacity, empty array for values).
Response
The list name.
The updated capacity.
The updated array of values.
Error Codes
NOT_FOUND: List doesn’t existINVALID_ARGUMENT: Invalid field mask path
Example Usage
AddListValue
Adds a single value to a list.Request
The name of the list to add a value to.
The value to add to the list.
Response
The list name.
The list capacity.
The updated array including the new value.
Error Codes
NOT_FOUND: List doesn’t existALREADY_EXISTS: Value already in the listOUT_OF_RANGE: List is at capacity
Example Usage
RemoveListValue
Removes a single value from a list.Request
The name of the list to remove a value from.
The value to remove from the list.
Response
The list name.
The list capacity.
The updated array excluding the removed value.
Error Codes
NOT_FOUND: List doesn’t exist or value not in list
Example Usage
HTTP Gateway
Beta SDK methods are available via HTTP/JSON:Complete Integration Example
Best Practices
Counter Usage
- Use counters for numeric capacity: Track things that have numeric limits (player slots, resources)
- Prefer countDiff for increments: Use relative changes instead of absolute values when possible
- Check capacity before incrementing: Handle OUT_OF_RANGE errors gracefully
List Usage
- Use lists for identifiers: Track player IDs, session IDs, or other unique strings
- Set appropriate capacity: Lists have a maximum capacity of 1000 items
- Use AddListValue/RemoveListValue: Avoid UpdateList which overwrites all values
- Handle duplicates: AddListValue returns ALREADY_EXISTS if the value exists
