本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
示例:使用复合规则创建与属性相似或选择相似的玩家的配对
此示例说明如何使用 compound
为两个团队的对战设置规则集。在示例中:
-
该
SimilarLeagueDistance
规则确保一场对战中的所有玩家与其他玩家具有 2 以内的league
。 -
该
SimilarSkillDistance
规则确保一场对战中的所有玩家与其他玩家具有 10 以内的skill
。如果玩家等待 10 秒,则距离将扩大到 20 秒。如果玩家等待 20 秒,则距离将扩大到 40 秒。 -
该
SameMapComparison
规则确保对战中的所有玩家都提出同样的map
。 -
该
SameModeComparison
规则确保对战中的所有玩家都提出同样的mode
。 -
如果满足以下任意条件,
CompoundRuleMatchmaker
规则确保:-
一场对战中的玩家提出了同样的
map
和mode
。 -
对战中的玩家具有不相上下的
skill
和league
属性。
-
{ "ruleLanguageVersion": "1.0", "teams": [{ "name": "red", "minPlayers": 10, "maxPlayers": 20 }, { "name": "blue", "minPlayers": 10, "maxPlayers": 20 }], "algorithm": { "strategy":"balanced", "balancedAttribute": "skill", "batchingPreference":"fastestRegion" }, "playerAttributes": [{ "name": "league", "type": "number" },{ "name": "skill", "type": "number" },{ "name": "map", "type": "string" },{ "name": "mode", "type": "string" }], "rules": [{ "name": "SimilarLeagueDistance", "type": "distance", "measurements": ["max(flatten(teams[*].players.attributes[league]))"], "referenceValue": "min(flatten(teams[*].players.attributes[league]))", "maxDistance": 2 }, { "name": "SimilarSkillDistance", "type": "distance", "measurements": ["max(flatten(teams[*].players.attributes[skill]))"], "referenceValue": "min(flatten(teams[*].players.attributes[skill]))", "maxDistance": 10 }, { "name": "SameMapComparison", "type": "comparison", "operation": "=", "measurements": ["flatten(teams[*].players.attributes[map])"] }, { "name": "SameModeComparison", "type": "comparison", "operation": "=", "measurements": ["flatten(teams[*].players.attributes[mode])"] }, { "name": "CompoundRuleMatchmaker", "type": "compound", "statement": "or(and(SameMapComparison, SameModeComparison), and(SimilarSkillDistance, SimilarLeagueDistance))" }], "expansions": [{ "target": "rules[SimilarSkillDistance].maxDistance", "steps": [{ "waitTimeSeconds": 10, "value": 20 }, { "waitTimeSeconds": 20, "value": 40 }] }] }