Skip to main content

Launch Payload

The launch payload is data you hand a game server for a specific match, like the match id, game mode, or team roster. It's a string, usually JSON, that your server reads through the Game Server SDK.

Unlike environment variables, which are set once when a server starts, the payload can change if a server is reused for a new match.

Who writes the payload​

It depends on how the server gets its players:

  • Direct allocation: your backend passes a payload string when it starts or allocates a server. Its contents are up to you. See Custom Game Backend.
  • Matchmaking: GameFlow formed the match, so GameFlow writes the payload for you.

Matchmaking payload​

{
"match_id": "match-6f1e...",
"game_mode": "ranked",
"team_count": 2,
"teams": [
{
"team_index": 0,
"players": [
{ "player_id": "p1", "ticket_id": "t1", "slot_index": 0 }
]
}
]
}
FieldDescription
match_idGameFlow's id for the match. Pass it back when reporting match analytics or results.
game_modeGame mode of the tickets that formed the match.
team_countNumber of teams.
teams[].team_indexTeam position, starting at 0.
teams[].players[]Players on the team, with their player_id, ticket_id and slot_index.

Reading the payload​

Call payload() on startup and parse the string. If a server can be reused for another match, also subscribe to payload changes.

var payload = await gf.Payload(); // string (null when none)
// Parse with JsonUtility or Newtonsoft.Json

gf.OnPayloadChange(next => {
// fires when the platform assigns this server to a new match
});
warning

Always read the payload with payload(). Reading GAMEFLOW_PAYLOAD from the environment may work locally, but returns nothing in production.