PolyEvolve Lab is an open-source creature locomotion evolution sandbox built with JavaScript, Planck.js physics, and a custom neuroevolution stack.
It supports:
- real-time normal simulation
- high-throughput turbo training in Web Workers
- dense and NEAT-style controller evolution
- replay/diagnostics tooling for iterative tuning
This project is focused on evolutionary locomotion under physics constraints:
- creatures are built from nodes, bones, muscles, and optional polygon body parts
- neural controllers drive muscle actuation
- generations are selected by distance-first fitness under configurable constraints
The emphasis is experimental iteration and observability, not framework-heavy app architecture.
- Engine:
planck-js - Units:
SCALE = 30px/m - Fixed-step simulation in both normal and turbo modes
- Creature structures:
- nodes (dynamic circle bodies)
- bones (distance joints)
- muscles (prismatic joints with actuator control)
- optional polygon bodies connected via joints
Key files:
src/sim/Physics.jssrc/sim/Creature.jssrc/sim/Simulation.js
- Muscles are controlled by neural outputs with smoothing/rate limiting
- Ground interaction is contact-driven
- Near no-slip grounded behavior is available to suppress drag-snap ratchet exploits
Related config:
src/utils/config/muscle.jssrc/utils/config/physics.js
Two controller families are supported:
- Dense feed-forward (
legacymode) - NEAT-style topology evolution (
neatmode)
Evolution operations include selection, crossover, mutation, and architecture/genome tracking.
Key files:
src/nn/Evolution.jssrc/nn/TopologyNeuralNetwork.jssrc/nn/neat/*src/nn/runtime/*
Shared score logic is centralized so normal and turbo remain consistent.
Core scoring file:
src/sim/fitnessScore.js
Primary objective is distance progression with additional penalties/bonuses as configured.
- Main-thread simulation and rendering
- Full per-frame creature visualization
- Off-thread generation evaluation via workers
- Designed for fast generation throughput
- Parity safeguards and diagnostics to track divergence risk
Key files:
src/sim/TurboCoordinator.jssrc/sim/TurboWorker.jssrc/sim/Simulation.js
- Right-side controls panel for runtime tuning
- HUD and charting for progress/training health
- Diagnostics snapshots for debugging/parity checks
Key files:
src/ui/Controls.jssrc/ui/HUD.jssrc/ui/ProgressChart.jssrc/ui/Visualizer.js
src/
index.html
main.js
nn/
Evolution.js
NeuralNetwork.js
TopologyNeuralNetwork.js
neat/
runtime/
sim/
Creature.js
Physics.js
Simulation.js
TurboCoordinator.js
TurboWorker.js
fitnessScore.js
ui/
Controls.js
HUD.js
ProgressChart.js
Visualizer.js
utils/
config/
physics.js
muscle.js
energy.js
fitness.js
evolution.js
visual.js
EvolutionMonitor.js
tests/
test-topology.js
test-neat-runtime.js
test-turbo-parity.js
benchmark-evolution.js
- JavaScript (ES modules)
- Vite
- Planck.js
- Tailwind CSS
If you embed Creature Labs inside another site and need reliable saves on iOS/Safari, use the parent-page storage bridge in:
docs/iframe-storage-bridge.md
npm installnpm run devOpen http://localhost:5173.
npm run buildnode tests/test-topology.js
node tests/test-neat-runtime.js
node tests/test-turbo-parity.js
node tests/benchmark-evolution.jsRecommended quick validation after sim/runtime changes:
npm run build
node tests/test-turbo-parity.jsCentralized in src/utils/config/ and flattened through src/utils/config/index.js.
When adding runtime parameters:
- Add to module config
- Export via flattened defaults in config index
- Thread through simulation runtime and turbo payload if applicable
- Keep normal and turbo behavior aligned for any physics/scoring/runtime logic changes.
- Prefer small, verifiable edits.
- Avoid hidden correction hacks unless explicitly requested.
- This repo does not currently use ESLint/Prettier/Jest.
MIT (see project license file if present).