Skip to content

sealbro/matchmaking

Repository files navigation

Matchmaking Service

This service is responsible for matchmaking players into games. It is a simple service that takes a list of players and matches them into games based on their skill level.

Hub

How to run

Docker

docker compose up --build

Local

  • Run the matchmaking service
go run cmd/service/main.go
  • Run the workload generator
go run cmd/workload/main.go

Environment variables

.env

Name Description Default
PRIVATE_ADDRESS Private metrics address :8081
GRPC_PROTOCOL gRPC protocol tcp
GRPC_ADDRESS gRPC address :32023
LOG_LEVEL slog level DEBUG
QUEUE_SIZE Size of the matchmaking queue 25
MIN_GROUP_SIZE Minimum group size 10
MAX_LEVEL_DIFF Maximum level difference 10
FIND_GROUP_EVERY_SECONDS Find group every seconds 1
MATCH_TIMEOUT_AFTER_SECONDS Matchmaking timeout in seconds 60

Metrics

localhost:8081/metrics

# HELP matchmaking_offline Total number of offline players in the matchmaking service.
# TYPE matchmaking_offline counter
matchmaking_offline 4034
# HELP matchmaking_online Total number of online players in the matchmaking service.
# TYPE matchmaking_online counter
matchmaking_online 4200
# HELP matchmaking_total Total number of players in the matchmaking service.
# TYPE matchmaking_total gauge
matchmaking_total{type="added"} 4200
matchmaking_total{type="matched"} 4140
matchmaking_total{type="removed"} 23
matchmaking_total{type="timeout"} 37

Features

  • Add players into matchmaking queue
  • Delete players from matchmaking queue
  • Return match ID and the list of players in the match
  • Setup timeout for the matchmaking process
  • Configure matchmaking group size
  • Get metrics for the matchmaking process
  • Make simple API for the service

What is not covered

  • Security (authentication, authorization)
  • Load balancing and high availability
  • Monitoring and Tracing
  • Permanent storage and restore after service restart
  • How to process next matchmaking for players which can be in session now?

Links