

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 範例：與具有類似屬性的玩家建立大型配對
<a name="match-examples-9"></a>

此範例說明如何使用 為兩個隊伍的配對設定規則集`batchDistance`。在範例中：
+ 此`SimilarLeague`規則可確保配對中的所有玩家在 2 個其他玩家`league`中都有 。
+ 此`SimilarSkill`規則可確保配對中的所有玩家在其他玩家中都有 10 `skill` 個內的 。如果玩家正在等待 10 秒，則距離會擴展到 20 秒。如果玩家正在等待 20 秒，則距離會擴展到 40 秒。
+ 此`SameMap`規則可確保配對中的所有玩家都請求相同的 `map`。
+ 此`SameMode`規則可確保配對中的所有玩家都請求相同的 `mode`。

```
{
    "ruleLanguageVersion": "1.0",
    "teams": [{
        "name": "red",
        "minPlayers": 100,
        "maxPlayers": 100
    }, {
        "name": "blue",
        "minPlayers": 100,
        "maxPlayers": 100
    }],
    "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": "SimilarLeague",
        "type": "batchDistance",
        "batchAttribute": "league",
        "maxDistance": 2
    }, {
        "name": "SimilarSkill",
        "type": "batchDistance",
        "batchAttribute": "skill",
        "maxDistance": 10
    }, {
        "name": "SameMap",
        "type": "batchDistance",
        "batchAttribute": "map"
    }, {
        "name": "SameMode",
        "type": "batchDistance",
        "batchAttribute": "mode"
    }],
    "expansions": [{
        "target": "rules[SimilarSkill].maxDistance",
        "steps": [{
            "waitTimeSeconds": 10,
            "value": 20
        }, {
            "waitTimeSeconds": 20,
            "value": 40
        }]
    }]
}
```