Can one team start a game with this set of rules?

Hello!

Match in our game has two teams from 0 to 3 players (we add bots to fill both teams if there are no enough players)
Here is an example of the flexmatch rule set:

    {
"name": "Team Battle",
"ruleLanguageVersion": "1.0",
"playerAttributes": [{
"name": "rating",
"type": "number"
}],
"teams": [{
"name": "black",
"maxPlayers": 3,
"minPlayers": 3
},{
"name": "white",
"maxPlayers": 3,
"minPlayers": 3
}],
"rules": [{
"name": "FairTeamRating",
"description": "Average team rating should be equal",
"type": "distance",
"measurements": ["avg(teams[*].players.attributes[rating])"],
"referenceValue": "avg(flatten(teams[*].players.attributes[rating]))",
"maxDistance": 100
}],
"expansions": [{
"target": "rules[FairTeamRating].maxDistance",
"steps": [{
"waitTimeSeconds": 10,
"value": 200
},{
"waitTimeSeconds": 15,
"value": 300
},{
"waitTimeSeconds": 20,
"value": 400
}]
},{
"target": "teams[*].minPlayers",
"steps": [{
"waitTimeSeconds": 30,
"value": 2
},{
"waitTimeSeconds": 35,
"value": 1
},{
"waitTimeSeconds": 40,
"value": 0
}]
}]
}

How to write rule FairTeamRating so that one player can start the game against bots?

Your sample looks close, but you can’t use wildcards on expansions at the moment. So you’d have to expand white and black separately. Presumably one of those wouldn’t go below 1 so that you ensure the game has at least one player.

1 Like