Lecture 8

Flocking / Artificial Life

notes and images from:


We have looked at animating a bunch of particles through physically-based modelling and we have looked at animating realistic individual living humans and other creatures like Dinosaurs.

But what if you want to have a bunch of living creatures moving around and exhibiting realistic group behaviour - e.g. fish schooling or birds flocking or mammels herding. In this case we have a bunch of creatures (particles) whose movements are affected by behaviour as well as physics.

Craig Reynolds' Boids

Reynolds, C. W. (1987) Flocks, Herds, and Schools: A Distributed Behavioral Model, in Computer Graphics, 21(4) (SIGGRAPH '87 Conference Proceedings) pages 25-34.

The paper is available at http://www.cs.toronto.edu/~dt/siggraph97-course/cwr87/

Generic flocking creatures called boids

Each creature is a particle

Distributed behaviour model - each bird performs its own movement

Movement is controlled by simple physics and 3 steering behaviours based on information perceived about the limited neighbourhood around the boid.

First the simple physics- geometric flight

each boid has its own local coordinate system

Boids move along their local positive Z axis. Pitching and yawing realign the global orientation of the local Z axis.

Momentum is concerved - viscous speed damping to give a maximum speed, a specified maximum acceleration.

Gravity only used for banking- not very realistic for birds flying a lot

Banking (rolling) - keeps local Y axis aligned with the local XY component of the total acceleration acting on the boid. In straight and level flight gravity is down so banking component keeps the bird level. When turning the acceleration down swings outward so the boid rolls to keep the axis aligned.

Same basis as turle graphics in logo

So now that we have one boid moving, how does it relate to its friends ...

desire to stay close to the flock

desire to avoid collisions with other members of the flock

no apparent natural bound on size of flocks so amount of processing needed by each flock member does not depend on size of the flock

3 Steering behaviours

in order of most important to least important

  1. collision avoidance/separation - dont collide with nearby flockmates
  2. velocity matching/alignment - attempt to match velocity of nearby flockmates (steer towards average heading of local flockmates)
    more flocking
  3. flock centering/cohesion - attempt to stay close to nearby flockmates (steer towards average position of local flockmates)
    yet more flocking

and take a weighted average

What do we mean by 'nearby flockmates' - trying to simulate perception - boid sees is nearby flockmates much better than those far away, sees more ahead than behind.

How do we find who is nearby?

exhaustive search is order N^2

should try and partition the flock spatially into bins and then search just the local bin or bins.

Where are they going?

migratory urge - global position in 3-space or a global direction - can be moved around dynamically

What if something gets in the way?

boids tend to reach a steady state

objects in the way make the movements much more interesting

in general the flock doesn't rush up to a wall and then hover - the individuals anticipate and avoid

steer-to-avoid - simulated vision - only looks directly ahead - if there is an obstacle then find the closest edge and steer towards one body-length outside of that edge

objects may move - they may be benign or predators

Here is a nice java applet

Conrad Parker boids at http://www.vergenet.net/~conrad/java/Boids/coogee.html

and http://www.humboldt.edu/~ecomodel/clupeoids.htm

and http://www.extrapixel.ch/processing/boids/

and then there are Swarms

swarms are like flocks of boids except swarms do not try and align


and a rather famous example from the Lion King:

Clips are available at http://www.vee-media.com as

Coming Next Time

Animation in Scientific Visualization

last revision 2/6/08