game / pragma.gameinstance / GameInstanceService / createGameInstanceV1 /
createGameInstanceV1 #
suspend fun createGameInstanceV1(session: ServiceSession, request: GameInstanceRpc.CreateGameInstanceV1Request): GameInstanceRpc.CreateGameInstanceV1Response
Create a new game instance.
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.
If a game server is requested, a timeout of length GameInstanceServiceConfig.connectPlayersTimeoutMillis 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.
If the GameInstancePlugin.handleBackendCreateByMatchmakingRequest call throws an ApplicationErrorException, the game instance will not be created.
Plugins
- GameInstancePlugin.handleBackendCreateByMatchmakingRequest - Optionally allocate a game server.