🎮 Beta Gamer

Chess — Rules & timers

Game mechanics, clock behaviour, reconnect window, and all possible game:over reasons.

Clock

Each player starts with 10 minutes (600 000 ms). The clock counts down only while it's that player's turn. When a player's clock hits zero, game:over fires with reason: "timeout".

Clock values are sent in every game:move:made and timer:update event as playerTimers: { [playerId]: number } (milliseconds remaining). The Timer component syncs automatically.

The AFK timeout (90s idle) is separate from the 10-minute clock. A player can run out of AFK time even if they have plenty of clock time remaining.

Reconnect

When a player disconnects, the server starts a 60-second window. The opponent receives player:disconnected. If the player reconnects within 60 seconds by emitting game:reconnect { playerId }, the game resumes and both players receive game:reconnected. If the window expires, game:over fires with reason: "disconnect".

Pawn promotion

When a pawn reaches rank 8 (white) or rank 1 (black), include promotion in the move payload. The ChessBoard component shows a dialog automatically — if you're handling moves manually, pass the promotion piece.

ValuePiece
qQueen (most common)
rRook
bBishop
nKnight

Draw conditions

Draw by agreement: Either player emits game:draw:offer. Opponent accepts with game:draw:accept. game:over fires with reason: "draw by agreement".
Stalemate: No legal moves and not in check. Ends automatically with reason: "stalemate".
Insufficient material: Neither side can force checkmate (e.g. K vs K, K+B vs K). Ends automatically with reason: "draw".
Threefold repetition: Same position occurs three times. Ends automatically with reason: "draw".
50-move rule: 50 consecutive moves with no pawn move or capture. Ends automatically with reason: "draw".

Bot difficulty

DifficultyResponse delayStrength
easy0.5–1.5sMakes occasional blunders. Good for beginners.
medium1–3sPlays solid moves. Misses complex tactics.
hard2–5sStrong play. Rarely blunders.

game:over — reason reference

reasonwinnerTriggered by
checkmateplayerIdKing is in checkmate — no legal moves to escape.
resignationplayerIdPlayer emitted game:resign.
timeoutplayerIdPlayer's 10-minute clock reached 0.
afk_timeoutplayerIdPlayer was idle for 90 seconds.
stalematenullNo legal moves, not in check.
drawnullInsufficient material, threefold repetition, or 50-move rule.
draw by agreementnullBoth players agreed via game:draw:offer / game:draw:accept.
disconnectplayerIdOpponent did not reconnect within 60 seconds.
Beta Gamer GaaS API — questions? support@beta-gamer.com