All MicroEvals
### Role & Objective Act as a Principal Graphics & Game Engi...
Create MicroEval

### Role & Objective Act as a Principal Graphics & Game Engi...

Prompt

### Role & Objective Act as a Principal Graphics & Game Engine Engineer. Build a complete, fully playable, high-visual-quality 3D voxel sandbox game ("WebCraft") that runs smoothly in a modern web browser. ### Technical Stack & Architecture - **Core:** HTML5, Vanilla JavaScript (ES6+ Modules) or TypeScript, Three.js (latest via CDN or Vite setup). - **Architecture:** Strict separation of concerns across modular files (`index.html`, `main.js`, `world.js`, `chunk.js`, `mesher.js`, `player.js`, `textures.js`, `audio.js`, `ui.js`). Do NOT dump everything into one truncated script. Provide the complete, runnable code for every file with zero placeholders or `// TODO` comments. ### 1. World Generation & Rendering Performance (60+ FPS Target) - **Chunk System:** 16×128×16 chunks loaded dynamically around the player with a configurable render distance (default: 8 chunks) and distance fog blending seamlessly into the sky. - **Terrain Gen:** Multi-octave 2D/3D Simplex/Perlin noise generating distinct biomes (Plains, Desert, Snowy Peaks, Forest) with caves, ores, water level (`y = 32`), and procedural trees. - **Mesh Optimization:** Implement **face culling** (never render faces adjacent to opaque solid blocks) and **ambient occlusion (per-vertex AO)** baked into vertex colors for realistic block-corner shading. - **Instanced / Merged Geometry:** Use a single merged `BufferGeometry` per chunk (separate transparent pass for water/leaves/glass) mapped to a single procedural texture atlas. ### 2. "Max Quality" Visuals & Shaders - **Procedural PBR Texture Atlas:** Generate crisp, high-detail 32×32 pixel-art diffuse, normal, and roughness maps procedurally on an offscreen HTML5 `<canvas>` (Grass, Dirt, Stone, Cobblestone, Oak Log, Planks, Leaves, Sand, Water, Glass, Glowstone, Coal/Diamond Ore). - **Lighting & Atmosphere:** - Real-time directional sun/moon lighting with soft PCF shadow maps (`PCFSoftShadowMap`) and dynamic day/night cycle (sky gradient shader, moving sun/moon, twinkling stars at night). - Voxel flood-fill light propagation so torches/glowstone cast warm point light inside dark caves. - Animated water shader (scrolling UV normal distortion, Fresnel reflection, semi-transparency). - Post-processing pipeline (`EffectComposer`): subtle Bloom on emissive blocks (glowstone/lava/sun) and ACES Filmic tone mapping. ### 3. Physics, Controls & Full Playability - **Player Controller:** PointerLock first-person camera (`WASD` move, `Space` jump, `Shift` sprint, `C` crouch/sneak without falling off edges, `F` toggle creative flight). - **AABB Collision:** Swept/axis-separated Axis-Aligned Bounding Box collision against the voxel grid (prevent wall clipping, smooth step-up or jumping, swimming physics with buoyancy and underwater blue fog tint). - **Block Interaction:** Fast voxel raycasting (DDA algorithm, max reach 6 blocks) with a crisp wireframe highlight box around the targeted block face. - **Left-Click (Hold):** Progressive block breaking with animated crack overlay texture and particle burst on break. - **Right-Click:** Place block on targeted face normal (prevent placing inside player's own AABB). - **Game Modes & Inventory:** - Toggle between **Survival** (health/hunger bars, fall damage, block mining times, item drops that bob/spin and magnetize to the player) and **Creative** (instant break, infinite blocks, flight). - Interactive 9-slot hotbar (`1–9` keys + scroll wheel) and `E` key inventory/crafting grid (basic 2×2 crafting recipes: Logs → Planks → Sticks/Crafting Table/Torches). ### 4. Procedural Web Audio - Synthesize crisp sound effects using the Web Audio API (no external MP3 dependencies): footsteps varying by block material (grass, stone, sand, wood), block break/place pops, water splash, and ambient wind. ### Output Instructions 1. Start with the exact folder structure and setup instructions (zero-build `npx serve` or Vite). 2. Output the **complete, unabridged code** for every file sequentially. 3. Verify that all imports, Three.js shader chunks, and event listeners are bug-free and ready to run immediately.

A system prompt was added to support web rendering

Response not available

Drag to resize