metadata
title: Digital Life Evolution Simulator
emoji: π§¬
colorFrom: blue
colorTo: red
sdk: static
pinned: false
short_description: A self-evolving ecosystem that runs entirely in the browser
Digital Life Evolution Simulator
A self-evolving AI ecosystem where autonomous entities compete, reproduce, and adapt through neural networks and genetic algorithms. Watch digital life emerge and evolve in real-time.
What It Does
This simulation creates a population of AI entities with unique genomes that control their behavior through neural networks. Each entity:
- Perceives its environment (food, energy, other entities)
- Decides actions based on neural network processing
- Adapts through natural selection - successful traits get passed to offspring
- Evolves over generations as mutations introduce variation
Four entity types exist:
- Gatherers - Collect food and energy efficiently
- Predators - Hunt and consume other entities
- Builders - Create structures and territorial markers
- Explorers - Scavenge and discover new resources
Quick Start
# Start a local server
npx serve .
# or
python3 -m http.server 8000
# Open in browser
http://localhost:8000
Features
- Neural Network AI - Each entity has a unique brain with 80+ configurable parameters
- Genetic Algorithm - Reproduction with crossover and mutation
- Spatial Awareness - Efficient spatial hashing for proximity detection
- Real-time Stats - Track population, generations, fitness, and neural activity
- Visual Feedback - See neural network activations while watching decisions
Tech Stack
- Pure vanilla JavaScript (ES2022 modules)
- HTML5 Canvas rendering
- No build step, no dependencies
Project Structure
js/
βββ ecosystem.js # Main loop, initialization
βββ world.js # Environment, resource spawning
βββ entities.js # Entity behavior logic
βββ entityManager.js # Lifecycle management
βββ genetics.js # Genome creation, reproduction
βββ neuralNetwork.js # AI decision-making
βββ particles.js # Visual effects
βββ stats.js # Performance telemetry
βββ ui.js # Controls, event logs
βββ utils.js # Math, object pools, spatial grid
How Evolution Works
- Selection - Entities with higher fitness are more likely to reproduce
- Crossover - Two parents combine their neural network weights
- Mutation - Random Gaussian noise introduces variation
- Survival - Less fit entities die; successful traits propagate
Over time, you'll observe emergent behaviors as entities adapt to the competitive environment.