Extinction Protocol(arena)
Act as an expert WebGL game developer. Write a complete, fully functional, 3D Third-Person Shooter game in a single HTML file using Three.js. The game should have a dark, philosophical atmosphere (inspired by Death Stranding) but styled as a PS1 demake (pixelated rendering, lo...
Act as an expert WebGL game developer. Write a complete, fully functional, 3D Third-Person Shooter game in a single HTML file using Three.js. The game should have a dark, philosophical atmosphere (inspired by Death Stranding) but styled as a PS1 demake (pixelated rendering, low-poly primitive shapes, thick fog). **Technical Constraints:** - STRICTLY ONE FILE: All HTML, inline CSS, and inline JavaScript must be in one file. - NO EXTERNAL ASSETS: Do not use external images, 3D models (.gltf/.obj), or audio files (.mp3/.wav). - Use Three.js primitives (Box, Cylinder, Dodecahedron) grouped together to build all models. - Generate procedural textures using HTML5 Canvas inside the code. **Visuals & UI:** - PS1 aesthetic: image-rendering: pixelated; no anti-aliasing. - Include a retro HUD showing: Score, Wave number, "Cargo Packs" (Health), Weapon Name, and Grenade count. - Implement an on-screen target lock-on reticle that snaps to enemies near the center of the screen. - Include a Boss HP Bar that appears during boss fights. **Player Mechanics & Controls:** - The player model is a low-poly figure with a mechanical arm that dynamically switches between 4 weapons: Pistol, Assault Rifle, Minigun (with spinning barrels), and Rocket Launcher. - The player has a shoulder-mounted "Odradek" scanner. When activated, it emits a blue pulse and shows an x-ray wireframe outline of enemies through walls. - PC Controls: WASD to move, Mouse to look (using PointerLock API), Left-click to shoot, Right-click to throw blood grenades, 'Q' to scan, 1-4 to switch weapons. - Mobile Controls: Ensure mobile support with a virtual joystick (bottom left) for movement, touch-drag anywhere for camera rotation, and 4 on-screen action buttons (Fire, Grenade, Scan, Swap). **Enemies & Bosses:** - Implement a wave-based system. - Normal enemies: Bipedal dark phantoms that leave footprints and drop tar. - Boss 1: Tar Lions (ensure their head/body model faces forward towards the direction of movement, not backward). - Boss 2 & 3: Floating Squids and Whales that drop bombs/projectiles. - Final Boss: A massive "Tar Walker" that spawns on wave 5. It should have destructible limbs (Arms, Legs, Head) with separate HP pools and shoot sweeping lasers. - When enemies die, they disintegrate into particles and drop collectable "Chiral Gold" crystals. **Environment:** - A wide plane with scattered hexagonal rock pillars. - Dynamic "Tar Ponds" that grow on the ground and spawn enemies. - Tar Flood event: On wave 5, the ground turns black and the sky turns red. - Victory Sequence: Upon beating the final boss and collecting the final crystals, the tar recedes, the ground turns green (grass), the sky turns blue, and low-poly trees and buildings procedurally rise from the ground. **Audio Engine (Web Audio API):** - Build a custom Sfx object using the `AudioContext` API to synthesize all sounds (no external files). - Include a Mute/Unmute toggle button in the top left corner of the UI. - Synthesize the following specific sounds: 1. Shooting (different oscillator pitches/waveforms for pistol, AR, minigun, and rockets). 2. Deep, filtered noise for Explosions (grenades/rockets). 3. A high-pitched, resonant sonar "ping" for the Odradek scan. 4. Harsh square-wave sounds for enemy death and damage taken. 5. Sine-wave sweeps for enemy attacks (lasers/bombs). 6. A triumphant arpeggio sequence for the victory screen. Ensure the code is clean, fully runnable, and beautifully structured. Provide the output in a single block of HTML code.