-
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:Claude Opus 4.6 <noreply@anthropic.com>
a220f7d0
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| assets/brand | ||
| css | ||
| icons | ||
| js | ||
| uploads/theme |