Is matchmaking compatible with Relay

I’m used to use the Lobby System along with Relay to create matches, I was wondering if the new matchmaking is only made to be used with the Multiplay system? From the documentation, I haven’t found any reference on how to use it with Relay.

Thanks

If you go to the first message in this forum, in the requirements section, it says machmaker is only avaliable for multiplay users

Hi Max_power1965, this is Gladys, product manager of the Matchmaker solution. While Matchmaker currently requires Multiplay, we plan to support Relay sometime next year. Please see our roadmap below for more details:

Hello good day, is matchmaking now compatible on unity relay? I was planning to use relay for my startup multiplayer game and integrate matchmaking.

1 Like

Hello @A_zazel !
Yes, Matchmaker is now compatible with Unity relay, take a look at matchmaker documentation.
https://docs.unity.com/ugs/en-us/manual/matchmaker/manual/get-started

Hi @A_zazel and @Zaimes4,

Matchmaker is indeed compatible with Relay.
You might also want to take a look at our new Multiplayer Services SDK (here is the documentation: Multiplayer Services sessions for the Unity Engine). It bundles the standalone SDKs for Lobby, Relay, Matchmaker and Game Server Hosting for easier use.

Finding a session can be as easy as this example (based on Matchmaking into a session)

var matchmakerOptions = new MatchmakerOptions { QueueName = "Friendly" };
var sessionOptions = new SessionOptions() { MaxPlayers = 2 }.WithRelayNetwork();
var matchmakerCancellationSource = new CancellationTokenSource();

var session = await MultiplayerService.Instance.MatchmakeSessionAsync(matchmakerOptions, sessionOptions, matchmakerCancellationSource.Token);

Please take into account that

  • The Multiplayer Services SDK is compatible with Unity2022.3+ and Unity6.
  • The code you currently have should still be working when you replace the Matchmaker and the Relay SDKs by this one. You can then decide if you prefer to keep linking Matchmaker and Relay yourself (for more fine grain control) or switch to the Multiplayer Services SDK Session system.
  • It is currently in preview (1.0.0-pre.1 at the time of this reply). We are currently looking for feedback both on the SDK usage (how easy it is to use, if you find use cases not covered, …) and the documentation (how clear it is, how easy it is to get started, …).
2 Likes

Hello @ArthurAtUnity ,
I’m using the Unity version 2022.3.25f1, and I’m unable to find the package com.unity.multiplayer.widgets nor the package Multiplayer Play Mode.
And I cannot upgrade the project to Unity 6 since my project is VR and I’m facing a lot of errors when trying to upgrade.

@ArthurAtUnity I’m still trying to implement Matchmaker with Relay, but I’m facing difficulties setting up Relay after the matchmaker ticket is found. How can I know who should be the host and create an allocation for all the players and communicate the join code?
I feel like I am missing something, and I didn’t find anything on the documentation regarding this part. Is there a sample scene or project showcasing the integration of matchmaking with Relay that I can take a look at?
@A_zazel Were you able to figure out this part?

I ended up upgrading to the Multiplayer services sessions package, and using it to create a matchmaking ticket with Relay, since the package handle everything regarding the host assignment and the joining the room.

I’m currently struggling with getting the matchmaking results after the match is found, calling session.GetMatchmakingResults(); throw an error, apparently there should be a matchmaker module registered in the session, however, the matchmaker module is not found, and therefore. the results of the matchmaking are inaccessible.

Did I miss something in the session creation?

public async void FindMatch(int MapId)
		{
			try
			{
				Debug.Log($"[Network] [Matchmaker Manager] Find Match! map id: {MapId}");

				var matchmakerOptions = new MatchmakerOptions
				{
					QueueName = DEFAULT_QUEUE,
					PlayerProperties = new Dictionary<string, PlayerProperty>() {
					{ "PlayerName", new PlayerProperty("Player X")},
					{ "MapId" , new PlayerProperty(MapId.ToString())}
				}
				};

				var sessionOptions = new SessionOptions() { MaxPlayers = 4 }.WithRelayNetwork();
				matchmakerCancellationSource = new CancellationTokenSource();
				matchmakerCancellationSource.CancelAfter(40000);
				session = await MultiplayerService.Instance.MatchmakeSessionAsync(matchmakerOptions, sessionOptions, matchmakerCancellationSource.Token);

				StoredMatchmakingResults matchmakingResults = session.GetMatchmakingResults();
				Debug.Log($"[Network] [Matchmaker Manager] Matchmaking results: {matchmakingResults}");
			}
			catch (Exception ex)
			{
				Debug.Log($"[Network] [Matchmaker Manager] Matchmaking failed {ex}!");
			}

		}