文档

支持

Matchmaker

Matchmaker

规则样本

Apply example matching rules for common game scenarios like one-versus-one, team-based, and asymmetrical matches.
阅读时间5 分钟最后更新于 15 天前

以下是一些规则示例,这些规则可用于创建不同类型的匹配。

1v1

{ "Name": "1v1", "BackfillEnabled": false, "MatchDefinition": { "Teams": [ { "Name": "Teams", "TeamCount": { "Min": 2, "Max": 2 }, "PlayerCount": { "Min": 1, "Max": 1 } } ] }}
以下代码是工单和玩家数据的示例。
{ "queueName": "Default", "attributes": {}, "players": [{ "id": "swsqozxo6qxm9fmm38khh3tddv35", "customData": {} }]}

对匹配中的所有玩家,QoS 都是相等的。

{ "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}
以下代码是工单和玩家数据的示例。
{ "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,红队 vs 蓝队

以下代码中有两个不同的队伍,玩家必须要选择要加入的队伍。
{ "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}
以下代码是兼容工单和玩家数据的示例。
{ "queueName": "Default", "attributes": {}, "players": [{ "id": "e16naw0e6cgm8kw3vimtxt9qmhva", "customData": { "Team": "Blue" } } ]}

60 名玩家

60 名玩家匹配,不组队,类似于大混战。 如果最先进入匹配的工单等待时间超过 15 秒,则会将游戏开始的条件放宽到至少需要 30 名玩家。 回填已启用,以便玩家可以在匹配创建后加入。
{ "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}
以下代码是兼容工单和玩家数据的示例。
{ "queueName": "Default", "attributes": {}, "players": [{ "id": "x7e9zb9t1928r0zw8x5j1sxhowkl", "customData": {} } ]}

20 个队伍,每个队伍 3 名玩家

以下样本有 20 个队伍,每个队伍必须是 3 名玩家。如果最后进入匹配的工单等待时间超过 15 秒,则会放宽游戏开始时对队伍数量下限的要求。每个队伍的玩家人数始终都是 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}
以下代码是兼容工单和玩家数据的示例。
{ "queueName": "Default", "attributes": {}, "players": [{ "id": "91isf42z1n95lpv52upxrjc4ttvj", "customData": {} } ]}

队伍中的每个人各司其职,分别担任不同角色。

{ "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}
以下代码是兼容工单和玩家数据的示例。
{ "queueName": "Default", "attributes": {}, "players": [{ "id": "1v0wykm1d3edny8mcdnx53yr7wrg", "customData": { "Character":"Cloud" } } ]}

非对等匹配 5v1 - 人类 vs 怪兽

人类队伍 中的每名玩家都必须将 **Human(人类)**值设置为
true
怪兽队伍 中的每名玩家都必须将 **Monster(怪兽)**值设置为
true
根据这些规则,玩家可以选择多个角色。
{ "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}
以下代码是兼容工单和玩家数据的示例。
{ "queueName": "Default", "attributes": {}, "players": [{ "id": "ngbbufcpbph227f42rpdv0v8zs75", "customData": { "Human": "true", "Monster": "false" } } ]}

要求将某些角色填充到匹配中

这些规则要求“人类队伍”要包含以下角色的玩家。
  • 1 医疗兵
  • 2 肉盾
  • 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}
以下代码是兼容工单和玩家数据的示例。
{ "queueName": "Default", "attributes": {}, "players": [{ "id": "l142lvdrbuyox8lwxs5sfyt8lshv", "customData": { "Human": "true", "Monster": "false", "Medic": 1, // the role the player chose "Tank": 0, "DPS": 0 } } ]}

大厅式游戏服务器

如果玩家创建工单时尚无服务器在运行,这些规则会立即发出游戏服务器请求。如果有服务器在运行,则会通过回填来填满正在运行的服务器。
{ "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": {} } ]}

玩家可以选择所在的城市。

同一匹配下的所有玩家必须在同一城市。如果该城市的匹配已满员,则 Matchmaker 会针对该城市申请新的分配额。
{ "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}
以下代码是兼容工单和玩家数据的示例。
{ "queueName": "Default", "attributes": {}, "players": [{ "id": "cb108q26yxt3lldyjfg54p8uuayk", "customData": { "City": "Azarel" } } ]}