Matchmaking
This SDK is an optional starter kit for Unity users, which can be extended and customized later.
💡 Features
Complete Examples
Ping Automation (coming soon)
Tickets, Groups, Teams
Match Variables
Type Definitions (C#)
Local Dev Testing
Cross-Platform
Easy to Customize
Automated Retry
✔️ Preparation
Unity SDK contains optional integration utilities for Deployments, Matchmaking, and Server Browser. This plugin officially supports Unity versions 2021.3.0f1 and later.
Requirements
Installation
Open your Unity Project,
Select
Window > Package Management > Package Manager,Click the ➕ icon and select
Add package from git URL...,Input the URL of our SDK when prompted:
Click
Addand wait until installation is completed.
Import Samples
This package includes multiple samples, intended to be used individually (do not combine samples).
Verified Sources
This is the only official distribution channel for this SDK, do not trust unverified sources!
Update Package
Navigate to Edgegap SDK in Unity Package Manager and click Update .
Updating to v3
This update includes many new Server Browser utilities and examples, improves matchmaking error handling, and more. See Release Notes for a complete list.
🍀 Getting Started
This guide assumes basic knowledge of Matchmaking concepts and a running Matchmaker.
Overview
Our SDK utilizes heavily Dependency Injection and Observer programming patterns.
This package includes:
Runtime Files - will be compiled and bundled with your client and server builds:
Service-Specific Utilities:
Matchmaking - a complete client integration to reuse/extend.
API functions - endpoint definitions, error handling, and logging automations.
Service-Specific DTOs - typed data containers for Matchmaking API.
Shared Utilities - logging, HTTP, ping, observables, etc...
Shared DTOs - used by multiple Edgegap services to pass data around.
Sample Files - bundled and compiled ONLY if imported in your project:
Simple Example - example handlers for a minimal configuration.
Region Picker - explore UI integration with manual region selection.
Group Client
Ping automation, ticket management, and host retrieval are performed by Group Client.
Once instantiated, agent's parent Monobehaviour (handler) must initialize the client and provide:
onMonitorUpdatecallback - observe service health changes.onAssignmentUpdatecallback - observe and react to host assignment changes.
Once initialized, this client will automatically provide validations and hook up logging observers, finishing with a single call to the monitoring API endpoint to indicate service health.
Client's handler is expected to take control and call client functions from this point:
Beaconsto retrieve a list of available Ping Beacons.MeasureBeaconsRoundTripTimeto provide ping measurements against a given set of beacons.CreateGroupfor the lobby leader to create a joinable group, which friends can be invited to.JoinGroupto join an existing group using the group ID sent through 3rd party lobby/backend.SetReadyto mark group owner and members as ready and begin searching for matches.ResumeMatchmakingload a cached group and continue searching in case client crashed.StopMatchmakingto delete the ticket (if not matched) and abandon queue.Statusto verify Matchmaker service health.
When a new player connection is established, player is expected to send their ticket ID to the game server using your netcode, to correlate connections with 📌 Injected Variables.
Server Agent
Server Agent performs backfill creation, detecting ticket assignment, detecting backfill abandonment and removal. It also tracks and re-creates backfills which expired, had the connection grace period elapsed, or were abandoned - to reach the desired team size.
Server Agent keeps track of currently connected players and automatically includes their tickets in new backfills to ensure that backfilled players will match using the configured profile's rules.
Once instantiated, agent's parent Monobehaviour (handler) must initialize the client and provide:
onMonitorUpdatecallback - observe service health changes.onBackfillUpdatecallback - observe and react to backfill changes.
Once initialized, this client will automatically provide validations and hook up logging observers, finishing with a single call to the monitoring API endpoint to indicate service health.
Server handler is expected to take control and call client functions from this point:
PlayerConnectedto prevent replacing initial or backfilled players who never connected.AbandonPlayerto signal that a connected player left the server and needs to be replaced.AbandonAllBackfillsto immediately stop backfilling server and delete backfills.This method should be called before stopping your server. Players who are already assigned at this time need to rejoin matchmaking since the server is shutting down.
Assigned backfills at the time of this call can still connect within configured grace period.
AbandonBackfillto forcefully abandon a specific backfill (custom handler implementations).Statusto verify matchmaker service health.
🧪 Samples
Get started with samples including a complete functioning integration for both server and client.
Simple Example
Includes a full player lifecycle implementation with ping measurement, ticket management, and host assignment retrieval. Demonstrates how to read injected match variables on server side.
Modify matchmaking attributes to expand this example to fit any configuration easily.
Region Picker
Some players (or groups) have special localized conditions (such as ISP blockage, country-wide blockage, or other) and may prefer choosing a region manually rather than based on ping alone.
Inspect our Region Picker sample and draw inspiration for your matchmaking UI implementation.
Group Up
Join matchmaking queue with a group of friends, requiring all players to confirm before starting search. Get started with a minimal UI implementation, then customize for your game design.
Explore UI integration with the group up flow and deliver the best possible social experience.
Backfill
Reuse server capacity and add players to ongoing deployments. Set target team size and wait for players to be added. Includes automated connection grace period and recreating expired backfills.
Customize example server handler for multi-team or asymmetric team compositions.
⚙️ Customization
This SDK is meant to be extended and modified, though some modifications may be risky:
✅ Handler - safely hook up UI observers and perform minor additions or modifications,
⚠️ Agent - modify player lifecycle management at your own risk,
⚠️ API - write your own integration from scratch, using cherry-picked utilities.
Handlers may observe any events emitted by Server and Client agents as described below.
Client Events
Group Client emits events (actions) for parent handler to observe and consume.
Preview events emitted by observable Monitor :
🟢 Update
healthy
All systems OK.
🟢 Update
unhealthy
Unexpected issue.
🔴 Error
get monitor failed
Misconfiguration or unexpected issue.
🔴 Error
get beacons failed
Unexpected issue.
Preview events emitted by observable Group:
🟢 Update
created
Group created OK.
🔴 Error
group create failed
Failed to create group.
🟢 Update
joined
Group joined OK.
🔴 Error
group join failed
Failed to join group.
🟢 Update
resumed
Group resumed OK.
🔴 Error
group not found
Not a member of group, or group expired.
🔴 Error
conflict, abandon and restart
Please abandon current group before trying to create/join a new group.
🟢 Update
member updated [{ready}]
Member updated with new Ready value.
🟡 Warn
member update failed
Failed to update group member. Can't unready after the group started searching for match.
🔴 Error
group updated failed
Failed to update with new Ready value.
🔵 Notify
polling [{consecutive}/{maximum}]
Client initiated polling group status.
🔵 Notify
polling stopped
Client stopped polling ticket status.
🔴 Error
polling failed, reached maximum retries
Client exhausted maximum consecutive polling retries. Check service status.
🔴 Error
polling failed
Client received a non-retryable error when polling. Check service status.
🟢 Update
group updated [{status}]
Detected group status change while polling.
🟢 Update
abandoned
Deleted ticket OK.
🟢 Update
abandon failed (not found)
Client couldn't find the ticket to delete, possibly expired.
🟡 Warn
abandon failed (match found)
Client couldn't delete a matched group. Disable abandonment or Backfill Match to replace the player.
🔴 Error
abandon failed
Failed to delete group or membership.
🟢 Update
removed
Group expired, local reference deleted.
Server Events
Server Agent emits events (actions) for parent handler to observe and consume. Server Agent emitting these events is only initialized in the Backfill sample.
Preview events emitted by observable Monitor :
🟢 Update
healthy
All systems OK.
🟢 Update
unhealthy
Unexpected issue.
🔴 Error
get monitor failed
Misconfiguration or unexpected issue.
Preview events emitted by observable Backfill:
🟢 Update
created [{backfill}]
Backfill created OK.
🔴 Error
create failed
Unexpected issue with backfill. Check service status.
🔴 Error
maximum capacity currently reached
Can't add Backfill beyond target team size.
🔵 Notify
polling [{consecutive}/{maximum}]
Polling failed, retrying automatically.
🟢 Update
assigned [{backfill}]
Assigned ticket to backfill OK.
🔵 Notify
polling stopped
Polling stopped by handler's request.
🔵 Notify
polling failed (not found) [{backfill}]
Not found, removing reference. Backfill most likely expired.
🔴 Error
polling failed (reached maximum retries) [{backfill}]
Exhausted retries, abandoning backfill.
🔴 Error
polling failed [{backfill}]
Unexpected issue, removing reference.
🔵 Notify
abandoned [{backfill}]
Backfill abandoned, removing reference.
🔵 Notify
abandon failed (not found) [{backfill}]
Server couldn't find backfill to delete, possibly expired.
🟡 Warn
abandon failed [{backfill}]
Abandonment failed, removing reference.
🟢 Update
removed [{backfill}]
Backfill reference removed. Backfill will be replaced automatically if not stopped.
🟡 Warn
remove failed (not found) [{backfill}]
Backfill reference not found, likely duplicate call.
Last updated
Was this helpful?

