Skip to content

fpidot/primordia

Repository files navigation

Primordia

A browser-based artificial-life simulation: per-particle evolving genomes + chemistry field + bonded-cluster organisms + tactile brushes. No build step, no backend, runs entirely on the visitor's GPU/CPU.

Run locally

python -m http.server 8765
# open http://localhost:8765/

Run tests

npm test

Field notes and user guide

CPU timing probe

npm run bench:cpu -- maze 1200 1500 0xC0FFEE

The CPU probe reports timing plus construction diagnostics (wallDigs, wallDeposits, and live wallCarriers) so builder regressions are easy to spot during performance work.

Browser timing probe

Start the local server first, then run:

npm run bench:browser -- maze 6 4
node tools/bench-browser.js maze 6 4 9230 --gpu
node tools/bench-browser.js --preset maze --seconds 8 --speed 4 --seed 0xC0FFEE --gpu

The browser probe launches Chrome/Edge through the DevTools protocol and reports FPS, sim ticks/sec, GPU availability, WebGPU readback timings, and adaptive GPU cooldown telemetry. Use --seed for CPU/GPU comparisons that start from the same preset state.

Preset population

The Presets panel includes an initial-population slider. Presets scale their starting population to that value, including zero-particle starts for terrain inspection or manual seeding.

Architecture

  • js/sim.js — particle pair-force, bond network, energy economy, wall types
  • js/brain.js — variable-size CTRNN controller, mutation, crossover
  • js/genome.js — gene encoding, mutation distributions, crossover
  • js/render.js — Canvas2D field + particle pass, wall rendering, camera
  • js/audio.js — vocalisation-driven synth voices + wall-action one-shots
  • js/lineage.js — clade tracker, complexity metrics
  • js/gpu_pairforce.js — WebGPU compute shader for pair-force + brain forward
  • tests/ — Node-runnable regression suite (deterministic seeded RNG)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors