I am going to inspect the project structure to see the existing files, dependencies, and configuration.
I will read package.json to check the installed packages and dependencies.
I will install three, @types/three, and lucide-react.
I will read index.html and src/index.css.
I will check src/index.css.
I will now set up the folder structure in src/engine and src/components.
Let's organize the codebase:
src/engine/types.ts - Core types (BlockType, ToolType, ChunkCoord, VoxelCoord, WorldPreset, GameMode, etc.)
src/engine/blocks.ts - Complete block definitions, properties, drops, tools, crafting recipes
src/engine/textures.ts - Procedural 16x16 pixel-art texture generator for all block faces, cracks, and item icons
src/engine/noise.ts - Fast 2D/3D Simplex & Perlin Noise implementation
src/engine/worldgen.ts - World generation algorithms (biomes, terrain height, 3D caves, ores, trees, flowers)
src/engine/chunk.ts - Chunk voxel storage, face-culling meshing with vertex Ambient Occlusion (AO)
src/engine/world.ts - Infinite/dynamic world chunk manager, chunk loading/unloading, voxel set/get, saving/loading
src/engine/physics.ts - Exact AABB vs Voxel grid collision detection and resolution
src/engine/player.ts - Player state, first-person controls, walking/sprinting/sneaking/jumping/swimming/flying, health/hunger
src/engine/raycast.ts - Fast Voxel Traversal (DDA) raycasting for block targeting and face normal detection
src/engine/particles.ts - Block break debris and TNT explosion particle physics
src/engine/audio.ts - Web Audio API procedural sound synthesizer (steps, digging, breaking, placing, explosions, ambient)
src/engine/sky.ts - Dynamic Day-Night celestial cycle, Sun, Moon, stars, dynamic directional/ambient lighting & fog
src/engine/hand.ts - First-person 3D animated player arm & tool/block renderer (bobbing, swinging)
src/components/HUD.tsx - Crosshair, Hotbar, Health/Hunger/Air bars, Breaking progress, Active item tooltip
src/components/InventoryModal.tsx - Creative block catalog with search + Survival 2x2 crafting table
src/components/SettingsModal.tsx - Render distance, FOV, sensitivity, graphics, sound volume, keybinds
src/components/WorldSelectModal.tsx - World presets (Plains, Mountain, Desert, Sky Islands, Flat), Seeds, Save/Load
src/components/DebugOverlay.tsx - Minecraft F3 screen (Coords, FPS, Biome, Direction, Chunk, Light)
src/components/TouchControls.tsx - Mobile virtual joystick and action buttons
src/components/PauseMenu.tsx - Escape menu with options and resume
src/App.tsx - Main integrated game canvas and state coordinator
Let's begin by creating src/engine/types.ts.
I will create src/engine/textures.ts to procedurally render all 16x16 pixel textures, generate the texture atlas and crack overlays with crisp NearestFilter.
I will fix the unused seed parameter in src/engine/textures.ts.
I will create src/engine/blocks.ts with all block and tool definitions, crafting recipes, and helper methods.
I will create src/engine/noise.ts for fast multi-octave 2D and 3D Perlin and Simplex noise.
I will create src/engine/worldgen.ts to implement terrain, biome blending, 3D caves, ores, trees, plants, and presets.
I will fix the noise function call in src/engine/worldgen.ts.
I will create src/engine/chunk.ts with voxel storage, face culling, Vertex Ambient Occlusion (AO), and transparent/plant mesh generation.
I will fix the typing of BLOCKS index in src/engine/chunk.ts.
I will create src/engine/world.ts to manage the multi-chunk infinite voxel world, dynamic loading, voxel operations, and LocalStorage persistence.
I will remove the unused key variable in src/engine/world.ts.
I will create src/engine/physics.ts to handle Axis-Aligned Bounding Box (AABB) voxel collision detection, step-up, sneaking ledge preservation, and sliding.
I will create src/engine/audio.ts with a fully procedural Web Audio API sound synthesizer.
I will remove the unused freq variable in src/engine/audio.ts.
I will create src/engine/sky.ts to implement dynamic day-night cycle, sun, moon, twinkling stars, directional lighting, and dynamic atmospheric fog.
I will create src/engine/raycast.ts for voxel DDA raycasting.
I will create src/engine/particles.ts to manage physics particle bursts for block breaking and explosions.
I will fix the material property in src/engine/particles.ts.
I will create src/engine/tnt.ts to manage active ignited TNT entities, flashing fuse animation, crater creation, and explosion mechanics.
I will create src/engine/hand.ts to implement the first-person animated arm, held 3D block/tool rendering, idle and walking bobbing, and click/punch animations.
I will remove the unused BLOCKS import in src/engine/hand.ts.
I will create src/engine/player.ts to manage player movement, controls, mouse look, mining/placing logic, survival stats, and interaction.
I will create src/components/HUD.tsx with the crosshair, active slot tooltip, 9-slot hotbar with pixel icons, survival hearts/hunger/air bars, and mining progress.
I will fix the unused variables in src/components/HUD.tsx.
I will update the destructured props in src/components/HUD.tsx.
I will create src/components/InventoryModal.tsx with the Creative catalog, category filters, search, Hotbar slot editor, and 2x2 Crafting Grid.
I will create src/components/SettingsModal.tsx for configuring game settings, audio levels, render distance, FOV, and controls.
I will create src/components/WorldSelectModal.tsx for world generation, presets, seed selection, and world save/load.
I will create src/components/DebugOverlay.tsx to render the F3 debug screen.
I will create src/components/PauseMenu.tsx for the pause menu overlay.
I will create src/components/TouchControls.tsx to support touch and mobile gameplay.
I will update index.html to set the title and favicon.
I will update src/index.css to style the full-screen canvas and disable text selection and pull-to-refresh on mobile.
I will create src/App.tsx containing the game loop, Three.js canvas integration, controls, state management, and modal coordination.
I will remove the unused React import in src/App.tsx.
I will test the build using build_project.
I have built the browser-based Minecraft-style 3D voxel game using React, Three.js, and Tailwind CSS.
Summary of Features Implemented:
-
Procedural 3D Voxel World & Biomes:
- Multi-octave 2D and 3D Simplex noise terrain generation with dynamic heightmaps and 3D cave tunnels.
- Distinct biomes: Plains, Dense Forests, Extreme Mountain Peaks, Desert Dunes, and Ocean/Lake basins with sand beaches.
- Underground geology: Indestructible Bedrock at the base, Stone layers, and depth-stratified ore veins (Coal, Iron, Gold, Redstone, Diamond, Emerald).
- Natural vegetation: 3D Oak wood trunks with spherical leaf canopies, desert cacti, poppies, and dandelions.
- World Presets: Default Biomes, Extreme Mountains, Desert Dunes, Floating Sky Islands, and Superflat Sandbox with customizable/randomizable world seeds.
-
Chunk Management & Optimized Meshing:
- Chunk-based voxel storage (
Uint8Array 16×64×16) with dynamic loading/unloading around the player.
- Face-culling quad generation that only renders visible faces between solid and air/transparent blocks.
- Vertex Ambient Occlusion (AO) computed across neighboring block corners for rich corner shadows and depth.
- Separate alpha-tested/translucent render passes for water ripples, glass blocks, and plant billboard cross-quads.
-
Authentic 16×16 Pixel Art Textures:
- Fully procedural canvas-generated texture atlas with
NearestFilter for crisp, pixel-perfect Minecraft aesthetics.
- High-fidelity textures for all block faces (Grass top/side/bottom, Logs, Leaves, Planks, Bricks, Bookshelves, TNT with pixel label, Ores, Glowstone, Crafting Tables, Furnaces, Cracks 0–9, and Tool icons).
-
First-Person Controls & Physics:
- Pointer Lock mouse look with configurable sensitivity and crosshair.
- WASD movement (Walking, Sprinting, Sneaking with edge-fall protection).
- Realistic voxel gravity and swept AABB collision detection/resolution against blocks (smooth wall sliding and step-up).
- Water swimming physics (buoyancy, drag, underwater camera tint, and air bubble gauge).
- Creative flight mode (toggled via double Space or
F key).
-
Block Mining, Placing & TNT Explosions:
- Fast Voxel DDA traversal raycasting for accurate targeted block detection and face normal detection.
- Targeted block wireframe highlight and progressive crack stage overlays (0–9).
- Mining hardness & tool efficiency calculation (Pickaxes for stone/ores, Axes for wood, Shovels for dirt/sand).
- Block break particle bursts with physics velocity and rotation.
Files built: src/engine/types.ts, src/engine/textures.ts, src/engine/blocks.ts, src/engine/noise.ts, src/engine/worldgen.ts, src/engine/chunk.ts, src/engine/world.ts, src/engine/physics.ts, src/engine/audio.ts, src/engine/sky.ts, src/engine/raycast.ts, src/engine/particles.ts, src/engine/tnt.ts, src/engine/hand.ts, src/engine/player.ts, src/components/HUD.tsx, src/components/InventoryModal.tsx, src/components/SettingsModal.tsx, src/components/WorldSelectModal.tsx, src/components/DebugOverlay.tsx, src/components/PauseMenu.tsx, src/components/TouchControls.tsx, index.html, src/index.css, src/App.tsx