Skip to content

SYBIOTE/Minesweeper-Web-Spatial

Repository files navigation

๐ŸŽฎ WebSpatial 3D Minesweeper

A next-generation 3D Minesweeper game designed for Apple Vision Pro using WebSpatial SDK

Apple Vision Pro WebSpatial React TypeScript

๐ŸŒŸ Overview

Experience the classic Minesweeper game reimagined for spatial computing! This immersive 3D version brings volumetric gameplay to Apple Vision Pro, featuring intelligent environment detection, adaptive UI, and seamless transitions between 2D and 3D modes.

โœจ Key Features

  • ๐Ÿ•ถ๏ธ Apple Vision Pro Native: Built specifically for spatial computing with WebSpatial SDK
  • ๐ŸŽฏ True 3D Gameplay: Navigate volumetric minefields with 26-neighbor logic
  • ๐Ÿ”„ Adaptive Modes: Automatic 2D/3D mode switching based on environment
  • ๐ŸŽจ Pixel Art Design: Retro-inspired visual style with modern spatial interactions
  • โšก High Performance: Optimized rendering with instancing and LOD systems
  • ๐ŸŽต Audio Ready: Complete sound system configuration (implementation ready)

๐Ÿš€ Quick Start

Prerequisites

  • Apple Vision Pro (recommended) or modern web browser
  • Node.js 18+ and pnpm
  • WebSpatial Developer Account (for deployment)

Development Setup

# Clone the repository
git clone https://github.com/yourusername/Minesweeper-Web-Spatial.git
cd Minesweeper-Web-Spatial

# Install dependencies
pnpm install

# Start development server
pnpm dev

# For Apple Vision Pro development
pnpm dev:avp

WebSpatial Deployment

# Build for WebSpatial platform
pnpm build:avp

# Deploy to WebSpatial (requires .env.local configuration)
pnpm publish:avp

๐ŸŽฎ How to Play

๐ŸŽฏ Game Modes

๐Ÿ–ฅ๏ธ Normal Browser Mode

  • Automatically detects regular browsers
  • Forces 2D flat grid gameplay (11ร—11 grid)
  • Optimized touch and mouse interactions

๐Ÿ•ถ๏ธ Apple Vision Pro Mode

  • Detects WebSpatial environment automatically
  • True 3D volumetric grids (3ร—3ร—3 to 7ร—7ร—7)
  • Toggle between 2D and 3D modes
  • Spatial gesture support

๐Ÿ“Š Difficulty Levels

Difficulty Grid Size Mines Total Cells Density
Beginner 3ร—3ร—3 2 27 7.4%
Intermediate 5ร—5ร—5 10 125 8.0%
Expert 7ร—7ร—7 30 343 8.7%
Flatscreen 11ร—11ร—1 20 121 16.5%

๐Ÿ–ฑ๏ธ Controls

  • Left Click/Tap: Reveal cell
  • Right Click/Long Press: Toggle flag
  • Middle Click/Double Tap: Chord click (reveal neighbors)
  • Flag Mode Toggle: Switch interaction modes
  • Reset: Start new game
  • Exit: Return to main menu

๐Ÿ—๏ธ Architecture

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ ๐ŸŽฎ game/
โ”‚   โ””โ”€โ”€ MinesweeperGame.ts     # Core 3D game logic
โ”œโ”€โ”€ ๐Ÿงฉ components/
โ”‚   โ”œโ”€โ”€ GameController.tsx     # React game integration
โ”‚   โ”œโ”€โ”€ Volume3D.tsx          # 3D spatial rendering
โ”‚   โ””โ”€โ”€ common/               # Shared UI components
โ”œโ”€โ”€ ๐Ÿ“ฑ pages/
โ”‚   โ”œโ”€โ”€ GameStartScene.tsx    # Main menu scene
โ”‚   โ””โ”€โ”€ MinefieldPage.tsx     # Game scene
โ”œโ”€โ”€ ๐ŸŽจ assets/
โ”‚   โ””โ”€โ”€ svgs/pixels/          # Pixel art icon system
โ”œโ”€โ”€ โš™๏ธ AppConfig.ts           # Game configuration
โ””โ”€โ”€ ๐Ÿ—บ๏ธ Router.tsx             # WebSpatial routing

๐Ÿ› ๏ธ Tech Stack

Core Technologies

  • React 19 - Modern UI framework
  • TypeScript - Type-safe development
  • WebSpatial SDK - Apple Vision Pro integration
  • Three.js - 3D graphics (via React Three Fiber)
  • Vite - Fast build system

Spatial Computing

  • @webspatial/core-sdk - Core WebSpatial functionality
  • @webspatial/react-sdk - React WebSpatial components
  • @react-three/fiber - React Three.js renderer
  • @react-three/drei - Three.js helpers
  • @react-three/xr - XR/VR support

Development Tools

  • ESLint - Code linting
  • Prettier - Code formatting
  • TypeScript - Static type checking

๐Ÿ”ง Configuration

Environment Variables (.env.local)

# WebSpatial Configuration
XR_DEV_SERVER=your-dev-server
XR_PRE_SERVER=your-pre-server  
XR_PROD_SERVER=your-prod-server
XR_BUNDLE_ID=your-bundle-id
XR_TEAM_ID=your-team-id
XR_VERSION=1.0.0
XR_DEV_NAME=your-dev-name
XR_DEV_PASSWORD=your-dev-password

Game Configuration (AppConfig.ts)

The game supports extensive customization:

  • ๐ŸŽฏ Difficulty Settings: Grid dimensions, mine counts, density calculations
  • ๐ŸŽจ Visual Theming: Colors, animations, lighting effects
  • โš™๏ธ Game Mechanics: Auto-reveal, first-click safety, chord clicking
  • ๐Ÿ”Š Audio System: Sound effects, volume controls (ready for implementation)
  • โšก Performance: Rendering optimizations, LOD, frustum culling

๐ŸŽจ Features Deep Dive

๐Ÿ” Environment Detection

const isSpatial = navigator.userAgent.includes('WebSpatial') || 
                  import.meta.env.XR_ENV === 'avp'

๐ŸŽฏ Smart Mine Generation

  • First-click safety ensures first cell is never a mine
  • Balanced distribution with configurable density
  • 3D neighbor calculation (up to 26 neighbors per cell)

๐ŸŽฎ Adaptive UI

  • Browser: Fixed 2D mode with touch optimization
  • Vision Pro: Full 3D with mode toggle and spatial gestures
  • Responsive scaling for different viewport sizes

โšก Performance Optimizations

  • Instanced rendering for large 3D grids
  • Level of Detail (LOD) for distant elements
  • Frustum culling to render only visible cells
  • React optimizations with memoization and careful re-renders

๐Ÿ“ฑ WebSpatial Integration

This game leverages WebSpatial's full feature set:

  • ๐Ÿ–ผ๏ธ Scene Management: Multi-window spatial scenes
  • ๐ŸŽฏ Environment Detection: Automatic platform optimization
  • ๐Ÿ“ Spatial Rendering: Native 3D positioning and scaling
  • ๐Ÿ–ฑ๏ธ Interaction Handling: Gesture and touch event processing
  • ๐Ÿ”ง Build Pipeline: Integrated development and deployment tools

๐Ÿค Contributing

We welcome contributions! Please see our contributing guidelines for:

  • ๐Ÿ› Bug Reports: Issue templates and debugging info
  • โœจ Feature Requests: Enhancement proposals
  • ๐Ÿ”ง Pull Requests: Code contribution guidelines
  • ๐Ÿ“š Documentation: Help improve our docs

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Apple - For Vision Pro and spatial computing innovation
  • WebSpatial - For the excellent spatial development SDK
  • React Team - For the amazing React framework
  • Three.js - For powerful 3D graphics capabilities

๐Ÿš€ Ready to experience Minesweeper in a whole new dimension?

Built with โค๏ธ for the future of spatial computing

About

a volumetric implementation of the classic minesweeper in 3D for in webspatial

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors