game-common / pragma.matchmaking / MatchmakingStrategy /

MatchmakingStrategy #

interface MatchmakingStrategy

The MatchmakingStrategy is responsible for handling all matchmaking logic. It contains functionality to validate party state upon entering matchmaking, and determines how parties are matched together into matches.

Functions #



abstract fun addToMatchAndBuildMatchmakingDetails(matchmakingKey: ExtMatchmakingKey, partiesByTeamId: MutableMap<Int, MutableSet<MatchmakingParty>>, partyToAdd: MatchmakingParty): Pair<ExtCreateMatchV1Request, String>?

Used to form a match of PartyService-based players. Will be invoked many times during the matchmaking loop. Each time it is called, determine if the partyToAdd should be part of the match you are forming. If they are, add them to partiesByTeamId. If adding that party means your match is ready to play, return an ExtCreateMatchV1Request. If you still need more players, return null.


abstract fun validate(matchmakingKey: ExtMatchmakingKey, matchmakingParty: MatchmakingParty)

Validates that a PartyService-based party can be added to matchmaking. If validation fails, throw an ExtException.