A browser-based 3D ant colony simulation sandbox built with Three.js. Watch ants interact, forage, and survive in a dynamic environment that can overlay any Wikipedia page.
- Three Ant Species: Black, Red, and Brown ants, each with unique stats for speed, strength, and health.
- Predator AI: A tarantula that stalks ants with realistic burst movement and hunting behavior.
- Individual Variation: Each ant has unique size, color tint, and speed variations for a more organic feel.
- Interactive Tools: Use tools to Observe, Swat (kill), Feed (place sugar), Draw Pheromones, or Place Rocks.
- Advanced Tuning: A parameter panel with presets (Simulation, Balanced, Fun) to control every aspect of the colony.
- Dynamic Background: Ants crawl over a live Wikipedia iframe, which you can change to any URL.
- Priority-based Wander:
WANDERuses fixed priorities (sugar -> corpse -> neighbor interaction -> pheromone -> ACO wander). - Carry Return Fallback: Carrying ants use trail backtracking + obstacle probes + 45-degree scan fallback.
- Anti-loop Safety: Short tabu-style memory and deadend pheromones reduce ant-mill loops.
- Tour Reinforcement: Successful sugar return reinforces the completed forage trail with
Q/Lstyle pheromone updates.
- Organic Movement: Perlin noise wandering, acceleration curves, and body bobbing animations.
- Visual Effects: Pheromone trail visualization, dust particles, and death animations.
- Spatial Audio: Sound effects powered by the Web Audio API.
- Zero Dependencies: Runs entirely in the browser using vanilla JavaScript and Three.js via CDN.
- No Build Step: Just open the HTML file and play.
- Multi-language: Supports English, Japanese, and Chinese via URL parameters (e.g.,
?lang=ja).
- Clone this repository or download the source code.
- Open
index.htmldirectly in any modern web browser.
Alternatively, use a local server:
npx serve .index.html: Main entry point and UI structure.src/js/: Core simulation logic and Three.js implementation.src/css/: UI styling and layout.
- This is a single-file simulation core (
src/js/simulation.js) with runtime tuning. npm testis currently a placeholder script (no automated tests configured yet).
This project is licensed under the MIT License. See the LICENSE file for details.