Boids Simulation
Area: Web • Location: Home
complete
Keywords
Artificial Life, Chaos-Theory, Flocking Behaviour
Updated
2025-11-21
Repository
Overview
The Boids model—short for “bird-oid objects”—was introduced by Craig Reynolds in the late 1980s as a way to simulate bird-like flocking using a few very simple local rules. The idea is that what looks like coordinated group behaviour can emerge entirely from individual agents reacting only to their nearby neighbours. I found this appealing because it connects naturally to topics in dynamical systems, collective behaviour, and emergent patterns, while also matching something you can observe directly just by looking outside.
I also wanted a background for my website that reflected this interest in mathematical simulations without being overly distracting. A lightweight Boids implementation turned out to be a good fit: a subtle flock drifting behind the page, driven by a small set of rules yet producing surprisingly rich motion.
How It Works
Boids works by giving each agent (each “boid”) a simple set of behavioural rules. The boid does not know anything about the flock as a whole—it only looks at nearby neighbours and adjusts its velocity accordingly. The classical model uses three components:
- Separation – steer away from neighbours that are too close to avoid collisions.
- Alignment – adjust direction to match the average heading of nearby boids.
- Cohesion – steer towards the average position (centre of mass) of the local flock.
Each of these produces a small steering vector. The final velocity update is a weighted combination of all three, and the boid then moves forward. Although each rule is simple and purely local, their interaction produces the characteristic large-scale patterns of flocking— groups forming, splitting, turning, and reuniting.
Extensions
This Boids engine is designed to be easy to tweak. Future extensions I’m considering include:
- Changing colours or behaviour based on the current page or section.
- Adding mouse interaction so the flock gently avoids or follows the cursor.
- Experimenting with different boundary conditions and obstacle avoidance.
Because the code is small and self-contained, it also serves as a fun sandbox for experimenting with ideas from dynamical systems and collective behaviour.
References
- Craig Reynolds, “Flocks, Herds, and Schools: A Distributed Behavioral Model,” ACM SIGGRAPH, 1987.
- Ichiro Aoki, “A Simulation Study on the Schooling Mechanism in Fish,” Nippon Suisan Gakkaishi, 1982.
- Wikipedia contributors, “Boids,” Wikipedia, The Free Encyclopedia.