Matchmaking Overview #
The Pragma Matchmaking service is responsible for matching players together into games quickly and at scale. The service is designed to support many gameplay scenarios, from match-based PVP to battle royale to cooperative multiplayer games. For competitive games, skill-based matchmaking logic can be authored to evaluate criteria such as skill level (mmr), game modes, latency / connection quality, and more.
Key elements of matchmaking #
Pragma Engine supports matching parties together to form new game instances, or matching parties with existing game instances. To support these tasks, the matchmaking process is made up of the following elements:
Matchables #
Parties enter the Matchmaking service on a new Matchable object. You can think of a Matchable object as a container for parties in matchmaking. Parties in Matchable objects are not yet part of an active game instance, and can be moved between Matchable objects until the Matchable represents a group of parties that should be sent to a new game instance together.
Matchmaking Game Instances #
Matchmaking Game Instances work like Matchables, but instead represent an active game instance that enters matchmaking to find additional players. Matchmaking Game Instances are compared to other Matchables in the queue to take additional parties out of matchmaking and into the game instance.
Queues #
Queues allow you to separate Matchables into different matchmaking loops to ensure only parties within the same queue can be matched together. Parties in different queues will never be compared, and thus will never enter a game instance together.
You can name your queues and even group queues together for the purpose of viewing metrics and logs. For example, you might want matchmaking queues with the same game mode to appear as one metric.
Matchmaking process #
The Pragma matchmaking service works in loops to compare Matchables (which contain parties) within the same queue and send viable matches to the same game instance. When making comparisons, you have access to each queue member’s data, all stored in-memory, allowing the matchmaker to make thousands of comparisons per second.
At a basic level, the Matchmaking process works as follows:
- Parties enter the Matchmaking service on a new Matchable object.
- Matchmaking is initialized and the Matchable object is placed into a queue.
- Matchables are compared to each other using custom logic defined in the Matchmaking Plugin
matchParties()
method, taking or giving parties as needed. - Once an appropriate match is found (two Matchables contain parties that are suitable to be in a game instance together), the Matchmaking service can send the parties in the Matchable to the game instance. New game instances that have been created can remain in matchmaking or reenter it at any time to accept more players.