go-matcher

command module
v0.0.11-otel Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 0 Imported by: 0

README

go-matcher

Go Report Card codecov CI GitHub release (latest SemVer)

Go-matcher is a game matcher implement in Go, which supports add game mode and match strategy easily.

  • GameMode: The identifier of each different game, used to define as enum.
  • MatchStrategy: The strategy to match players, used to define as interface.

Features

  • API
    • HTTP
    • TCP
    • UDP
    • KCP
    • WebSocket
    • gRPC
  • Service
    • match service
    • push service
    • settle service
  • Swagger Doc
  • timer
    • native timer
    • asynq timer
    • redis timer
  • GameMode
    • GoatGame
  • MatchStrategy
    • Glicko2
    • Gather
    • ELO
  • Config
    • File Loader
    • Nacos Dynamic Loader
  • AI Generator
  • Open Telemetry
    • Logger
    • Tracer
    • Metric

Start With Open Telemetry

make docker-up

Architecture

go-matcher architecture

Smoke flow

smoke flow

State Machine

state machine

Entry Design

entry design

Todo

  • network
    • UDP
    • KCP
    • WebSocket
    • gRPC
  • static config
    • yaml
  • dynamic config
    • nacos
    • etcd
    • apollo
    • consul
  • tracer
  • open telemetry
  • repository stats
  • match queue stats
  • graceful restart
  • repository by redis
  • hot upgrade
  • horizontal expansion
  • AI Generator

Schedule

  • HandleMatchSuccess(8.9)
  • HandleGameResult(8.9)
  • Ready & Unready(8.9)
  • Push Service by gRPC(8.12)
  • Static Config(8.13)
  • Dynamic Config by nacos(8.13)
  • repository by redis(8.14)
  • entry encode & decode(8.14)
  • zerolog logger & tracer & open telemetry(8.15-8.16)
  • repository stats & match queue stats(8.19)
  • zinx(8.20-8.23)
  • TCP api(8.26)
  • WebSocket api(8.27)
  • AI Generator

Help

Before writing code
bash ./setup_pre_commit.sh
Start asynq web UI Asynqmon
# clone repo
git clone git@github.com:hibiken/asynqmon.git
# enter repo
cd asynqmon
# check node version
node -v
# if higher 16, should degrade it
# install nvm if not
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# install node 16
nvm install 16
# use node 16
nvm use 16
# install yarn if not
brew install yarn
# build asynqmon
make build
# start asynqmon
./asynqmon
How to use Open Telemetry

Open Telemetry

Start jaeger
docker run -d --name jaeger \
  -e COLLECTOR_OTLP_ENABLED=true \
  -p 16686:16686 \
  -p 4317:4317 \
  -p 4318:4318 \
  jaegertracing/all-in-one:latest
Start Nacos

run by docker compose:

git clone https://github.com/nacos-group/nacos-docker.git \
cd nacos-docker \
docker-compose -f example/standalone-mysql-8.yaml up

open nacos website:

open http://localhost:8848/nacos/index.html

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
tcp
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.
examples
add
Package add is an example to test hook that checks go files with tests.
Package add is an example to test hook that checks go files with tests.
race
Package race is an example to demonstrate race conditions.
Package race is an example to demonstrate race conditions.
internal
api
constant
Package constant defines some constants.
Package constant defines some constants.
log
pb
pto
Package pto provides general zconfig definitions that are intended for use by other packages.
Package pto provides general zconfig definitions that are intended for use by other packages.
pkg
concurrent
Package concurrent provides some enhanced concurrent utilities.
Package concurrent provides some enhanced concurrent utilities.
timer
Package timer defines the interface for timer.
Package timer defines the interface for timer.

Jump to

Keyboard shortcuts

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