Flocking is a classic example of Stigmergy.

Flocking is an emergent behaviour observed when a set of stateless agents each execute a simple set of rules independently. These rules govern the direction the agent moves in and are continuously executed at a given frequency.

The agents co-exist within the same 3D or 2D space and are able to observe each other based on their own acuity.

In flocking there are 3 main rules which govern how each individual agent operates. These 3 rules were identified by CW Reynolds :

They are:

separation
: steer to avoid crowding local flockmates

Separation
alignment
: steer towards the average heading of local flockmates

Alignment
cohesion
: steer to move toward the average position of local flockmates

Cohesion


The natural world of course requires some additional rules. To enhance the above scheme I have introduced the following additional rules:


1. Obstacle avoidance
2. Predation avoidance
3. A draw or attraction to a common roost

While 1 and 2 have similarities, they are subtly different. Avoidance is “I don’t want to collide with, but I can pass close to”, where as 2 is “If I can see a predator I wish to move away from it”.

With these 6 rules in mind I have set about creating a simulation ; each flockmate’s behaviour is governed by the following parameters:

1. Alignment Desire (Alignment)
2. Flock Desire (Cohesion)
3. Space Desire (Separation)
4. Roost Desire
5. Detection range (how far it can ‘see’)
6. Field of view
7. Personal space (radius about which it doesn’t want other flockmates in)

All the parameters are double.
Parameters 1-> 4 total to 1.0

(to be continued...)
IMG_0139



Wipe7