Build a single-file, self-contained HTML5 Canvas simulation ...
Prompt
Build a single-file, self-contained HTML5 Canvas simulation of a living bioluminescent deep-sea ecosystem (zero external assets or libraries; pure HTML, CSS, and vanilla JS). ### 1. Visuals & Atmosphere - Deep abyssal background with a subtle vertical depth gradient, drifting "marine snow" (microscopic background particles), and soft radial light caustics near the top. - Use additive blending (`globalCompositeOperation = 'lighter'`) and layered radial gradients so every organism emits a genuine bioluminescent glow that illuminates nearby water. - Smooth 60fps animation with devicePixelRatio scaling so it looks razor-sharp on retina displays. ### 2. Three Species with Emergent Behavior - **Bioluminescent Plankton (Cyan/Teal):** - Drifts with ambient water currents and gently pulses in brightness. - Reproduces automatically when energy is high, capped by a local carrying capacity so it doesn't crash the browser. - **Lanternfish (Electric Blue/Gold):** - Uses full Boids flocking (separation, alignment, cohesion) plus steering toward nearby plankton and fleeing from jellyfish. - Rendered with a sleek body, glowing lure/spots, and a procedurally animated wagging tail that speeds up when fleeing. - **Evolution:** Each fish has inheritable traits (speed, size, sense radius) that slightly mutate when it reproduces after eating enough plankton. Color hue subtly reflects its traits. - **Abyssal Jellyfish (Magenta/Violet):** - Moves with a rhythmic pulsing bell contraction (burst of propulsion, then glide). - Features 5–7 procedurally animated trailing tentacles using Verlet integration or multi-segment spring chains that react realistically to movement and water currents. - Hunts lanternfish; if it starves for too long, it dissolves into a burst of nutrient-rich plankton. ### 3. Direct User Interactivity - **Left-click / hold:** Drop a cluster of glowing nutrient pellets that sink slowly and attract plankton/fish. - **Click & drag:** Stir the water, creating visible swirling fluid currents that push all organisms, marine snow, and jellyfish tentacles. - **Right-click (or toggle mode):** Spawn a new Jellyfish or a school of 10 Lanternfish at the cursor. - **Hover / Click an organism:** Highlight it and display a tiny floating inspector card showing its current energy, age, generation number, and mutated stats. ### 4. HUD, Analytics & Audio - **Minimal glassmorphic floating HUD** (collapsible so I can watch full-screen): - Live scrolling multi-line population graph (sparkline) tracking all three species over time. - Controls: Simulation Speed (0.5x, 1x, 2x, Pause), Mutation Rate slider, Water Temperature slider (affects metabolism & movement speed), and a "Reset Ecosystem" button. - One-click **Presets**: "Balanced Reef", "Predator Boom", and "Fast Evolution". - **Procedural Web Audio API soundscape** (muted by default with a toggle button): deep underwater ambient drone plus soft, pentatonic chime pings when fish reproduce or jellyfish pulse. Make sure the ecosystem is tuned so it doesn't immediately go extinct on launch—it should self-sustain in dynamic predator-prey cycles right out of the box.
A system prompt was added to support web rendering
Response not available