Boids particle systems can be set to follow basic rules and behaviors, something close to artificial intelligence. They are useful for simulating flocks, swarms, herds and schools of various kind of animals, insects and fishes.

Boids Behaviour

Boids artificial intelligence can only handle a certain amount of information at a single time, so the possible courses of action are easy to display within a single list.

The Physics panel for the Boids system

The rules are parsed from top-list to bottom-list (thus giving explicit priorities), and the exact order can be modified using the little arrows in front of each row. The list of rules available are:

  • Collision: Avoid deflector objects
  • Avoid: Avoid predators
  • Crowd: Avoid other boids
  • Center: Get to flock center
  • AvVel: Maintain average velocity
  • Velocity: Match velocity of nearby boids
  • Goal: Seek goal
  • Level: Keep the Z level

Each rule can be individually weighted ; the value should be considered how hard the boid will try to respect a given rule (a value of 1.000 means the Boid will always stick to it, a value of 0.000 means it will never). If the boid meets more than one conflicting condition at the same time, it will try to fulfill all the rules according to the respective weight of each. Any rule could be weighted from -1.000 to +2.000 in order to give it more or less significance (default value: ...).

  • Normal behaviour can be expected with weights between 0.000 to 1.000
  • From 1.000 to 2.000 the boids over react according to the rules
  • From -1.000 to 0.000 the boid reacts contrary to the rules

Please note that a given boid will try as much as it can to comply to each of the rules he is given, but it is more than likely that some rule will take precedence on other in some cases. For example, in order to avoid a prey, a boid could probably "forget" about Collision, Crowd and Center rules, meaning that "while panicked" it could well run into obstacles, for example, even if instructed not to, most of the time.

As a final note, the Collision algorithm is still not perfect and in research progress, so you can expect wrong behaviors at some occasion. It is worked on.

Boids Physics

  • MaxVelocity: Maximum velocity
  • AvVelocity: The usual speed percent of max velocity. If MaxVelocity is set to 10.000 and AvVelocity to 0.300, then the average velocity of the boids is 3.000.
  • LatAcc: Lateral acceleration percent of max velocity (turn). Defines how fast a boid is able to change direction.
  • TanAcc: Tangential acceleration percent of max velocity (forward). Defines how much the boid can suddenly accelerate in order to fulfill a rule.
  • Banking: Banking of boids on turns (1.0 == natural banking)
  • MaxBank: How much a boid can bank at a single step
  • N: How many neighbours to consider for each boid
  • 2D: Constrains boid to a surface: either to the surface of a given object (if specified in the OB field) or to a certain Z value (GroundZ). Useful to simulate herds on a ground, for example. When activated, Level, Banking and MaxBank become irrelevant
    • GroundZ: Default Z value
    • OB: Object's surface the boid is constrained to
    • If boids trajectory leads them out of the surface of an object, the GroundZ value is then used

Boids, deflectors and effectors

Very much like Newtonian particles, Boids will react to the surrounding deflectors and fields, according to the needs of the animator:

  • Deflection: Boids will try to avoid deflector objects according to the Collision rule's weight. It works best for convex surfaces (some work needed for concave surfaces).

For boid physics, Spherical fields define the way the objects having the field are seen by others. So a negative Spherical field (on an object or a particle system) will be a predator to all other boids particles systems, and a positive field will be a goal to all other boid particles systems.

When you select an object with a particles system set on, you have in the Fields tab a little menu stating if the field should apply to the emitter object or to the particles system. You have to select the particles system name if you want prey particles to flew away from predator particles.

  • Spherical fields: these effectors could be predators (negative Strength) that boids try to avoid or targets (positive Strength) that boids try to reach according to the (resp.) Avoid and Goal rules' weights. Spherical's effective Strength is multiplied by the actual relevant weight (e.g. if either Strength or Goal is null, then a flock of boids won't track a positive Spherical field).

You can also activate Die on hit (Extras panel) so that a prey particle simply disappears when "attacked" by a predator particle which reaches it.

Currently, this system doesn't allow for complex relationships (i.e. prey for one system while predator for others) but this will be made possible when particles will be properly pythonised.

External Links

Video example of Boids in action

Please refer to the following videos as an example of flock behaviour that boids can help to achieve:

Example video

Prey - Predator - blend file

Tutorial for Prey-Predator Relationship

As stressed before, using boids, it is easy to set animations with some prey/predator-like behaviour to some extend. In these cases, using Spherical Fieds emitters with negative Strength (repulsive, predators) or positive Strength (attractive, preys) will be quite easy and effective. Moreover, using the Die on Hit option (in the Extras panel) would prove useful also, when a predator successfully reaches a particle.

Setting a prey-predator relationship using Boids particles

Interesting Reads

These papers are from Craig Reynolds, the Boids' pioneer: