game-common / pragma.matchmaking / MatchmakingPlugin / endOfLoop /

endOfLoop #

open fun endOfLoop(queueKey: MatchmakingRpc.MatchmakingQueueKey, anchor: Matchmaking.Matchable): NewGameInstance?

Called after completing a matchmaking loop to give the plugin a chance to start a new game instance even if it was not filled during the iteration.

Things that can be done in this method:

  • If a complete game can be formed with the parties presented, create and return a NewGameInstance with those players.
  • Add parties to the new game instance by calling NewGameInstance.addParties with the option to assign a team number or use the default team number 0.
  • Return null to continue the matchmaking loop, if the requirements to start a new game have not been met.

If returning a NewGameInstance:

Used by:

  • MatchmakingService (runs forever, see MatchmakingConfig)

Parameters #

queueKey

There are separate queues for each distinct MatchmakingQueueKey.

anchor

A set of parties to be considered as a matchmaking loop comes to an end without starting a game instance.