1. 19 Jun, 2026 11 commits
    • Mahmoud Aglan's avatar
      feat: rename backgammon variants to Arabic — شيش بيش، محبوسة، ٣١ · cb1bc9b7
      Mahmoud Aglan authored
      - sheshbesh (شيش بيش): standard backgammon with hitting
      - mahbousa (محبوسة): tapa-style, land on opponent to trap (no hitting)
      - thirtyone (٣١): gul-bara race variant, all pieces start stacked
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      cb1bc9b7
    • Mahmoud Aglan's avatar
      feat: implement full backgammon game — rules engine, bot AI, canvas renderer, multiplayer · 6d2431c7
      Mahmoud Aglan authored
      - Port backgammonjs-master rules to ES modules (standard, gul bara, tapa variants)
      - 3-tier bot AI (easy/medium/hard) with positional evaluation
      - Doubling cube with Crawford rule for match play
      - Canvas board renderer with piece stacking, hit/bear-off animations
      - Room scene with variant/length/difficulty selection
      - Full multiplayer via backgammon-match.php (queue, move, heartbeat, leave)
      - Realtime subscription for backgammon_matches table
      - Emote panel + phrase system (reuses Ludo pattern)
      - 7 new SFX slots in branding admin (dice, move, hit, bear, double, win)
      - Match system (first-to-N, gammon/backgammon scoring multipliers)
      - Wired into engine.js, play table, queue routing, match-session recovery
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      6d2431c7
    • Mahmoud Aglan's avatar
      feat: Ludo full overhaul — multiplayer modes, social, SFX · e4824004
      Mahmoud Aglan authored
      Phase 1 — Room/Mode Picker:
      - New ludo-room scene with menu, setup, and searching views
      - Player count picker (2/3/4 players)
      - Bot/human distribution selector (1 human + N bots, 2 humans + N bots, etc)
      - Bot difficulty picker (easy/medium/hard)
      - Seat preview showing diagonal (2P) or skip-corner (3P) positioning
      - Play table routes Ludo single/multi to the new room
      
      Phase 2 — Social Features:
      - Emote button (😄) in dice area opens full panel
      - 8 emoji reactions + 6 preset Arabic phrases
      - Emotes animate FROM the sender's player panel (speech bubble or floating emoji)
      - Bot emotes on captures use the new bubble system
      - Live mode emote transmission via mp.sendEmote
      - 3-second cooldown between sends
      
      Phase 3 — SFX Completion:
      - sfx_dice_shake: during dice animation roll
      - sfx_boost: rolling a 6 (extra turn excitement)
      - sfx_piece_home: piece reaches center
      - sfx_turn_start: your turn notification in live mode
      - sfx_emote: sending/receiving social actions
      - All new slots added to branding.php admin
      - Synthesized fallbacks in audio.js for each new sound
      
      Phase 4 — Multiplayer & Seat Mapping:
      - rules.createGame accepts seats array for board-slot mapping
      - 2-player = diagonal (Red vs Yellow), 3-player = skip Yellow
      - boardSlot property on each player drives position/color/captures
      - getPiecePosition/getHomeBasePosition use boardSlot not player index
      - Game-over condition: numPlayers-1 finishers (not hardcoded 3)
      - local-multi mode: multiple humans share one device, bots fill rest
      - Turn rotation correctly skips only finished players
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      e4824004
    • Mahmoud Aglan's avatar
      fix: domino tile placement — pip orientation + corner gaps + sizing · 512110c0
      Mahmoud Aglan authored
      - Add flipPips flag: when chain goes LEFT or UP, tile.left/right are
        drawn on the correct screen side (previously always left=left/top)
      - Fix corner turn offset: uses actual tile cross-axis extent instead
        of fixed TILE_H, preventing overlaps/gaps at corners
      - Increase TILE_W from 24→26 for better proportions (less squished)
      - Increase GAP slightly (1→2) so tiles don't visually merge
      - Lower auto-zoom min to 0.3 for large chains
      - Fix invalid hand tiles: use saturate(0.3)+brightness(0.85) instead
        of opacity+brightness that made them look solid dark gray
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      512110c0
    • Mahmoud Aglan's avatar
      feat: domino gameplay UI overhaul + fix animation origin · 38adbafe
      Mahmoud Aglan authored
      - Add fromPlayer param to animatePlacement (top for opponent, bottom for me)
      - Rewrite buildLayout with semantic .dg-* class structure
      - Full CSS for opponent bar, score ribbon, controls, board area
      - Opponent back-tiles visual with removal animations
      - Bot thinking indicator in opponent meta area
      - Remove dead legacy DOM elements
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      38adbafe
    • Mahmoud Aglan's avatar
    • Mahmoud Aglan's avatar
      feat: redesign domino UX — premium hand tiles, smart auto-fit, cohesive screens · 31a8e2dc
      Mahmoud Aglan authored
      Hand tiles (components/hand.js):
      - Proper PIP_POSITIONS matching board tiles (position-based, not flex-wrap)
      - Dynamic sizing: tiles scale to always fit viewport width
      - Fan layout for 5+ tiles (card-like spread with arc lift)
      - Slide-in animation for newly drawn tiles
      - Premium domino look: gradient bg, 3D pips, edge shine, realistic border
      
      Board (canvas/board.js):
      - Smooth animated auto-pan + auto-zoom when chain exceeds viewport
      - Lerp-based transitions (no jarring jumps on new tiles)
      - Vignette overlay for depth
      - Manual pan updates target state for smooth resume
      
      Tile renderer (canvas/tile-renderer.js):
      - Gradient fill (cream to warm), thicker border, top-edge shine
      - 3D pips with specular highlights
      - Better shadow depth and double-tile accent
      
      Drag proxy (components/drag.js):
      - Matches hand tile visual style (position-based pips)
      - Valid/invalid state with colored borders + glow
      - Spring animation on snap/bounce-back
      
      Room screens (scenes/room.js):
      - Unified design language across menu/bot-picker/target-picker/lobby
      - Floating icon animation, consistent card styles
      - Touch-responsive buttons with spring scale
      
      Game layout (scenes/game.js):
      - Polished opponent bar with avatar border glow
      - Score bar with colored indicators
      - Control buttons with active states and pulse animation
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      31a8e2dc
    • Mahmoud Aglan's avatar
      feat: add Ludo pawn sprites, sound effects & 25 emoji slots to branding · 9964877a
      Mahmoud Aglan authored
      - Add 4 Ludo pawn sprite upload slots (red/green/yellow/blue) to admin branding
      - Add 15 sound effect upload slots (mp3/ogg/wav) with audio preview
      - Add 25 missing emoji slots (crown, mute, block, hourglass, etc.)
      - Ludo game.js: draw custom pawn sprites with same bounce/highlight animation
      - Ludo game.js: pawn colors now respect branding ludo_red/green/yellow/blue
      - audio.js: plays custom audio files if uploaded, falls back to synthesized sounds
      - branding.php: support audio MIME types for Supabase storage upload
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      9964877a
    • Mahmoud Aglan's avatar
      feat: replace all system popups with 60fps in-game modals · d84fed77
      Mahmoud Aglan authored
      - Create core/modal.js — GPU-composited confirm/alert system with
        spring animations (scale + opacity on transform layer only)
      - Replace all 7 native confirm() calls across chess resign, ludo exit,
        domino resign, block user, remove friend, remove group member, leave group
      - Each modal has contextual icon, Arabic text, danger styling for destructive actions
      - Add will-change + backface-visibility GPU hints to all interactive elements
      - Add ease-in, ease-in-out timing tokens for complete animation coverage
      - All animations use transform + opacity only (never layout-triggering properties)
        ensuring consistent 60fps on mobile Safari and Chrome
      Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
      d84fed77
    • 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 6 commits