game-common / pragma.gameinstance / GameInstancePlugin / handleBackendCreateRequest /

handleBackendCreateRequest #

open suspend fun handleBackendCreateRequest(gameInstanceSnapshot: GameInstance.GameInstance, requestExt: ExtBackendCreateRequest, playersToAdd: List<PlayerToAdd>)

Called when receiving a backend request to create a game instance.

Add the players to the game instance using the GameInstance.GameInstance.addPlayer method. Set data on the game instance by using GameInstance.GameInstance.dataStore or GameInstance.GamePlayer.dataStore.

If called by a game server, the game server will be automatically linked to the created game instance.

To prevent the game instance from being created, throw an application error.

Default implementation: adds players to the game instance and allocates a game server to host the game instance.

Parameters #

gameInstanceSnapshot

The game instance to be created.

requestExt

The data sent along with the request.

playersToAdd

A list of players to add to the game instance.