Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Example: Compare attributes across all players

Focus mode
Example: Compare attributes across all players - Amazon GameLift Servers

This example illustrates how to compare player attributes across a group of players.

The example rule set describes a match with the following characteristics:

  • Team structure: Two single-player teams

  • Player attributes:

    • gameMode: Type of game chosen by the player (if not provided, default to "turn-based").

    • gameMap: Game world chosen by the player (if not provided, default to 1).

    • character: Character chosen by the player (no default value means that players must specify a character).

  • Match rules: Matched players must meet the following requirements:

    • Players must choose the same game mode.

    • Players must choose the same game map.

    • Players much choose different characters.

Notes on using this rule set:

  • To implement the match rule, this example uses comparison rules to check all players' attribute values. For game mode and map, the rule verifies that the values are the same. For character, the rule verifies that the values are different.

  • This example uses one player definition with a quantity property to create both player teams. The team are assigned the following names: "player_1" and "player_2".

{ "name": "", "ruleLanguageVersion": "1.0", "playerAttributes": [{ "name": "gameMode", "type": "string", "default": "turn-based" }, { "name": "gameMap", "type": "number", "default": 1 }, { "name": "character", "type": "number" }], "teams": [{ "name": "player", "minPlayers": 1, "maxPlayers": 1, "quantity": 2 }], "rules": [{ "name": "SameGameMode", "description": "Only match players when they choose the same game type", "type": "comparison", "operation": "=", "measurements": ["flatten(teams[*].players.attributes[gameMode])"] }, { "name": "SameGameMap", "description": "Only match players when they're in the same map", "type": "comparison", "operation": "=", "measurements": ["flatten(teams[*].players.attributes[gameMap])"] }, { "name": "DifferentCharacter", "description": "Only match players when they're using different characters", "type": "comparison", "operation": "!=", "measurements": ["flatten(teams[*].players.attributes[character])"] }] }
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.