A 3D maze generator and explorer built with Three.js, featuring procedurally generated mazes with first-person navigation.
- 3D Maze Generation: Procedurally generated mazes using recursive backtracking algorithm
- First-Person Navigation: Walk through the maze from a first-person perspective
- Movement Controls:
- W - Walk Forward
- S - Walk Backward
- A - Turn Left (90 degrees)
- D - Turn Right (90 degrees)
- Mouse - Look around by clicking and dragging
- Customizable Maze: Adjust maze size and wall height
- Real-time Rendering: Smooth 60 FPS navigation with shadows and lighting
- Collision Detection: Walls prevent walking through solid objects
- Open
index.htmlin a modern web browser - The maze will automatically generate and load
- Use the controls to navigate through the maze
- W - Move forward in the direction you're facing
- S - Move backward (opposite direction)
- A - Rotate 90 degrees left
- D - Rotate 90 degrees right
- Mouse Click + Drag - Look around by rotating the camera
- Mouse Release - Stop camera rotation
- Maze Size: Set the dimensions of the maze (5x5 to 20x20)
- Wall Height: Adjust the height of maze walls (1.0 to 5.0)
- Generate New Maze: Create a new random maze with current settings
- Reset Position: Return to the starting position
The maze uses a recursive backtracking algorithm to create a perfect maze (one path between any two points) with the following characteristics:
- Walls are placed on a grid system
- Paths are carved between walls
- Start and end points are guaranteed to be accessible
- No loops or unreachable areas
- Built with Three.js for WebGL rendering
- Dynamic lighting with shadows
- Fog effects for depth perception
- Responsive design that adapts to window resizing
- Optimized rendering with frame rate monitoring
- Efficient collision detection
- Smooth movement with delta-time based animation
- Chrome 60+
- Firefox 55+
- Safari 12+
- Edge 79+
Requires WebGL support for 3D rendering.
index.html- Main HTML file with UI controlsmaze.js- Core maze logic and Three.js renderingREADME.md- This documentation file
You can modify the maze generation by editing the following parameters in maze.js:
mazeSize- Default maze dimensionswallHeight- Default wall heightmoveSpeed- Player movement speedturnSpeed- Player rotation speed- Colors and materials for walls, floor, and lighting
Potential improvements could include:
- Multiple maze themes and textures
- Sound effects and ambient audio
- Mini-map or overhead view
- Multiple difficulty levels
- Save/load maze configurations
- Multiplayer support