Skip to main content

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

  1. When you create a game, set Max Players per Server (e.g. 64)
  2. GameFlow provisions a players list with that capacity
  3. Your game server calls players.connect / players.disconnect (via the SDK) when players join and leave
  4. 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.

tip

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).

// 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

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

LocationWhat it shows
Server listPlayers: 12 / 64 per server
Server detailsPlayer Count: 12 / 64
Games pageTotal players across all servers for the game
Server historyFinal 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 players and 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.