Hi,
I am new Nakama and pretty new to networking, and have been trying to implement your match making system in our project. I am also referencing the Jelloy Rogers sample project. I am using Unity 2018.4.
My goal: allow up to 4 users join a match
I’ve gotten 2 users to join a match, and to send matchState data in between, but can’t get 3 users to be in the same match (min user = 2, max user = 4). I think what happens is after the first 2 users match, the match tickets somehow become invalid, so the 3rd user cannot be matched.
What’s the correct way to allow any user to join a ongoing match, without having to enter the cumbersome matchID?
Also, is there a way to list available matches in the C# unity library?
The matchmaker allows you to place players into a pool and then have them match together and use the matchmaker callbacks to let the players join the match. Tickets are sent to players who’ve subscribed to the matchmaker with the criteria they want to match for other players on.
Something very specific to note about this API though is that it’s about placing players together to start a match. Not for having players join a match which is already started. This leads to the next API.
Match listings provide the same search criteria as the matchmaker but is used to search active matches that the player can join. The listings API returns the match ID which can be used to join the match. With authoritative multiplayer matches you should use the MatchJoinAttempt lifecycle function of the match handler to decide whether the player is allowed to join or not.
Also, is there a way to list available matches in the C# unity library?
Yes. Have a look at the method called ListMatchesAsync which uses the match listings API described above.
Hi @novabyte thanks for the answer. I tried the ListMatchesAsync method (after 2 users already joined a match), and it returns no matches. Is there documentation for this? I don’t see it used in the Jelloy Rogers project either.
IApiMatchList matchList = await client.ListMatchesAsync(session, 2, 10, 5, true, null, “*”);
foreach (var match in matchList.Matches)
{
Debug.Log(match.MatchId);
}
So I am still unable to get the 3rd user to join that match that the first 2 users are in.
Also I am unable to find where the MatchJoinAttempt method is. ctrl-shift-f in Visual Studios doesn’t catch methods in DLL so I am having trouble finding the class it’s under.
It’s important to understand the features of the game server. Nakama supports both authoritative and client-relayed multiplayer. The Jolly Roger game demo uses client-relayed multiplayer.
The 5th argument to the method determines whether authoritative matches should be returned or not. I assume you’ve decided to use client-relayed multiplayer for your game. In this case that argument should be false.
You should also note that with client-relayed matches they only exist on the server as long as players are within the match. They will be cleaned up automatically from the multiplayer engine and matchmaker if all players leave.
Also I am unable to find where the MatchJoinAttempt method is. ctrl-shift-f in Visual Studios doesn’t catch methods in DLL so I am having trouble finding the class it’s under.
The MatchJoinAttempt is one of the lifecycle functions in the match handler for authoritative matches. If you plan to use client-relayed multiplayer in your game (no server-side logic at all) then you won’t need it.
I just tried to check out those links because I am having similar issues where I am limiting myself to only 2 clients by not utilizing proper matchmaking flow, but those two links don’t work :P. Ill find them in the documentation. Like the OP, I want to be able to actively join and leave matches up to the max player amount even if game play is active. Gonna be a long road! Glad I found this post.