• Mahmoud Aglan's avatar
    feat: shared multiplayer module — opponent bar, synced emotes, disconnect, rematch, friend add · a220f7d0
    Mahmoud Aglan authored
    New core module: multiplayer.js
    Used by Chess, Ludo, Domino for all common multiplayer features:
    
    1. OPPONENT BAR:
       - Avatar, name, rating, level
       - Green/yellow/red connection dot
       - Tap → popup menu (view profile, add friend, report)
    
    2. SYNCED EMOTES:
       - sendEmote(matchId, type, key) → writes to game_state
       - checkForEmote(gameState, myId) → detects opponent's emote
       - onEmoteReceived(callback) → fires for UI to show floating emote
    
    3. CONNECTION STATUS:
       - Green dot = connected (< 15s since last opponent action)
       - Yellow dot = weak (15-60s)
       - Red dot = disconnected (> 60s → can claim win)
       - startDisconnectWatch / stopDisconnectWatch
    
    4. REMATCH:
       - requestRematch(matchId, type) → writes to game_state
       - checkForRematch(gameState, myId) → detects request
    
    5. FRIEND ADD:
       - addFriendFromGame(opponentId) → sends friend request
       - Accessible from opponent bar tap menu
    
    6. REPORT:
       - reportOpponent(opponentId, reason)
    
    All games can import { renderOpponentBar, sendEmote, ... } from 'core/multiplayer.js'
    Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
    a220f7d0
Name
Last commit
Last update
.claude Loading commit data...
Connections and docs Loading commit data...
admin Loading commit data...
api Loading commit data...
config Loading commit data...
docs Loading commit data...
includes Loading commit data...
public Loading commit data...
screenshots Loading commit data...
.gitignore Loading commit data...
.htaccess Loading commit data...
ARCHITECTURE.md Loading commit data...
ASSET_REGISTRY.json Loading commit data...
ASSET_REGISTRY.md Loading commit data...
BUILD_ORDER.md Loading commit data...
DATABASE_REFERENCE.md Loading commit data...
DESIGN.md Loading commit data...
Dockerfile Loading commit data...
PLAN.md Loading commit data...
Stockfishbotsapi.txt Loading commit data...
captain-definition Loading commit data...
index.php Loading commit data...