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

handleBackendCreateRequest #

open suspend fun handleBackendCreateRequest(gameInstanceSnapshot: GameInstance.GameInstance, requestExt: ExtBackendCreateRequest, playersToAdd: Map<<ERROR CLASS>, ExtBackendAddPlayer>)

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.

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 map of player ids to ext data for each player to add to the game instance.