How Integration Works
When your game server runs on Agones, it runs alongside a sidecar container that manages communication with the Agones controller. Your game server code uses the Agones SDK to communicate with this sidecar via gRPC or HTTP.
The Sidecar Pattern
The sidecar container:- Runs in the same pod as your game server
- Listens on
localhost:9357by default (configurable via environment variables) - Handles all communication with the Agones control plane
- Manages health checking and lifecycle state transitions
Connection Setup
The SDK automatically connects to the sidecar using environment variables:Key Integration Concepts
1. Lifecycle Management
Your game server must signal when it’s ready to accept players and when it’s shutting down:2. Health Checking
Agones needs to know your server is running correctly:- Send periodic health pings (typically every 2-5 seconds)
- If health checks fail, Agones marks the server as
Unhealthy - Health checking can be configured or disabled in your GameServer spec
3. State Transitions
A GameServer progresses through several states:GameServer States
- Scheduled: Pod scheduled but not running
- RequestReady: Pod running, waiting for
Ready()call - Ready: Available for allocation
- Reserved: Temporarily reserved (not allocatable)
- Allocated: Assigned to a game session
- Shutdown: Shutting down gracefully
- Unhealthy: Failed health checks
4. Metadata Management
The SDK allows you to:- Set Labels: Add metadata for filtering and organization
- Set Annotations: Store arbitrary key-value data
- Get GameServer: Retrieve current configuration and status
- Watch GameServer: Receive updates when configuration changes
Available SDKs
Agones provides official SDKs for multiple languages:Go
Full-featured SDK with excellent performance
C#
Perfect for Unity and .NET game servers
Node.js
Ideal for JavaScript/TypeScript servers
Rust
Type-safe SDK for Rust game servers
C++
Native SDK for C++ game engines
Unity
Specialized SDK for Unity game engines
Unreal
Plugin for Unreal Engine integration
REST API
Language-agnostic HTTP/REST interface
Integration Patterns
Simple Integration
The minimal integration requires just a few SDK calls:Advanced Integration
For production deployments, consider:Watching GameServer Updates
Watching GameServer Updates
Monitor configuration changes in real-time:
Server Reuse Pattern
Server Reuse Pattern
Return servers to Ready state after sessions:
Reservation System
Reservation System
Reserve servers before allocation:
Testing Locally
You can test SDK integration locally without Kubernetes:The local SDK server simulates the sidecar behavior for development and testing.
Next Steps
Choose an SDK
Select the right SDK for your tech stack
Lifecycle Management
Learn about Ready, Shutdown, and state transitions
Health Checking
Configure health monitoring for your servers
Advanced Features
Explore player tracking, counters, and lists
