Skip to content

tre-systems/evo

Repository files navigation

Evolution Simulation

A beautiful and performant evolution simulation written in Rust with WebGPU-accelerated graphics and WebAssembly, running entirely in the browser.

Live: evo-dgc.pages.dev — needs a WebGPU-capable browser (Chrome / Edge / Brave 113+). Each load picks a random seed (logged to the console); enter a seed in the UI to reproduce or share a run.

Evolution Simulation Screenshot

Quick Start

Prerequisites

  1. Rust Nightly: rustup toolchain install nightly-2024-08-02
  2. WASM Target: rustup target add wasm32-unknown-unknown
  3. Node.js & npm: Install Node.js
  4. WebGPU-capable browser: Chrome 113+, Firefox 121+, or Safari 17.4+

Installation

# Install dependencies and set up environment
npm run setup

Running

npm run dev
# Then open http://localhost:8788

Deployment

Deploy to Cloudflare Pages:

npm run deploy

For detailed instructions, see docs/DEPLOYMENT.md.

Development

Project Structure

evo/
├── src/
│   ├── components.rs     # ECS components
│   ├── genes/            # Genetic algorithms
│   ├── systems/          # Movement, Interaction, Reproduction
│   ├── simulation/       # Main simulation logic
│   └── web/              # WebGPU renderer
├── web/                  # Frontend assets (HTML, CSS, JS)
└── scripts/              # Build scripts

Key Commands

Command Description
npm run dev Start local dev server
npm run build Compile to WASM
npm run deploy Build and deploy to Cloudflare Pages
cargo test Run Rust tests
cargo clippy Run linter

Documentation

  • Architecture — how the code is organized and how a frame is produced
  • Diagrams — Graphviz architecture diagrams (system overview, simulation tick)
  • Simulation System — genes, movement styles, predation, and statistics
  • Deployment — Cloudflare Pages and the SharedArrayBuffer header requirement
  • Backlog — ordered next work and known constraints
  • Agent Notes — workflow, verification, and architecture rules for agents

License

MIT License.