Player Tracking
Track connected players in real time across your game servers. Your game server reports player connections through the GameFlow Game Server SDK, and GameFlow surfaces live player counts in the dashboard.
How It Works
- When you create a game, set Max Players per Server (e.g. 64)
- GameFlow provisions a
playerslist with that capacity - Your game server calls
players.connect/players.disconnect(via the SDK) when players join and leave - GameFlow surfaces the live count in the dashboard
Each game server only has access to its own player list, scoped to that server instance.
Configuration
When creating or editing a game in the dashboard, set the Max Players per Server field in the Resources section. This defines the maximum concurrent players each server instance can hold.
The value is used for:
- Dashboard display: shows
current / capacity(e.g.12 / 64) - Allocation filtering: only allocate to servers with available capacity (future)
- Fleet autoscaling: scale based on player load (future)
Integrating with Your Game Server
Player tracking is part of the Game Server SDK lifecycle. Register a session as a player connects and unregister it as they disconnect. Use any stable unique identifier (session id, account id). The SDK keeps a local cache, so reads like count() are synchronous and free.
Player tracking keeps your server alive. GameFlow shuts down servers that report zero connected players past your organization's idle timeout, so always report on join and leave. See the SDK Quickstart for the full lifecycle (connect, ready, payload, shutdown).
- TypeScript
- Godot
- Rust
- Go
- Unity (C#)
- Unreal (C++)
// when a player joins
await gf.players.connect(client.sessionId);
// when a player leaves
await gf.players.disconnect(client.sessionId);
gf.players.count(); // synchronous: current player count
# when a player joins
await gf.players.track(session_id)
# when a player leaves
await gf.players.untrack(session_id)
gf.players.count() # synchronous: current player count
// when a player joins
gf.players().connect("player-123").await?;
// when a player leaves
gf.players().disconnect("player-123").await?;
// when a player joins
gf.Players().Connect(ctx, "player-123")
// when a player leaves
gf.Players().Disconnect(ctx, "player-123")
// when a player joins
await gf.Players.Connect(sessionId);
// when a player leaves
await gf.Players.Disconnect(sessionId);
var n = gf.Players.Count; // synchronous: current player count
// In PostLogin:
GF->ConnectPlayer(SessionId, [](FGameFlowError Err) { /* ... */ });
// In Logout:
GF->DisconnectPlayer(SessionId, [](FGameFlowError Err, bool bWasTracked) { /* ... */ });
connect throws/returns a "server full" error when the list is at capacity and a "player already connected" error on duplicate ids; disconnect is idempotent. See each SDK's error codes in the Quickstart.
Where Player Data Appears
| Location | What it shows |
|---|---|
| Server list | Players: 12 / 64 per server |
| Server details | Player Count: 12 / 64 |
| Games page | Total players across all servers for the game |
| Server history | Final player count when the server exited |
API Reference
Player data is included in the following API responses:
GameServer (List/Detail)
{
"playerCount": 12,
"playerCapacity": 64,
"connectedPlayers": ["player-1", "player-2", "..."]
}
GameView (Games List)
{
"playersCount": 48
}
Notes
- Player tracking only works when Max Players is set to a value greater than 0. When it is 0, tracking is disabled and the SDK logs a warning at startup.
- The player list key is always
playersand cannot be changed. - Player tracking calls run locally on the server instance, so they're fast.
- Registering and unregistering players only updates the tracking list. It does not connect or disconnect players: your game server is responsible for managing real connections.