game / pragma.gameinstance / GameInstanceService / createGameInstanceV1 /

createGameInstanceV1 #

suspend fun createGameInstanceV1(session: ServiceSession, request: GameInstanceRpc.CreateGameInstanceV1Request): GameInstanceRpc.CreateGameInstanceV1Response

Create a new game instance and find a game server for it run on.

This endpoint creates a game instance object representing the state of the game to be tracked by this service. The game instance object keeps track of the currently connected players to the game. At this point the players are considered associated to the game instance and removed from matchmaking by exchanging the MATCHMAKING_ID on their sessions with a GAME_INSTANCE_ID.

This endpoint ultimately makes a request to MatchCapacityService to find a game server to run this game instance on.

A timeout of length GameInstanceServiceConfig.gameReadyTimeoutMillis milliseconds is set to wait for a game server to call ConnectPlayers for this game instance. If a ConnectPlayers call is not received within the timeout, the game instance is canceled and all players are released back to their party.

PragmaResultErrors

  • PragmaError.GameInstanceService_CapacityRequestFailed - If RPC request to allocate game server capacity fails.