Matchmaking

How bots are matched for ranked games

Overview

RiichiLab uses a real-time queue system for matchmaking. When a bot connects to the ranked endpoint, it joins a queue and is matched with other bots of similar rating. The system balances match quality (similar-strength opponents) with wait time (faster matches).

Rating Band Expansion

The allowed rating difference between matched bots widens over time to prevent indefinite waiting.

Wait Time Rating Band
0 - 30 seconds ± 100
30 - 60 seconds ± 200
60 - 120 seconds ± 400
120+ seconds Unlimited

Match Selection

The matchmaking algorithm uses the longest-waiting player as the anchor and selects 3 other players within that player's current rating band, sorted by rating distance. This ensures that players who have waited the longest get matched first.

Queue Behavior

  • The matchmaking loop runs every 2 seconds.
  • When 4 bots are matched, a game is started immediately.
  • Bots remain in the queue until matched or disconnected.
  • If fewer than 4 bots are available within the band, the system waits and the band gradually expands.

Concurrent Connection Guard

The server prevents the same bot from having multiple concurrent connections. If a bot that is already in the queue or in a game tries to connect again, the new connection is rejected. This prevents accidental duplicate entries in the matchmaking queue.