Header image
Ph.D. Student  

Flocking simulation

This applet implements a basic flocking simulation with obstacles that the boids should avoid. It is based on Craig Reynolds groundbreaking paper. More information about flocking can be found on his web page about flocking and obstacle avoidance by steering behavior.

The applet implements 5 different kinds of forces:

  • flock centering force (key 1) makes the boids flock together (force directed to the local centroid)
  • velocity matching force (key 2) make the boids adapt to the velocity of their neighbors
  • collision avoidance force (key 3) make the boids avoiding each other
  • wandering force (key 4) adds random motion
  • steering force (key 5) make the boids steer away from obstacle

You can use the mouse cursor to attract or repulse the boids.

Usage instructions:

  • SPACE start/stop animation
  • 1-5 toggle forces
  • + add birds
  • - remove birds
  • a attract to cursor
  • r repulse sfrom cursor
  • s scatter birds
  • p toggle show paths
  • c clear paths
  • b toggle blocks

[ download source | applet page ]

Sample pictures:

Flocking with obstacle avoidance in action.

Flock scattering away after user defined attraction to center.