Rules Sample

Here are some examples of rules that can be used to create different types of matches.

1v1

{
  "Name": "1v1",
  "BackfillEnabled": false,
  "MatchDefinition": {
    "Teams": [
      {
        "Name": "Teams",
        "TeamCount": {
          "Min": 2,
          "Max": 2
        },
        "PlayerCount": {
          "Min": 1,
          "Max": 1
        }
      }
    ]
  }
}

The following code is an example of ticket and player data.

{
    "queueName": "Default",
    "attributes": {},
    "players": [{
        "id": "swsqozxo6qxm9fmm38khh3tddv35",
        "customData": {}
    }]
}

QoS is equivalent for all the players in the match

{
  "Name": "1v1",
  "MatchDefinition": {
    "Teams": [
      {
        "Name": "Teams",
        "TeamCount": {
          "Min": 2,
          "Max": 2
        },
        "PlayerCount": {
          "Min": 1,
          "Max": 1
        }
      }
    ],
    "MatchRules": [
      {
        "Name": "QoS",
        "Type": "Difference",
        "Source": "Players.QosResults.Latency",
        "Reference": 20,
        "Not": false,
        "EnableRule": true
      }
    ]
  },
  "BackfillEnabled": false
}

The following code is an example of ticket and player data.

{
    "queueName": "Default",
    "attributes": {},
    "players": [{
            "id": "w4505uhp7ohr27di0ob9qdncaq5b",
            "customData": {},
            "qosResults:":[ // list the regions supported by the fleet where the match will be allocated
                {
                    "regionId": "61dd5b48-d24c-11ed-afa1-0242ac120002",
                    "packetLoss": 0.8,
                    "latency": 50
                },
                {
                    "regionId": "cf32c6e1-46ff-4904-9a37-359fc66bf382",
                    "packetLoss": 0.0,
                    "latency": 10
                }
            ]
        }
    ]
}

5v5, Team Red vs Team Blue

The following code includes two different teams. Players must have chosen the team they want to play in.

{
  "Name": "5v5 - Red vs Blue",
  "MatchDefinition": {
    "Teams": [
      {
        "Name": "Team Red",
        "TeamCount": {
          "Min": 1,
          "Max": 1
        },
        "PlayerCount": {
          "Min": 5,
          "Max": 5
        },
        "TeamRules": [
          {
            "Name": "Team Red",
            "Type": "Equality",
            "Source": "Players.CustomData.Team",
            "Reference": "Red",
            "Not": false,
            "EnableRule": true
          }
        ]
      },
      {
        "Name": "Team Blue",
        "TeamCount": {
          "Min": 1,
          "Max": 1
        },
        "PlayerCount": {
          "Min": 5,
          "Max": 5
        },
        "TeamRules": [
          {
            "Name": "Team Blue",
            "Type": "Equality",
            "Source": "Players.CustomData.Team",
            "Reference": "Blue",
            "Not": false,
            "EnableRule": true
          }
        ]
      }
    ],
    "MatchRules": []
  },
  "BackfillEnabled": false
}

The following code is an example of compatible ticket and player data.

{
    "queueName": "Default",
    "attributes": {},
    "players": [{
            "id": "e16naw0e6cgm8kw3vimtxt9qmhva",
            "customData": {
                "Team": "Blue"
            }
        }
    ]
}

60 players

A 60-players match, similar to Battle Royal, with no teams.

The number of minimum players to start the game relaxes to 30 after the oldest ticket in the match is 15 seconds old.

Backfill is enabled, allowing players to join after the match is created.

{
  "Name": "60 Players",
  "MatchDefinition": {
    "Teams": [
      {
        "Name": "Team",
        "TeamCount": {
          "Min": 1,
          "Max": 1
        },
        "PlayerCount": {
          "Min": 60,
          "Max": 60,
          "Relaxations": [
            {
              "Type": "RangeControl.ReplaceMin",
              "AgeType": "Oldest",
              "Value": 30,
              "AtSeconds": 15
            }
          ]
        },
        "TeamRules": []
      }
    ],
    "MatchRules": []
  },
  "BackfillEnabled": true
}

The following code is an example of compatible ticket and player data.

{
    "queueName": "Default",
    "attributes": {},
    "players": [{
            "id": "x7e9zb9t1928r0zw8x5j1sxhowkl",
            "customData": {}
        }
    ]
}

20 teams of 3 players

The following sample includes 20 teams of exactly 3 players. The number of minimum teams to start the game relaxes when the youngest ticket in the match is 15 seconds old. The number of players in a team is always 3.

{
  "Name": "20 teams of 3 players",
  "MatchDefinition": {
    "Teams": [
      {
        "Name": "Team",
        "TeamCount": {
          "Min": 20,
          "Max": 20,
          "Relaxations": [
            {
              "Type": "RangeControl.ReplaceMin",
              "AgeType": "Youngest",
              "Value": 10,
              "AtSeconds": 15
            }
          ]
        },
        "PlayerCount": {
          "Min": 3,
          "Max": 3,
          "Relaxations": []
        },
        "TeamRules": []
      }
    ],
    "MatchRules": []
  },
  "BackfillEnabled": true
}

The following code is an example of compatible ticket and player data.

{
    "queueName": "Default",
    "attributes": {},
    "players": [{
            "id": "91isf42z1n95lpv52upxrjc4ttvj",
            "customData": {}
        }
    ]
}

Everyone in a team has chosen a different character

{
  "Name": "20 teams of 3 players",
  "MatchDefinition": {
    "Teams": [
      {
        "Name": "Team",
        "TeamCount": {
          "Min": 20,
          "Max": 20,
          "Relaxations": []
        },
        "PlayerCount": {
          "Min": 3,
          "Max": 3,
          "Relaxations": []
        },
        "TeamRules": [
          {
            "Name": "Different characters",
            "Type": "Equality",
            "Source": "Players.CustomData.Character",
            "Not": true,
            "EnableRule": true
          }
        ]
      }
    ],
    "MatchRules": []
  },
  "BackfillEnabled": true
}

The following code is an example of compatible ticket and player data.

{
    "queueName": "Default",
    "attributes": {},
    "players": [{
            "id": "1v0wykm1d3edny8mcdnx53yr7wrg",
            "customData": {
                "Character":"Cloud"
            }
        }
    ]
}

Asymmetrical 5v1 - Human vs Monster

Every player in the Human team must have the Human value to true.

The player in the Monster team must have the Monster value to true.

These rules allow players to choose more than 1 role.

{
  "Name": "Asymmetrical 5v1",
  "MatchDefinition": {
    "Teams": [
      {
        "Name": "Human",
        "TeamCount": {
          "Min": 1,
          "Max": 1,
          "Relaxations": []
        },
        "PlayerCount": {
          "Min": 5,
          "Max": 5,
          "Relaxations": []
        },
        "TeamRules": [
          {
            "Name": "Human",
            "Type": "Equality",
            "Source": "Players.CustomData.Human",
            "Reference": "true",
            "Not": false,
            "EnableRule": true
          }
        ]
      },
      {
        "Name": "Monster",
        "TeamCount": {
          "Min": 1,
          "Max": 1
        },
        "PlayerCount": {
          "Min": 1,
          "Max": 1
        },
        "TeamRules": [
          {
            "Name": "Monster",
            "Type": "Equality",
            "Source": "Players.CustomData.Monster",
            "Reference": "true",
            "Not": false,
            "EnableRule": true
          }
        ]
      }
    ],
    "MatchRules": []
  },
  "BackfillEnabled": false
}

The following code is an example of compatible ticket and player data.

{
    "queueName": "Default",
    "attributes": {},
    "players": [{
            "id": "ngbbufcpbph227f42rpdv0v8zs75",
            "customData": {
                "Human": "true",
                "Monster": "false"
            }
        }
    ]
}

Require some roles to be filled in the match

These rules require that the Human team contains players with the following roles:

  • 1 Medic
  • 2 Tanks
  • 2 DPS
{
  "Name": "Asymmetrical 5v1",
  "MatchDefinition": {
    "Teams": [
      {
        "Name": "Human",
        "TeamCount": {
          "Min": 1,
          "Max": 1,
          "Relaxations": []
        },
        "PlayerCount": {
          "Min": 5,
          "Max": 5,
          "Relaxations": []
        },
        "TeamRules": [
          {
            "Name": "Human",
            "Type": "Equality",
            "Source": "Players.CustomData.Human",
            "Reference": "true",
            "Not": false,
            "EnableRule": true
          },
          {
            "Name": "Medic",
            "Type": "GreaterThanEqual",
            "Source": "Players.CustomData.Medic.Sum",
            "Reference": 1,
            "Not": false,
            "EnableRule": true
          },
          {
            "Name": "Tank",
            "Type": "GreaterThanEqual",
            "Source": "Players.CustomData.Tank.Sum",
            "Reference": 2,
            "Not": false,
            "EnableRule": true
          },
          {
            "Name": "DPS",
            "Type": "GreaterThanEqual",
            "Source": "Players.CustomData.DPS.Sum",
            "Reference": 2,
            "Not": false,
            "EnableRule": true
          }
        ]
      },
      {
        "Name": "Monster",
        "TeamCount": {
          "Min": 1,
          "Max": 1
        },
        "PlayerCount": {
          "Min": 1,
          "Max": 1
        },
        "TeamRules": [
          {
            "Name": "Monster",
            "Type": "Equality",
            "Source": "Players.CustomData.Monster",
            "Reference": "true",
            "Not": false,
            "EnableRule": true
          }
        ]
      }
    ],
    "MatchRules": []
  },
  "BackfillEnabled": false
}

The following code is an example of compatible ticket and player data.

{
    "queueName": "Default",
    "attributes": {},
    "players": [{
            "id": "l142lvdrbuyox8lwxs5sfyt8lshv",
            "customData": {
                "Human": "true",
                "Monster": "false",
                "Medic": 1, // the role the player chose
                "Tank": 0,
                "DPS": 0
            }
        }
    ]
}

Lobby-like game server

These rules request a game server as soon as someone creates a ticket if no servers are running. Otherwise, backfill fills up the server that is running.

{
  "Name": "City",
  "MatchDefinition": {
    "Teams": [
      {
        "Name": "City",
        "TeamCount": {
          "Min": 1,
          "Max": 1,
          "Relaxations": []
        },
        "PlayerCount": {
          "Min": 1,
          "Max": 100,
          "Relaxations": []
        },
        "TeamRules": []
      }
    ],
    "MatchRules": []
  },
  "BackfillEnabled": true
}
{
    "queueName": "Default",
    "attributes": {},
    "players": [{
            "id": "cb108q26yxt3lldyjfg54p8uuayk",
            "customData": {}
        }
    ]
}

Players can choose the city they are in

Every player in a match must have the same city. If it can't find a match with that city, matchmaker requests a new allocation for that city.

{
  "Name": "City",
  "MatchDefinition": {
    "Teams": [
      {
        "Name": "City",
        "TeamCount": {
          "Min": 1,
          "Max": 1,
          "Relaxations": []
        },
        "PlayerCount": {
          "Min": 1,
          "Max": 100,
          "Relaxations": []
        },
        "TeamRules": []
      }
    ],
    "MatchRules": [
      {
        "Name": "City",
        "Type": "Equality",
        "Source": "Players.CustomData.City",
        "Not": false,
        "EnableRule": true
      }
    ]
  },
  "BackfillEnabled": true
}

The following code is an example of compatible ticket and player data.

{
    "queueName": "Default",
    "attributes": {},
    "players": [{
            "id": "cb108q26yxt3lldyjfg54p8uuayk",
            "customData": {
                "City": "Azarel"
            }
        }
    ]
}