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:
- Set the NewGameInstance.ext on the constructor or replacing the variable.
- Set the NewGameInstance.gameServerZone on the constructor. You can replace the value later if needed.
- Assign players to a team by calling NewGameInstance.setTeamByPlayers.
- Call the NewGameInstance.continueMatchmaking method with a MatchmakingQueueKey if the NewGameInstance should continue to find players in a matchmaking queue after being created.
- Create a NewGameInstance object and return it to start a new game.
- Return null to continue the matchmaking loop, if the requirements to start a new game have not been met.
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. |