click anywhere to create a new boid


By Matt Mazur on February 19, 2014

Boids are an artificial life simulation developed by Craig Reynolds in 1986 that models the flocking behavior of birds.

Each boid (an abbreviation of the word "birdoid" which refers to a simulated flocking birds or schooling fish) follows three simple rules from which the flocking behavior you see above emerges.

The three rules are:

  1. Fly towards the average position of your neighbors (cohesion)
  2. Match your neighbors' average velocity (alignment)
  3. Don't get too close to your neighbors (separation)

Boids are a common example of emergent behavior because each boid follows simple local rules which leads to complex global behavior.

This implementation is derived from instructions and examples from Steven Levy's Artificial Life book, Boids Pseudocode, Processing.js's flocking example, and a flocking demonstration by Guilherme Polo. You can check out the JavaScript implementation if you're interested by viewing the page source.