Emergence Lab - Agent-Based Simulations
Eight complex-system simulations in the browser, where simple local rules produce big emergent behaviour.
Emergence Lab is a collection of interactive, in-browser complex-system simulations. Each entity follows simple local rules, and the interesting macro behaviour - population cycles, extinction, equilibrium, flocking - emerges from their interactions rather than being programmed in.
It runs entirely client-side and deploys as static assets on Cloudflare Pages, so it costs nothing to host at any traffic level.
Highlights
- Eight simulations: predator-prey, food chains, flocking, ant colonies, N-body gravity, pandemic spread and more.
- Two control tiers per sim - a simple 'Basic' panel and an 'Advanced' panel exposing deeper mechanics.
- Real-time parameter changes with immediate visual feedback on the canvas.
- Web Workers keep the heavy simulations off the UI thread.
Emergence as the teaching goal
The point isn't the individual agents - it's watching a food-chain settle into cycles, or a flock organise with no leader. Exposing every parameter live lets you feel how a small rule change tips a system from equilibrium into collapse.
Zero-backend architecture
Everything runs in the browser on HTML Canvas, with Web Workers for the compute-heavy models. Deployed as static files on Cloudflare's free tier, there's no server to pay for or maintain - the architecture makes scientific visualisation essentially free to publish.
Stack
Frontend
- TypeScript
- HTML Canvas
Compute
- Web Workers
Hosting
- Cloudflare Pages
Gallery