A modern, interactive 3D implementation of the classic Minesweeper game built with Three.js and Pixi.js.
- 3D Gameplay: Interactive 3D minefield with smooth camera controls
- Multiple Difficulties: Easy, Medium, and Hard difficulty levels
- Visual Effects:
- Animated mine explosions with particle effects
- Smooth camera-facing numbers with delayed animations
- Block reveal animations with elastic easing
- Flag placement with bouncing effects
- Win celebration with staggered mine reveals
- Node.js 16+
- npm or yarn
- Clone the repository:
git clone https://github.com/antonkorotkov/minesweeper-3d.git
cd minesweeper-3d- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser and navigate to
http://localhost:5173
npm run buildnpm run deploy- Start the Game: Select a difficulty level (Easy, Medium, or Hard)
- Reveal Blocks: Left-click on blocks to reveal them
- Place Flags: Right-click on blocks to place/remove flags
- Win Condition: Reveal all non-mine blocks
- Game Over: Clicking a mine triggers an explosion effect
- Left Click: Reveal a block
- Right Click: Place/remove flag
- Mouse Drag: Rotate camera view
- Scroll: Zoom in/out
- Three.js (v0.179.1): 3D rendering engine
- Pixi.js (v8.13.0): 2D UI overlay
- TypeScript (v5.8.3): Type-safe development
- Vite: Fast build tool and dev server
- TWEEN.js: Smooth animations
- Singleton Pattern: Resource management (materials, geometries, loaders)
- Event-Driven: Asset loading with nanoevents
- Component-Based: Reusable UI and 3D components
- Scene Management: Separate intro and game scenes with lifecycle methods
- Custom scene-based raycaster for block selection
- Hover detection with onMouseOver/onMouseOut callbacks
- Click prevention during camera drag
- Deep object traversal for interactive elements
- TWEEN.js for smooth animations
- Elastic easing for block reveals
- Quaternion interpolation for camera-facing numbers
- Particle system for mine explosions
- Directional light with shadow mapping
- Dynamic shadow camera configuration
- Shadow helpers for debugging
- Optimized shadow map size (2048x2048)
- Shared materials via singleton pattern
- Per-block material cloning for hover effects
- Dynamic material switching for game states
This project is open source and available under the MIT License.
- GitHub: @antonkorotkov
- Original Minesweeper game concept by Microsoft
- Three.js community for excellent 3D framework
- Pixi.js team for powerful 2D rendering
