Nakama Parties: create match with only party members?


  1. Versions: Nakama {3.11.0}, {Docker}, {Unity SDK 3.4.1}
  2. Server Framework Runtime language (If relevant) {TS/JS}

Hi there,

I am attempting to understand how the Nakama Parties work in regards to joining a match.

When I have a Party with the desired number of players in it - let’s say 2 - and have the party leader call Socket.AddMatchmakerPartyAsync("<Party Id>", "", 2, 2), I do not get a ReceivedMatchmakerMatched response from the server.

I do see the Party ticket messages in the server, though:

{"level":"debug","ts":"2022-05-17T04:40:38.665Z","caller":"server/pipeline.go:65","msg":"Received *rtapi.Envelope_PartyMatchmakerAdd message","uid":"abe0bf47-390a-43d2-aa56-df077ecce914","sid":"74ef51c2-d59b-11ec-ab04-006100a0eb06","cid":"2","message":{"PartyMatchmakerAdd":{"party_id":"3bf5fe9b-d9d9-4f1b-9c0c-a3aa3561e442.nakama","min_count":2,"max_count":2}}}

{"level":"debug","ts":"2022-05-17T04:40:38.666Z","caller":"server/session_ws.go:395","msg":"Sending *rtapi.Envelope_PartyMatchmakerTicket message","uid":"abe0bf47-390a-43d2-aa56-df077ecce914","sid":"74ef51c2-d59b-11ec-ab04-006100a0eb06","envelope":"cid:\"2\"  party_matchmaker_ticket:{party_id:\"3bf5fe9b-d9d9-4f1b-9c0c-a3aa3561e442.nakama\"  ticket:\"f0251754-0f1d-4024-9ef7-1d9c9261ca1f\"}"}

How can I create a match with only the party members?

Thank you :smiling_face:

Hi @lightning,

Since you’re not actually looking to matchmake with other players (you already know exactly who should be in the match based on who is in the party), I would recommend that rather than use the matchmaker you instead create the match manually as the party leader and then have the party leader send the match ID to all other party members via party data.

From the party leader:

var matchId = “<MatchID>“; // Get a match Id either via socket.CreateMatchAsync or using an RPC to create a match on the server and return the match ID
const long JOIN_MATCH_OPCODE= 10;
var content = new
    matchId = matchId
await socket.SendPartyDataAsync(party.Id, JOIN_MATCH_OPCODE, JsonWriter.ToJson(content));

On the party member:

socket.ReceivedPartyData += async partyData =>
    if (partyData.OpCode == JOIN_MATCH_OPCODE)
        var payload = JsonParser.FromJson<Dictionary<string, string>>(Encoding.UTF8.GetString(partyData.Data));
        if (payload != null && payload.ContainsKey(“matchId”))
            var match = await socket.JoinMatchAsync(payload[“matchId”]);

I hope this helps. If you have any further questions please let me know.

Kind regards,