Hey @devnull
1. Matchmaking
Matchmaking is an asynchronous request which either returns a successful matchmaking ticket (not the actual Match) or times out based on your server matchmaking timeout configuration. Matchmaking is for finding users based on criteria and is not tied to matches, it is not match listing (searching).
If you adjust the matchmaking criteria to a minimum and maximum of 4 players, when 4 matchmaking players are found they will all receive the ReceivedMatchmakerMatched
event at roughly the same time and they they can each call JoinMatchAsync
with the same matchmaker ticket.
The first player to call join will have the actual Match created on the server, the rest will join it. After joining the match, the match will have 1-4 presences in it as players joining asynchronously. You can check when there are 4, or communicate via sending messages, to trigger game specific logic.
See how the Matchmaker event and Match creation/joining are separate. This is intentional so matchmaking could also be used to form a group, party, chat, etc.
2. Preventing players joining active matches
Since Matchmaking never returns actual Matches only players looking to create/join a match together, players won’t be able to join active matches using matchmaking.
In your game client you will Matchmake to find 3 other players, join a Match, and when the Match ends Matchmake again or perhaps create a Match with the same players.
If a player dropped out during a match, they could rejoin using the match id. Other players won’t be able to find the match without you explicitly developing the feature to list, filter and join matches.
Game lobby
I wouldn’t associate Matchmaking with what you are thinking of as a pre-game lobby.
- Matchmaking looks for other players
- While players are matchmaking show a progress screen with a timer
- Enough players are found and they create/join a match
- Your game elects a player to be the leader, or use some other system like player voting
- Your game puts players into a “lobby” state first where they can chat and set match specific settings etc
- The leader, or by voting, progresses the match from the “lobby” state to the “playing” state
How you handle states, lobbies, rounds etc within a match is up to you.
Let me know if you have any further questions.
Kind regards,
Sean