Prerequisites
Matchmaking always runs on top of the lobby and player-identity systems, so before starting a search you need:- A lobby. Every match request comes from a lobby (even a solo one). See the Lobby Quick Start to create and manage lobbies.
- A player identity. Lobby and matchmaking calls require an authenticated player. With a client key and an auth provider configured, pass a valid player token; otherwise a trusted player id is used. See Player Authentication.
- A matchmaking mode. Configure at least one mode in your lobby configuration (below) whose name you pass to
FindMatch.
Matchmaking Types
Traditional/Symmetric Matchmaking
Used for games where all players have equal capabilities and teams are symmetrical. Examples include:- Battle Royale (Fortnite, PUBG): 100 players, last one standing
- Team Deathmatch (Counter-Strike, Valorant): 5v5 competitive matches
- Arena Duels: 1v1 or 2v2 ranked matches
- Large-scale Battles: 32v32 or 64v64 team warfare
Role-Based/Asymmetric Matchmaking
Used for games where players have distinct roles with unique abilities and responsibilities. Examples include:- MOBA Games (League of Legends, Dota 2): Support, Tank, DPS roles with team composition requirements
- Hero Shooters (Overwatch, Paladins): Role queue with tanks, healers, and damage dealers
- Asymmetric Horror (Dead by Daylight): 4 survivors vs 1 killer
- Social Deduction (Among Us, Werewolf): Different roles with hidden information
How Matchmaking Works
In PlayFlow, matchmaking always works through lobbies:- A player creates a lobby (for just themself, or for a party of friends)
- Players set their matchmaking data (skill, region, roles)
- The lobby host starts the search
- The system finds compatible lobbies based on your configuration
- When a match is found, a game server automatically starts for all players
Dashboard Configuration
Before writing code, you must configure your matchmaking rules in the PlayFlow Dashboard.- Go to your project’s Configuration → Lobbies tab
- Create or edit a lobby configuration
- Click the Matchmaking tab
- Add and configure matchmaking modes
Traditional Configuration Examples
- 5v5 Competitive
- Battle Royale
- Team Deathmatch
- 1v1 Ranked
For tactical shooters like Counter-Strike or Valorant:
Role-Based Configuration Examples
- MOBA (LoL/Dota)
- Hero Shooter (Overwatch)
- Asymmetric Horror
- MMO Dungeon
For games like League of Legends with strict role requirements:
Backfill Configuration
Backfill routes newly-queued players into an already-running match that still has open slots, instead of always spinning up a fresh server. Configure it with thebackfill object on a mode:
allowBackfill: true is still accepted as a deprecated alias for backfill: { "enabled": true }, but prefer the object form so you can tune the window and skill gate.Implementation Guide
Here are the steps to implement matchmaking in your game.Step 1: Set Player Matchmaking Data
Players must set their matchmaking attributes before searching. This includes MMR, regions, and roles (for role-based modes).- Unity
- Unreal Engine
- Godot
Step 2: Start the Search
Once the player’s data is set, the lobby host can start the search by callingFindMatch. The mode parameter must match the name of the matchmaking mode you created in the dashboard.
- Unity
- Unreal Engine
- Godot
Step 3: Handle Matchmaking Events
After starting the search, subscribe to events to drive your UI.- Unity
- Unreal Engine
- Godot
Step 3.5: CS2-Style “Accept Match” flow (optional)
If the matchmaking mode hasmatchConfirmation.enabled: true in the dashboard, matches pause at the match_found status waiting for every lobby to explicitly accept. Opt in by subscribing to three extra events and exposing accept/decline buttons.
waiting (not back to in_queue) — players re-queue manually when ready. This matches how CS2 and League of Legends handle match acceptance.
Step 4: Cancel the Search
The host can cancel the matchmaking search at any time by callingCancelMatchmaking.
- Unity
- Unreal Engine
- Godot
Advanced Features
Role Assignment Algorithm
The role-based matchmaking system uses an intelligent priority-based algorithm to assign players to roles. Roles can be provided as either a single string or a string array for flexibility.Key Principle: Players with fewer role options get priority assignment to ensure everyone gets a suitable role. This is NOT random - it’s deterministic and fair.
How Priority Assignment Works
1. Specificity First Players with fewer role options are assigned before flexible players:Real-World Example
For a MOBA team needing specific roles:Setting Role Preferences in Code
Spectator Support
Spectators are excluded from team requirements but still receive game server access for observation.Regional Matchmaking
Players can specify multiple acceptable regions. The system finds matches where players have overlapping regions.Party Support
The lobby-based approach naturally supports parties. Friends can join the same lobby and queue together:Troubleshooting
Common Issues
Players not matching despite being in queue
Players not matching despite being in queue
- Verify all players have set required matchmaking data (MMR, regions, roles)
- Check that players have overlapping regions in their
regionsfield - For role-based modes, ensure you have the exact roles needed for team composition
- Check dashboard configuration timeout settings
Spectators being counted in matchmaking
Spectators being counted in matchmaking
Ensure spectator roles are listed in the
excludedFromQueue array in your dashboard configuration:Role assignment not working correctly
Role assignment not working correctly
- Players with single specific roles are prioritized over flexible players
- Ensure role names match exactly with dashboard configuration
- Check that total players match team requirements
Next Steps
Lobby Quick Start
Review the basics of creating and managing lobbies.
Lobby Events Reference
See all events for building responsive matchmaking UI.
Game Servers
Learn about server lifecycle and configuration.