Documentation

Support

Multiplayer Services SDK

All Services

Multiplayer Services SDK

Match make with the Quick Join API

Quickly match make players using Lobby's Quick Join.
Read time 1 minuteLast updated 4 hours ago

Use the Lobby service to have a player randomly join any session that's compatible with the parameters and filters passed to the
MatchmakeSessionAsync
method.
The following example demonstrates how to find and join a session in a single operation:
var quickJoinOptions = new QuickJoinOptions(){ Filters = new List<FilterOption> { new(FilterField.AvailableSlots, "1", FilterOperation.GreaterOrEqual), new (FilterField.StringIndex1, "map 1", FilterOperation.Equal) }, Timeout = TimeSpan.FromSeconds(5), CreateSession = true};var sessionOptions = new SessionOptions(){ MaxPlayers = 2, Type = "Session",}.WithRelayNetwork();ISession session = await MultiplayerService.Instance.MatchmakeSessionAsync(quickJoinOptions, sessionOptions);
This code tries to join a session that has at least
1
available slot and the property
map 1
.
MatchmakeSessionAsync
continues searching for a session until the set timeout of
5 seconds
is reached.
At this point, if the player can't join a session for any reason, such as all available sessions being full, the quick join operation can optionally create a new session using the
CreateSession
parameter. Note that the new session is only created after the set timeout has expired, if set.
When the quick join operation finds or creates a session, it configures networking to use Relay connections.