FlexMatch rule types - Amazon GameLift

FlexMatch rule types

FlexMatch supports the following rule types.

Absolute sort rule

absoluteSort

Absolute sort directs the matchmaker to sort a batch of matchmaking tickets based on a specified player attribute. An absolute sort sorts matchmaking tickets based on whether its player attribute matches that of the oldest ticket in the batch.

Absolute sort rule properties

  • sortDirection – Direction to sort matchmaking tickets. Valid options are ascending or descending.

  • sortAttribute – Player attribute to sort players by.

  • mapKey – How to evaluate the player attribute if it's a map. Valid options include:

    • minValue: For the oldest ticket, find the key with the lowest value.

    • maxValue: For the oldest ticket, find the key with the highest value.

  • partyAggregation – Method for handling tickets with multiple players (parties). Valid options are to use the minimum (min), maximum (max), or average (avg) values for a ticket's players. Default is avg.

Collection rule

collection

Collection rules evaluate collections of player attribute values. A collection might contain attribute values for multiple players, a player attribute that is a collection (a string list), or both. For example, a collection rule might look at the characters chosen by the players in a team, and require the team to have at least one of a certain character.

Collection rule properties

  • measurements – Collection of player attribute values to evaluate. Attribute values must be string lists.

  • referenceValue – Value (or collection of values) to evaluate the measurements against for a prospective match.

  • operation – How to evaluate a measurement collection. Valid operations include:

  • minCount/maxCount – Maximum or minimum count value for a successful match.

  • partyAggregation – Method for handling tickets with multiple players (parties). Valid options are to use the union or intersection of values for a ticket's players. Default is union.

Comparison rule

comparison

Comparison rules measure a player attribute value against another value. There are two types of comparison rules:

  • Compare against reference value. This type compares an attribute value to a provided reference value. For example, the rule might require that matched players have a certain skill level or greater. For this type, specify a player attribute, reference value, and a comparison operation.

  • Compare across players. This type compares the values of an attribute across all players in a team or a match to verify that either all players or no players have the same attribute value. For example, the rule might require that all players in the match choose the same game map or that no players on a team choose the same character. For this type, specify a player attribute and either the equal ("=") or not-equal ("!=") comparison operation. Do not specify a reference value.

Comparison rule properties

  • measurements – Player attribute value to compare.

  • referenceValue – Value to evaluate the measurement against for a prospective match.

  • operation – How to evaluate the measurement. Valid operations include: <, <=, =, !=, >, >=.

  • partyAggregation – Method for handling tickets with multiple players (parties). Valid options are to use the minimum (min), maximum (max), or average (avg) values for a ticket's players. Default is avg.

Compound rule

compound

With compound rules, you can use logical statements to create rules to form matches of 40 or fewer players. You can use multiple compound rules in a single rule set. When using multiple compound rules, all compound rules must be true to form a match.

Without a compound rule in your rule set, to form a match, all the rules in the rule set must be true. Using compound rules, you can choose which rules to apply based on specific criteria.

You can't expand a compound rule using expansion rules, but underlying or supporting rules can be expanded.

Compound rule properties

  • statement – The logic used to combine individual rules to form the compound rule. The rules that you specify in this property must be previously defined in your rule set. You cannot reference batchDistance rules in a compound rule.

    This property supports the following logical operators:

    • and – Evaluates to true if all the arguments that are specified in the and expression are true.

    • or – Evaluates to true if any of the arguments that are specified in the or expression is true. You must provide exactly two arguments in an or expression.

    • not – Reverses the outcome of the argument in the not expression.

    • xor – Evaluates to true if only one of the arguments in the xor expression is true.

    Note

    Each and, or, and xor operation requires two parameters. You cannot specify more than two parameters for these operations. The not operation supports only one parameter.

Example

The following example shows a compound rule to match players with varying skill levels depending on the game mode that each player selects.

{ "name": "CompoundRuleExample", "type": "compound", "statement": "or(and(SeriousPlayers, VeryCloseSkill), and(not(SeriousPlayers), SomewhatCloseSkill))" }

Distance rule

distance

Distance rules measure the difference between two number values, such as the distance between player skill levels. For example, a distance rule might require that all players be within two skill levels of each other.

Distance rule properties

  • measurements – Player attribute value to measure distance for. Must be an attribute with a numerical value.

  • referenceValue – Number value to measure distance against for a prospective match.

  • minDistance/maxDistance – Maximum or minimum distance value for a successful match.

  • partyAggregation – Method for handling tickets with multiple players (parties). Valid options are to use the minimum (min), maximum (max), or average (avg) values for a ticket's players. Default is avg.

Batch distance rule

batchDistance

Batch distance rules measure the difference between two attribute values and use the difference to batch player requests. If the attribute uses number values, maxDistance must define a maximum difference value. For example, the rule might require that all players in a match be within two skill levels of each other. If the attribute uses string values, maxDistance is not used; instead, batches are formed with players where the values are the same. For example, the rule might require that all players in a match request the same game mode. You can use the batch distance rule type with both large and small matches.

Batch distance rule properties

  • batchAttribute – Player attribute value used to form batches.

  • maxDistance – The maximum distance value for a successful match.

  • partyAggregation – Method for handling tickets with multiple players (parties). Valid options are to use the minimum (min), maximum (max), or average (avg) values for a ticket's players. Default is avg.

Distance sort rule

distanceSort

Distance sort is an explicit sort option that directs the matchmaker to sort a batch of matchmaking tickets based on a player attribute. A distance sort rule evaluates tickets based on the distance from the oldest ticket.

Distance sort rule properties

  • sortDirection – Direction to sort matchmaking tickets. Valid options are ascending or descending.

  • sortAttribute – Player attribute to sort players by.

  • mapKey – How to evaluate the player attribute if it's a map. Valid options include:

    • minValue: For the oldest ticket, find the key with the lowest value.

    • maxValue: For the oldest ticket, find the key with the highest value.

  • partyAggregation – Method for handling tickets with multiple players (parties). Valid options are to use the minimum (min), maximum (max), or average (avg) values for a ticket's players. Default is avg.

Latency rule

latency

Latency rules evaluate player latency as reported by geographic region. For example, a rule might require that matched players must have a latency in the same region that is under a maximum limit. You can use this rule type with large matches by specifying the maxLatency property.

Latency rule properties

  • maxLatency – Highest acceptable latency value for a region. For each ticket, ignore all regions that exceed this latency.

  • maxDistance – Maximum difference between the latency of each ticket and the distance reference value.

  • distanceReference – Use with maxDistance. Number value to measure distance against for a successful match. For latency, this value is an aggregate of latency values for multiple players. Valid options are minimum (min) or average (avg) player latency value. (For more information, see FlexMatch property expressions.)

  • partyAggregation – Method for handling tickets with multiple players (parties). Valid options are to use the minimum (min), maximum (max), or average (avg) values for a ticket's players. Default is avg.