Party matchmaking

Matchmaker supports party matchmaking where a group of players can request to be matched together in a game.

A matchmaking ticket can contain multiple players. Game developers can add as many players on a ticket as supported by their matchmaking configuration.

The following code sample shows how to create party matchmaking:

{
  "queueName": "4vs4",
  "attributes": {},
  "players": [
    {
      "id": "6cc5ac8d-dfab-4b50-9ede-c1d026d8dc81",
      "customData": {
        "Hero": "tank"
      },
      "qosResults": [
        {
          "regionId": "75721794-e9fd-4d8a-9879-aa853ed18885",
          "packetLoss": 0.8,
          "latency": 50
        },
        {
          "regionId": "1e29bd54-8acc-433a-ae7d-28ae5fc192a1",
          "packetLoss": 0.5,
          "latency": 20
        }
      ]
    },
    {
      "id": "ac35c771-291c-4e7e-9a0e-6351faf261c6",
      "customData": {
        "Hero": "support"
      },
      "qosResults": [
        {
          "regionId": "75721794-e9fd-4d8a-9879-aa853ed18885",
          "packetLoss": 0.2
          "latency": 75
        },
        {
          "regionId": "1e29bd54-8acc-433a-ae7d-28ae5fc192a1",
          "packetLoss": 0.5,
          "latency": 10
        }
      ]
    },
  ]
}

Ticket containing two players with each their custom data

Unity SDK

var player1 = new Player(
    "6cc5ac8d-dfab-4b50-9ede-c1d026d8dc81", 
    new Dictionary<string, object> { {"hero", "tank"} },
    new List<QoSResult>
    {
        new QoSResult("75721794-e9fd-4d8a-9879-aa853ed18885",0.8, 50),
        new QoSResult("1e29bd54-8acc-433a-ae7d-28ae5fc192a1",0.5, 20)
    });

var player2 = new Player(
    "ac35c771-291c-4e7e-9a0e-6351faf261c6", 
    new Dictionary<string, object> { {"hero", "support"} },
    new List<QoSResult>
    {
        new QoSResult("75721794-e9fd-4d8a-9879-aa853ed18885",0.2, 75),
        new QoSResult("1e29bd54-8acc-433a-ae7d-28ae5fc192a1",0.5, 10)
    });
var players = new List<Player>
{
    player1,
    player2
};


// Set options for matchmaking
var options = new CreateTicketOptions(
  "Default" // The name of the queue defined in the previous step, 
  new Dictionary<string, object>());

// Create ticket
var ticketResponse = await MatchmakerService.Instance.CreateTicketAsync(players, options);

// Print the created ticket id
Debug.Log(ticketResponse.Id);

Party ticket creation with Unity SDK

Players on the same ticket will not be split into different teams if more than one team is defined in the matchmaking configuration.

Using Unity Lobby

Sharing player data like Quality of Service results with the party leader can be difficult. To simplify sharing data, it is possible to use the Unity Lobby service.

Players store the data that is be added on the ticket by the party leader. The party leader is responsible for creating the matchmaking ticket on behalf of the party.

Once the ticket is matched, the party leader can save the information about the server allocation in the Lobby data, and players can use them to connect the match.