Contents

Matchmaking rules

Game Center applies different type of rules you create in a particular order to find the best matches.

Overview

With matchmaking rules, you have finer control over automatch of players to fill empty slots in peer-to-peer and hosted match requests. During development, you use the matchmaking rules APIs to upload your rules to the Game Center server. You group rules into rule sets and assign the rule sets to queues. In your game code, you configure match requests to use your set of matchmaking rules by specifying a queue. Game Center applies your rules to all the match requests in the queue to fill the empty slots.

[Image]

You group rules into sets for each configuration, feature, or purpose in your game and associate the rule sets with a queue. Game instances submit match requests to specific queues, and Game Center applies the corresponding rules to the match requests in that queue. The rules contain an expression that behaves like a query to filter and prioritize the requests. Game Center finds the most compatible players that meet your criteria, in a reasonable amount of time.

For more information on this feature, see Meet rule-based matchmaking in Game Center.

The matchmaking rules algorithm

When finding players using matchmaking rules, Game Center applies four different types of rules to match requests in the queue, along with performing other steps in the algorithm. Game Center applies the expression of the rule, which is a JMESPath formatted string with some Game Center matchmaking function additions. Depending on the type of rule, Game Center evaluates the expression on two or more match requests in the queue.

[Image]

Game Center performs the following steps in sequence:

  • Sorts the match requests in a queue by age of the request to minimize player wait time and then applies compatible rules to pairs of requests. Compatible rules compare two requests and return a Boolean value that indicates whether the requests are compatible. If all the compatible rules return true, Game Center continues processing the pair. For example, requiring the app version to be 2.0 and above is a compatible rule.

  • Applies the distance rules to pairs of compatible requests. Distance rules compare two requests and return a numeric value between 0.0 and 1.0. Game Center uses the value to prioritize similar requests, where 0.0 is the most similar and 1.0 is the least similar. For example, requiring the geo latency between players to be low is a distance rule.

  • Prioritizes compatible matches by age and distance, and generates candidate matches that have the most number of players within the range that you specify in the rule set. Sorts candidate matches by age and applies the match rules. Match rules apply to a set of matches and return a Boolean value that indicates whether the requests are valid matches. For example, requiring a range in skill level between 0 and 5 is a match rule.

  • Generates candidate teams from combinations of candidate matches and applies the team rules, If you add rules to assign players to teams. Team rules apply to a set of teams containing players and return a Boolean value that indicates whether the teams satisfy a constraint. For example, ensuring that the total skill difference between teams is less than 1 is a team rule.

For more information on matchmaking rules with examples, see Finding players using matchmaking rules. For details on the matchmaking REST APIs, see Matchmaking rules in App Store Connect API.

Topics

Essentials

Rules

Testing

See Also

Related Documentation

Real-time games