game-common / pragma.matchmaking / MatchmakingPlugin / initialize /
initialize #
open fun initialize(queueKey: MatchmakingRpc.MatchmakingQueueKey, matchable: Matchmaking.Matchable): NewGameInstance?
Called with a new Matchmaking.Matchable before it enters matchmaking. Perform any validation logic or initial transformations to party, players, or ExtMatchable here. Return a NewGameInstance to start the game instance before it enters the matchmaking queue. Return null to continue to the matchmaking queue. If the Matchmaking.Matchable is not valid, prevent it from entering matchmaking by throwing an ExtException.
If returning a NewGameInstance:
- Add parties to the new game instance by calling NewGameInstance.addParties. You can optionally set their team number or use the default team number 0.
- 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.
If this method throws an exception the Matchmaking.Matchable that is being initialized will be rejected from the queue.
Parameters #
queueKey | There are separate queues for each distinct MatchmakingQueueKey. |
matchable | The newly created Matchmaking.Matchable representing a matchable entering a matchmaking queue. |