Felladrin's picture
Update README.md
baeb23a verified
---
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
```bash
# 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
1. **Selection** - Entities with higher fitness are more likely to reproduce
2. **Crossover** - Two parents combine their neural network weights
3. **Mutation** - Random Gaussian noise introduces variation
4. **Survival** - Less fit entities die; successful traits propagate
Over time, you'll observe emergent behaviors as entities adapt to the competitive environment.