MCPcopy Index your code
hub / github.com/castaneai/minimatch

github.com/castaneai/minimatch @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
592 symbols 1,323 edges 29 files 70 documented · 12%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

minimatch

Minimal Open Match replacement.

Why minimatch?

Open Match is a good solution for scalable matchmaking, but its scalability complicates the architecture. Most of us are game developers, not Kubernetes experts.

minimatch provides an API compatible with Open Match, but runs entirely in a single Go process. No Kubernetes required. It's also highly scalable by offloading state to Redis, making it suitable for everything from local development to full-scale production.

Features

  • [x] Open Match compatible Frontend Service (gRPC, gRPC-Web and Connect)
  • [x] Create/Get/Watch/Delete ticket
  • [ ] Backfill
  • [x] Run match functions and propose matches
  • [x] Evaluator

Quickstart

minimatch consists of two parts: Frontend and Backend.

Frontend is an API Server for creating tickets and checking matchmaking status.

Backend is a job to retrieve tickets and perform matchmaking. You can pass the MatchProfile, MatchFunction and Assigner to the backend.

MatchProfile is the definition of matchmaking. It has pools for classifying tickets. MatchFunction performs matchmaking based on Ticket for each fetched pool. And Assigner assigns a GameServer info to the established matches.

The following is a minimal code. See examples/ for a more actual example.

Use case

Testing matchmaking logic

Minimatch has Open Match Frontend compatible services. Therefore, it can be used for testing of matchmaking logic without Kubernetes.

minimatch has a helper function RunTestServer making it easy to write matchmaking tests. See examples/integration_test for more specific examples.

package xxx_test

import (
  "testing"

  "github.com/castaneai/minimatch"
  pb "github.com/castaneai/minimatch/gen/openmatch"
)

func TestSimpleMatch(t *testing.T) {
  s := minimatch.RunTestServer(t, map[*pb.MatchProfile]minimatch.MatchFunction{
    profile: minimatch.MatchFunctionFunc(MakeMatches),
  }, minimatch.AssignerFunc(AssignGameServer))
  frontend := s.DialFrontend(t)

  // ...
}

Small development environments

When environments are separated for development and production, you may want to reduce infrastructure costs for the development environment.

In such cases, minimatch can be installed instead of Open Match to create a minimum development environment. minimatch has an Open Match compatible Frontend Service, so there is no need to change the API!

See Simple 1vs1 matchmaking server for examples.

Differences from Open Match

minimatch is modeled after Open Match, but has some differences in its internal architecture.

See Differences from Open Match for details.

Scalability

Is minimatch really just a mini? No, it is not! Despite its name, minimatch has scalability. Please see Scalable minimatch.

Consistency and performance

Please see the following docs for consistency and performance to consider in minimatch.

Consistency and performance

Metrics

minimatch Backend exposes metrics in OpenTelemetry format to help monitor performance. Please see Metrics for details.

Extension points exported contracts — how you extend this code

FrontendServiceClient (Interface)
FrontendServiceClient is a client for the openmatch.FrontendService service. [6 implementers]
gen/openmatch/openmatchconnect/frontend.connect.go
Assigner (Interface)
Assigner assigns a GameServer info to the established matches. [3 implementers]
assigner.go
MatchFunction (Interface)
MatchFunction performs matchmaking based on Ticket for each fetched Pool. [1 implementers]
matchfunction.go
FrontendStore (Interface)
(no doc) [2 implementers]
pkg/statestore/frontend.go
FrontendOption (Interface)
(no doc)
frontend.go
Evaluator (Interface)
(no doc)
evaluator.go
BackendOption (Interface)
(no doc)
backend.go
TestServerOption (Interface)
(no doc)
testing.go

Core symbols most depended-on inside this repo

CreateTicket
called by 28
pkg/statestore/frontend.go
GetTicket
called by 22
pkg/statestore/frontend.go
GetAssignment
called by 17
pkg/statestore/frontend.go
Addr
called by 15
testing.go
GetActiveTicketIDs
called by 15
pkg/statestore/backend.go
TickBackend
called by 10
testing.go
DeleteTicket
called by 9
pkg/statestore/frontend.go
AddMatchFunction
called by 8
backend.go

Shape

Method 376
Function 139
Struct 52
Interface 16
FuncType 8
TypeAlias 1

Languages

Go100%

Modules by API surface

gen/openmatch/messages.pb.go119 symbols
gen/openmatch/frontend.pb.go96 symbols
gen/openmatch/frontend_grpc.pb.go61 symbols
gen/openmatch/openmatchconnect/frontend.connect.go46 symbols
pkg/statestore/redis.go45 symbols
backend.go25 symbols
testing.go24 symbols
pkg/statestore/ticketcache.go21 symbols
frontend.go20 symbols
tests/intergration_test.go13 symbols
pkg/statestore/redis_test.go13 symbols
metrics.go13 symbols

For agents

$ claude mcp add minimatch \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact