Can Coherence Lobbies Support Team-Based Matchmaking (e.g., pre-made 2–3 player teams into 3v3 matches)?

Hello,

We have reviewed the Coherence Lobbies documentation ( Lobbies | coherence Documentation ) and understand that the FindOrCreateLobby method can be used with custom filter expressions to match players into different game modes.

Our matchmaking requirements are more complex. Specifically:

Players can form pre-made teams (for example, teams of 2 or 3 players).
We want to match these pre-made teams into a 3v3 match (red team vs. blue team). A team should be able to queue as a single unit; the matchmaking system must treat that team as one participant and pair multiple teams (or solo players) together until both sides reach three players.
Example: a 2-player team can form and then request to join 3v3 matchmaking. The system should be able to combine that 2-player team with other teams or solo players to form two full teams of three players each.

We look forward to your reply.

Hey, our matchmaking system isn’t quite designed to fit this model. It might be possible using our system but I think you’re better off using a custom matchmaking solution.

If you really want to explore our lobbies, you might (big might) be able to work something out with multiple lobbies ( a player can join up to 3 total), but there are significant race condition risks.

Here’s how it would work:

  1. Team lobby (lobby A): Team members create/join a lobby as a “party room”
  2. Leader searches: Leader calls FindOrCreateLobby to find/create a “match lobby” (lobby B)
  3. Leader notifies team: Via SendMessage on lobby A, sends the match lobby’s ID to teammates
  4. Teammates join: Each teammate calls RefreshLobbyAsync(lobbyId) to get the LobbyData for lobby B, then calls JoinLobbyAsync(lobbyData)
  5. Both lobbies count against the 3-lobby limit, so each player uses 2 of their 3 slots — that’s fine

The problem is there’s no slot reservation. Between the leader joining lobby B and the teammates arriving:

  • Other solo players or teams could fill the remaining slots
  • JoinLobby checks len(players)+1 > maxPlayers per individual join — there’s no way to hold 2 slots for incoming teammates
  • If lobby B has maxPlayers=6 and is at 4/6 when the leader joins (5/6), only one more teammate can get in before it’s full — the second would get ErrLobbyFul

Thank you for your response. I understand now.

We will use other services along with Coherence to complete this task.

Currently, my design is as follows:

1.Use Unity Lobby to create a room (pre-made).

2.The host uses Unity Matchmaker to make a match request.
(If the match is successful) Unity Matchmaker returns the “match ID” and team information (Red team and Blue team - player IDs).

3.The first player on the Blue team will use the “match ID” to call await roomsService.CreateRoomAsync and bridge.JoinRoom.

4.Other players will look for the tag = “match ID” to get the room data and call bridge.JoinRoom using this information.
5.They will then load into the game scene directly.

This design is currently running smoothly. However, I have a question.

I want to detect when the room is full before loading into the game scene.

bridge.ClientConnections.ClientConnectionCount

During testing, in a 2v2 setup, it’s possible that one of the users has bridge.ClientConnections.ClientConnectionCount = 1, while the other users show it as 4.
As a result, others successfully loaded the scene, but he did not load the scene.

I’m wondering if the ClientConnectionCount value could change while other users are loading the scene?

(I have added this code when loading the scene(OnSceneLoaded))

// Moves the client connection to another scene on the server
bridge.SceneManager.SetClientScene(scene.buildIndex);

// Instantiate remote entities into the new scene instead
bridge.InstantiationScene = scene;

Thanks again for your reply.

1 Like