game-common / pragma.matchlifecycle / MatchFoundPlugin / prepareMatch /

prepareMatch #

open suspend fun prepareMatch(extCreateMatchRequest: ExtCreateMatchV1Request, extMatchmakingKey: ExtMatchmakingKey, gameServerVersion: GameServerVersion, gameServerZone: GameServerZone, players: List<MatchLifecycleCommon.MatchmakingPlayerInfo>, parties: List<PartyRpcCommon.Party>): ExtCreateMatchV1Request

Called before requesting a game server to run a new match. Use to customize the ext data to be sent to the game server after it starts up.

The createMatchRequest includes an already created ExtCreateMatchV1Request from the MatchmakingService. Optionally update this existing ext or create a new one. If no updates are needed, leave this plugin method unimplemented to use the already created ext from the createMatchRequest.

To find the party a player is in, search for a party that has a player with a matching playerId in it, like so:

val partyForPlayer = parties.find { party -> party.partyMembersList.map { it.playerId }.contains(player.playerId) }

Used by:

  • MatchLifecycle.createMatchV2

Return #

Return a ExtCreateMatchV1Request.

Parameters #

extCreateMatchRequest

The initial ExtCreateMatchV1Request from the MatchmakingService.

extMatchmakingKey

The extMatchmakingKey representing the queue this match came from.

gameServerVersion

The game server version for the match.

gameServerZone

The game server zone for the match.

players

The player that are about to join the match.

parties

The party data for the players.