feat: Ludo multiplayer — 2 humans + 2 bots, matchmaking + realtime sync
New API: /api/ludo-match.php
- queue: searches ludo_queue for opponent, creates match with 2 humans + 2 bots
- status: polls for match_id when opponent joins
- move: syncs game state (positions, turn, dice)
- get: fetches current match state
Ludo game scene updated:
- Stores mode, myPlayerIndex, matchId, isHost
- isMyTurn() checks player_index vs current_turn
- handleNonPlayerTurn(): routes to bot (if host) or polling (if waiting)
- syncLudoState(): sends positions/turn/dice to server after every move
- startLudoPolling(): polls every 2s for opponent moves, applies state
- Bot turns run by host only (prevents duplicate bot moves)
- Player names show 'أنت' for self, 'لاعب X' for other human, 'Bot X' for bots
Queue scene updated:
- Uses ludo-match.php endpoint for Ludo games
- Passes playerIndex and players array to game scene
Co-Authored-By:
Claude Opus 4.6 <noreply@anthropic.com>
Showing
api/ludo-match.php
0 → 100644
Please register or sign in to comment