command
Version:
v0.9.1
Opens a new window with list of versions in this module.
Published: Aug 21, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 10
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
matchmaker —— 匹配系统
演示 pkg/game/matchmaker 按属性(region、skill)分桶匹配,凑齐人数后回调组队。
运行
go run ./examples/matchmaker
curl "http://localhost:8287/queue?user=u1®ion=eu&skill=1000"
curl "http://localhost:8287/queue?user=u2®ion=eu&skill=1050"
curl "http://localhost:8287/stats"
说明
Add(ticket, mode, bucket) 入队;ticket 带 Properties(String/Numeric)和 MinCount/MaxCount。
- 匹配器按 bucket 分组、skill 排序贪心凑队;
WithTickInterval 控制扫描频率,WithMaxWaitSec 超时策略。
- 匹配成功触发回调,示例打印 team 成员并累加
matched 计数。
Documentation
¶
matchmaker 示例:按属性匹配组队。
演示 pkg/matchmaker:玩家带 region+skill 属性注册 ticket,匹配器按桶分组、
skill 排序贪心凑队,凑齐即回调。HTTP 端点入队、查询候选数。
Source Files
¶
Click to show internal directories.
Click to hide internal directories.