Obsidian Chess | 3D HTML5 Multiplayer Game
Version 1.0 | Three.js r128 | AI Minimax with Alpha-Beta Pruning | Online PVP via Firebase
Game Modes
- VS AI – Three difficulty tiers (Easy / Medium / Hard)
- Two Players – Local play on one device
- Online PVP – Real-time multiplayer via Firebase Realtime Database. Quick Match auto-pairs players. Create or join private rooms using a 6-character code. In-game chat included.
AI Difficulty
- Easy – Shallow depth + randomized move ordering
- Medium – Balanced depth + full heuristic evaluation
- Hard – Maximum depth + tight alpha-beta cutoffs
Board Themes (8 + Custom Builder)
- Obsidian (free) / Classic (free) / Forest / Ocean / Royal / Ember / Arctic / Night
- Custom Theme Builder – Live preview, 5 color pickers (light squares, dark squares, background, panels, accent)
- Themes above Classic are unlocked with in-game coins earned through gameplay or reward ads
Coin & Economy System
- Earn coins by winning games vs AI or Online PVP – stored locally, no account needed
- Daily bonus of 15 coins awarded automatically on first session each day
- Win reward: 50 coins per victory. Watch a voluntary reward ad for +10 coins instantly.
- Hint Button – Costs 5 coins. Highlights the best available move on the 3D board for 2.2 seconds. Available in VS AI mode only.
- Spend coins to unlock premium board themes from the in-lobby or in-game theme store
Online PVP Features
- Quick Match – Atomic Firebase transaction matchmaking. Works even when both players connect at the exact same moment.
- Create Room – Generate a 6-character code and share with a friend
- Join Room – Enter a friend’s code to connect directly
- In-Game Chat – Real-time messaging panel during the match
- Turn Timer – 10-second countdown per turn. Auto-moves if time runs out. Only the active player’s client runs the timer to prevent desync.
- Disconnect Detection – Opponent going offline is detected via Firebase presence and handled gracefully
- Display Names – Random or custom player names shown in the HUD during the match
- Coin Rewards – Online wins award 50 coins on the winner’s device only
Chess Rules
- Full legal-move validation: pins, checks, discovered attacks
- Castling (kingside & queenside) with correct invalidation rules
- En passant capture
- Pawn promotion – interactive modal (Queen / Rook / Bishop / Knight)
- Check, Checkmate, and Stalemate detection
- 50-Move Rule and Threefold Repetition draws
- Insufficient Material detection (K vs K, K+N vs K, K+B vs K)
- Algebraic notation move log (e.g. Nf3, O-O, exd5+) displayed in the sidebar
- Captured pieces displayed per side in the sidebar
- Undo – steps back one half-move (or two in AI mode, to restore the player’s turn)
Controls
- Click / Tap – Select piece, then click highlighted square to move
- Drag – Orbit the 3D board freely
- Scroll / Pinch – Zoom in and out
- Escape – Pause / Resume (also closes Settings overlay)
- Hint Button – Flash best move on board (costs 5 coins, VS AI only)
Overlay & UI System
- Pause, Resign Confirm, Pawn Promotion, Game Over, Unlock Theme, Pre-game Countdown
- Zero native browser popups – all custom HTML overlays throughout
- Animated lobby screen transitions with page-enter / page-exit effects
- Light Mode toggle – switches to a warm parchment lobby aesthetic
- Asset pre-load screen with live progress bar and status messages
Advertisement System
- Pre-game ad – Shown automatically before every match starts (VS AI, Local PVP, and Online PVP). Player watches 5 seconds and earns +2 coins, then a 3-second countdown begins the game.
- Voluntary reward ad – Triggered manually from the lobby coin badge or Earn More button. Player watches 5 seconds and earns +10 coins.
- Both ad overlays use matching warm lobby chrome – fully consistent visual design
- Placeholder sized to Google AdSense 300×250 Medium Rectangle standard – ready for integration
Tech Stack
- Three.js r128 (3D rendering, WebGL, PCF soft shadow maps)
- OrbitControls for drag-to-orbit and pinch-to-zoom
- Web Audio API – all sounds synthesized in-browser, no audio files required
- CSS Custom Properties (theme tokens for live board color switching)
- ES2015+ JavaScript (IIFE-scoped modules, no global leaks)
- Firebase Realtime Database (loaded on demand for Online PVP only, not on page load)
- requestAnimationFrame render loop with damped OrbitControls
- LocalStorage for coins, unlocked themes, player name, and preferences
Requirements
- Chrome / Firefox / Safari / Edge / Opera (Latest)
- Internet connection required for Online PVP and Firebase
- No build step – open index.html directly or deploy to any static host
- WebGL support required for 3D board rendering