Boids are virtual ‘agents’ i.e. units adusting their motion autonomously in response to their environment, thus reproducing or emulating the behavior of living creatures – particularly in groups / flocks / swarms.
The underlying rules for this simulation of swarm dynamics were developed by Craig Reynolds in 1986 and are astonishingly simple:
-
Cohesion: Each boid senses other boids within a given radius, calculates their collective centroid (geometric center of irregular pattern) and gravitates towards it.
-
Alignment: The boid adjusts its vector (direction of movement) according to the average vector of adjacent boids. This behavior differs from cohesion in that it creates a ‘group synergy’ (interaction / shared behavior / cooperation), which becomes apparent in the formation of swarms.
-
Minimal distance: In order to avoid collisions or over-crowding, boids will maintain a minimal dostance to one-another.
Additional rules may include:
-
Avoiding obstacles / repellents: Boids will move around barriers and maintain a certain distance to objects with a defined ‘repelling’ radius.
-
Proximity to / gravitation towards attractors: As with the ‘cohesion’ rule, boids may seek proximity to a static object representing a center of attraction.
The aggregate behavior of boid swarms creates the illusion of ‘intelligent’ responsiveness to environmental conditions, reminiscent of schools of fish, swarms of birds flocks of sheep, or even large crowds of people. A complex, dynamic and adaptive system emerges from instances of identical agents interacting with one-another or responding to their environment based on a set of per-defined rules. Global patterns of movement throughout the simulation are defined by these rules with respect to specific events (boid-boid or boid-obstacle/attractor encounters) at any given point in time.