You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A high-performance, real-time starling murmuration simulator demonstrating emergent swarm intelligence through simple interaction rules. Built entirely with TypeScript and rendered on HTML5 Canvas using PixiJS.
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
Open your browser at http://localhost:5173 to see the simulation.
Features
Core Simulation
2000-5000+ birds running smoothly at 60fps
Spatial partitioning for O(n) neighbor lookups instead of O(nΒ²)
Object pooling to minimize garbage collection pauses
Real-time parameter tuning via Tweakpane UI
Environmental Dynamics
Wind system with configurable speed, direction, and turbulence
Predator AI that hunts the flock with panic propagation
Food sources that attract birds with configurable strength
Rendering Options
Multiple particle shapes: Arrow, circle, triangle
Color modes: By density, by speed, or solid color
Trail effects for motion visualization
Glow effects for certain presets (fireflies)
Interactive Controls
Input
Action
Left Click
Add attractor (draws birds toward cursor)
Right Click
Add repulsor (pushes birds away from cursor)
Swarm Intelligence Rules
The simulation implements Reynolds' Boids algorithm β three simple rules that produce complex emergent behavior:
Main Rules
Rule
Description
Alignment
Birds match the velocity direction of nearby neighbors
Cohesion
Birds steer toward the local center of mass
Separation
Birds avoid crowding by steering away from close neighbors
Sub-Rules & Enhancements
Field of View: Configurable vision cone (default 270Β° β blind spot behind)