Game Server Management #

This section discusses how Pragma Engine interacts with a game server host. Game servers can be hosted by dedicated game server providers, such as Amazon Game Lift, Hathora, Multiplay, or others.

Communication flow #

The Pragma backend communicates with the game server using the following flow:

Game Server Overview

  1. A game instance is created and requests game server allocation. By default, a game server is allocated for every game instance created from matchmaking.
  2. The Pragma Game Instance service generates partner tokens to authenticate the game server with the Pragma backend.
  3. The Game Server Provider plugin passes the game instance ID and partner tokens to the game server hosting provider.
  4. The game server hosting provider allocates a game server for the game instance.
  5. The allocated game server establishes a WebSocket connection with Pragma backend.
  6. The game server links to the specific game instance.
  7. Using the Pragma SDK, game servers can communicate with the Pragma backend and perform tasks such as connecting players to the game server, updating custom game data, updating player data, or ending a game.

Partner tokens #

For game servers to communicate with the Pragma backend, they need to provide two partner tokens: a Social Token and a Game Token, which authenticate the game server with the Pragma backend. These tokens are generated by the Pragma Game Instance service and passed to the game server when allocation is initiated.

The game server is required to send the partner tokens with every request to the backend. However, once the tokens are provided to the Pragma SDK, the SDK handles including the tokens on every call. See Provide SDK with partner tokens for information on passing tokens to the Pragma SDK.

Each game server should have its own unique set of partner tokens. Sharing tokens may result in unintended behavior.

Game server timeouts #

To ensure game servers are functioning properly, the Game Instance service performs regular checks through configurable timeouts. The Game Instance service monitors the following:

  • How long it takes for a game server to allocate and link itself to the game instance
  • How long it takes for a game server to connect players
  • How long it takes for the game server to reconnect after it crashes or a web socket disconnects

If any of these situations exceed the configured timeout, the associated game instance is terminated and all players are removed from the game.