matchmaker

command
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

README

matchmaker —— 匹配系统

演示 pkg/game/matchmaker 按属性(region、skill)分桶匹配,凑齐人数后回调组队。

运行

go run ./examples/matchmaker
curl "http://localhost:8287/queue?user=u1&region=eu&skill=1000"
curl "http://localhost:8287/queue?user=u2&region=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

Overview

matchmaker 示例:按属性匹配组队。

演示 pkg/matchmaker:玩家带 region+skill 属性注册 ticket,匹配器按桶分组、 skill 排序贪心凑队,凑齐即回调。HTTP 端点入队、查询候选数。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL