Amazon GameLift
Developer Guide (Version )

Build a FlexMatch Rule Set

Every FlexMatch matchmaker must have a rule set. The rule set determines the two key elements of a match: (1) team structure and size, and (2) how to group players for the best possible match and gameplay experience.

For example, a rule set might describe a match like this: Create a match with two teams of five players each, one team is the defenders and the other team the invaders. All players in both teams must be equally (or nearly) skilled. All players must be able to play with a latency of 20 milliseconds or less. If no match is found after 30 seconds, gradually relax the skill and latency requirements.

To create a matchmaking rule set, you can use either the Amazon GameLift console or the AWS CLI. You can create multiple rule sets and use them in different matchmakers, or use the same rule set in more than one matchmaker.


Rule Set Components

Each rule set contains the following components:

  • Name (optional) – This is a descriptive label within the rule set syntax and is not used by Amazon GameLift in any meaningful way. Do not confuse this value with the rule set name, which is set, along with the rule set syntax, when you create a rule set.

  • Rule language version (required) – This is the version of the property expression language used to create FlexMatch rules. The value must be equal to “1.0”.

  • Player attributes (optional) – Rules may choose players for matches based on individual player characteristics. If you create rules that rely on player attributes, they must be declared in this section. Values for these player attribute must be included in every matchmaking request that is sent a matchmaker using this rule set. When declaring a player attribute, include the following information:

    • Name (required) – This value must be unique to the rule set.

    • Type (required) – This is the data type of the attribute value. Valid data types are number, string, or string map.

    • Default (optional) – Enter a default value to use if none is provided for a player. If no default is declared and a player does not provide a value, the player cannot be matched.

  • Teams (required) – This section defines the structure and size of teams for the match.

    • You can define as many teams as you want.

    • Each team must have a unique name

      Rule language version (required): Value must be equal to 1.0.

    • Each team must have a minimum and maximum size. Use the same value for each if you want to require a specific size. Alternatively set a range if you want to be flexible. FlexMatch will always try to fill teams to the maximum player size. If you use a range but want all teams in the match to have equally sized teams, you can create a rule for that. See the FlexMatch Rule Set Examples topic for an example of an "EqualTeamSizes" rule.

    • Teams can be asymmetrical. You can create teams of different sizes for whatever purpose suits your game.

  • Rules (optional) – This section contains one or more rule statements that define how to evaluate players for an acceptable match. Rules might describe requirements for each individual player or they may describe requirements for an entire team or match. Each rule contains the following elements:

    • Name (required) – This is a meaningful name that uniquely identifies the rule within a rule set. Rule names are also referenced in event logs and metrics that track activity related to this rule.

    • Description (optional) – Use this element to attach a free-form text description. This information is not used by the matchmaker.

    • Type (required) – The type element identifies the operation to use when processing the rule. Each rule type requires a set of additional elements; for example, several rule types require a reference value to compare or measure a player's attributes against. See a list of valid rule types and requirements in FlexMatch Rules Reference.

    • Measurements (required) – This is the player-related value that is evaluated to determine whether the player is an acceptable match. The measurement should align with the rule type. A measurement may be a player attribute for an individual player, or a collection of attributes for a team or entire match. Measurements are expressed using the property expression language. See more on property expressions in FlexMatch Rules Reference.

  • Expansions (optional) – Expansions allow you to relax the rules criteria over time. This feature is used to help ensure matches are made within a reasonable time period. By relaxing the rules, you can gradually expand the pool of players that can be matched.

On this page: