1. 19 Jun, 2026 2 commits
    • Mahmoud Aglan's avatar
      feat: cascade 5 global multiplayer systems to all game endpoints · 00bcf1a0
      Mahmoud Aglan authored
      - domino-match.php: add can_player_queue anti-abuse, last_activity tracking,
        server-side turn timeout (30s), universal complete_match rewards,
        heartbeat + leave handlers
      - game.php (chess): add heartbeat + leave handlers, last_activity on moves,
        replace homebrew auto-close with server turn timeout (120s),
        replace inline reward logic with universal complete_match RPC
      - matchmaking.php: add can_player_queue cooldown check before queuing
      - ludo.php (old API): add last_activity on moves, complete_match on end
      - match-session.js: change ping from move-based to heartbeat action,
        handle 'abandoned' status in poll response
      - match-ui.js: add showBotReplacement and showTurnTimedOut overlays
      - engine.js: add domino endpoint mapping for match recovery
      - domino/game.js: add heartbeat (10s interval), handle _turn_timed_out,
        update endMatch to send winners array to universal rewards
      - domino/result.js: remove duplicate complete call for live games,
        use new winners-array format for bot games
      - ludo/result.js: add rewards display (coins, XP, rating change)
      - Move shared supabaseRpc helper to includes/supabase.php
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      00bcf1a0
    • Mahmoud Aglan's avatar
      feat: implement 5 global multiplayer systems (DB + PHP + client) · 2ce274f3
      Mahmoud Aglan authored
      ## System 1: Match Lifecycle Manager
      - DB function `cleanup_stale_matches()` auto-abandons zombie matches
        (waiting >5min, in_progress >30min) across all games
      - Cleaned 109 existing zombies (12 ludo, 36 domino, 61 chess)
      - New `match-cleanup.php` endpoint to trigger periodically
      
      ## System 2: Universal Match Completion + Rewards
      - DB function `complete_match(game_key, match_id, winners, reason)`
        awards coins/XP, updates stats, tracks ratings for ANY game
      - Ludo now calls `action: 'complete'` on game end with ordered winners
      - Uses `reward_config` table (ludo_win_coins=40, 2nd=20, 3rd=10, 4th=5)
      - Tracks `abandon_count` on profiles for anti-abuse
      
      ## System 3: Server-Side Turn Timeout
      - Added `last_activity` column + index on ludo/domino matches
      - DB function `enforce_turn_timeout()` checked on every GET poll
      - After 20s of inactivity: marks turn as timed out
      - After 3 consecutive timeouts: flags for permanent bot replacement
      - Client handles `_turn_timed_out` response from server
      
      ## System 4: Connection State Protocol
      - DB function `match_heartbeat(game_key, match_id, player_id)`
      - Tracks per-player last_ping in game_state.connections
      - Returns other players' status: online/weak/disconnected/abandoned
      - Client sends heartbeat every 10s during live matches
      - Works across chess, ludo, domino
      
      ## System 5: Anti-Abuse + RLS Hardening
      - RLS: ludo/domino UPDATE now requires player to be participant
      - Unique index prevents duplicate queue entries per user
      - DB function `can_player_queue()` enforces 5-min cooldown after
        3+ abandons in 24h (resets daily)
      - `handleLudoLeave` now tracks bot replacement as reversible (30s grace)
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      2ce274f3
  2. 17 Jun, 2026 14 commits
    • Mahmoud Aglan's avatar
      fix: escalating six-boost prevents stuck-at-home frustration · 2210bb63
      Mahmoud Aglan authored
      Track rollsWithoutSix per player. Each consecutive failed roll when
      all pieces are home ramps the six probability harder — by roll 3-4
      a human player has ~40-45% chance of six (vs 17% base). No more
      watching bots play while stuck for 6+ turns.
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      2210bb63
    • Mahmoud Aglan's avatar
      feat: rework Ludo dice for fun tension — human luck + rubber-banding · 929a1434
      Mahmoud Aglan authored
      The dice system now creates satisfying back-and-forth gameplay:
      
      - Human players get a subtle persistent luck edge over bots (slight
        boost to 5s and 6s) — feels lucky without being obvious
      - Rubber-band: whoever is behind gets help catching up; humans get
        an extra comeback boost when far behind the leader
      - Momentum damper: bots that pull too far ahead get cooled down
      - Stuck rescue: all-at-home gets aggressive six boost (stronger for
        humans)
      - Finishing push after 8 min ensures games wrap under 15 min
      - Removed all capture-biased dice logic — captures now happen purely
        by board position, not rigged dice
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      929a1434
    • Mahmoud Aglan's avatar
      fix: reduce capture frequency and add time-decay for fairer Ludo · ee53cfbf
      Mahmoud Aglan authored
      - Halved near-capture dice boost (0.3 → 0.15) and reduced per-die
        capture bonus (0.15 → 0.08)
      - Capture bias decays to zero as game approaches 15 min (captureMul
        factor), making late-game rolls essentially fair/random
      - Removed the multi-capture boost that added +0.2 to all dice 1-5
      - Increased six-boost after 8 min (scales up to +0.8 by 15 min) to
        accelerate finishing and keep games under ~15 minutes
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      ee53cfbf
    • Mahmoud Aglan's avatar
      feat: bigger stacked pawns + 15s turn timer with auto-play · a2876e3e
      Mahmoud Aglan authored
      - Increased stacked pawn scale (2 pawns: 0.82, 3+: 0.7) so they stay
        visible when sharing a cell
      - Added 15-second turn timer bar above the dice area
      - Timer counts down visually (green→yellow→red gradient)
      - If player doesn't roll in time, auto-rolls for them
      - If player doesn't pick a piece in time, bot logic picks the best move
      - Timer works in both single-player and multiplayer modes
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      a2876e3e
    • Mahmoud Aglan's avatar
      revert: restore original flat board and simple pawn visuals · 8c14559d
      Mahmoud Aglan authored
      Remove all 10 fancy visual enhancements (3D gradients, embossed borders,
      glowing safe squares, specular pawns) — back to the clean flat style.
      Keep 60fps render loop, smooth tweens, stacking, and mini dice.
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      8c14559d
    • Mahmoud Aglan's avatar
      feat: ludo — 60fps render loop with offscreen board cache + smooth tween animations · 4f6e3507
      Mahmoud Aglan authored
      - Offscreen canvas caches static board (drawn once, reused every frame)
      - Continuous requestAnimationFrame loop renders pieces at 60fps
      - Piece movement uses smooth parabolic arc tweens (no setTimeout stepping)
      - Enter-from-home uses easeOutBounce for natural pop-in feel
      - All drawBoard() calls now just mark board dirty — next frame picks it up
      - Move preview ghosts pulse smoothly using sin wave
      - Ambient corner glow rendered per-frame (lightweight, no cache needed)
      - Render loop auto-stops on game exit/end for zero resource leak
      - Bot step animation also uses smooth tween system
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      4f6e3507
    • Mahmoud Aglan's avatar
      feat: ludo — 10 major visual enhancements for premium board game feel · 2e3f0ecf
      Mahmoud Aglan authored
      1. Rich board background with radial gradient texture (warm parchment)
      2. Center triangles with radial gradient glow + white diamond center
      3. 3D pawns with gradient bodies, specular highlights, drop shadows
      4. Safe squares with radial glow + shadowed gold stars
      5. Home columns with gradient cells + directional arrows
      6. Home zones with linear gradient fill + corner dot decorations
      7. Animated turn indicator arrow on active player panel + glow name
      8. Ambient corner glow showing current player's color on board
      9. Decorated dice area with gold accent, gradient background, radial glow
      10. Embossed board frame with wood-tone border + inner gold accent
      
      Also: roll button pulses when available, panels have shadow glow on active
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      2e3f0ecf
    • Mahmoud Aglan's avatar
      feat: ludo — super juicy animations, mini dice on each player panel · 58001eb9
      Mahmoud Aglan authored
      - Add mini dice to all player panels showing roll result with pop-in animation
      - Bot/opponent dice rolls visible next to their name with same shake + land effect
      - Panel glows on six, active player has pulse + avatar bounce animation
      - Pawn movement uses full arc-bounce (up→peak→down→squash) per hop
      - Enter animation: pop-out from home with bounce + landing dust burst
      - Long moves (3+ steps) produce particle burst on landing
      - Mini dice fades out after 1.2s when turn passes to next player
      - Rolling state shows rotation shake animation on mini dice
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      58001eb9
    • Mahmoud Aglan's avatar
    • Mahmoud Aglan's avatar
      fix: ludo — reduce capture probability, add pawn stacking grid on shared cells · 1aa5577b
      Mahmoud Aglan authored
      - Dramatically reduce lucky roll weights (nearCapture +1.0→+0.3, capturePerDie +0.6→+0.15)
      - Reduce six-boosting when pieces are home (1.5→0.8, 0.6→0.4) to lower triple-six frequency
      - Pawns sharing a cell now render in a grid layout: 2 pawns side-by-side, 3 in triangle, 4 in 2x2
      - Stacked pawns shrink proportionally (72% for 2, 60% for 3-4) so players can count them
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      1aa5577b
    • Mahmoud Aglan's avatar
      fix: domino — wrong tile placement bug, forced boneyard draw, fly animation, visual pile, win VFX · 189ce786
      Mahmoud Aglan authored
      - Validate tile exists in player's hand before executing placement
      - Draw continuously from boneyard until playable tile found (with 400ms delay per draw)
      - Tile flies from hand area to board position instead of instant scale-in
      - Visual boneyard pile on left side with live counter
      - Multi-wave confetti + starBurst + screen flash on match win
      - Proper tile aspect ratio (34x68, 1:2) with 8px hand spacing
      - Flush tile contact on board (GAP=1)
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      189ce786
    • Mahmoud Aglan's avatar
      fix(ludo): prevent pawns on safe squares from being sent home · 31cf6666
      Mahmoud Aglan authored
      Two bugs caused pawns to teleport back to the yard without capture:
      
      1. Triple-six penalty blindly sent the last-moved piece to pos=-1
         regardless of whether it was resting on a safe square. Now the
         penalty only applies if the piece is NOT on a safe square.
      
      2. captureAt() checked if the DESTINATION was safe but didn't guard
         against the victim's own position being safe. Added a per-piece
         safety check so a pawn sitting on any safe square (star squares,
         colored start squares) can never be captured under any circumstance.
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      31cf6666
    • Mahmoud Aglan's avatar
      feat(ludo): dice visibility, capture SFX/VFX, ranking system, finish fix · 6d1a8ac5
      Mahmoud Aglan authored
      - Hide dice + roll button when not player's turn; show only on active turn
      - Distinct capture feedback: cheerful SFX+confetti for the capturer,
        sad SFX+red flash+shake for the victim whose pawn got sent home
      - Game continues until 3 players finish — 1st/2nd/3rd get podium screen,
        4th gets loser screen. Finished players are dimmed and auto-skipped
      - Fix finish position: pawns now land on the outer middle of the center
        3x3 grid (squares 2/4/6/8 per color), not the dead center square 5
      - Result screen shows Arabic ranking labels and medals per placement
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      6d1a8ac5
    • Mahmoud Aglan's avatar
      feat(ludo): capture-boost dice, skip-corner path, and firework finish · c55124cc
      Mahmoud Aglan authored
      - Add "lucky roll" mechanic: when an opponent pawn is exposed directly
        ahead (1-6 squares), boost probability of rolling the exact capture
        value by ~+1.0 weight, plus +0.6 for any die value that enables capture
      - Change pawn path: pieces enter home column from position 50 (the square
        before the corner), treating the corner as dead space for their own
        color — matches standard Ludo turn geometry
      - Add multi-wave firework particle burst (player-colored) when a pawn
        lands exactly on the Home finish position
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      c55124cc
  3. 16 Jun, 2026 4 commits
  4. 15 Jun, 2026 5 commits
  5. 14 Jun, 2026 7 commits
  6. 06 Jun, 2026 8 commits