Flocking Behaviour of Boids
Flocking behaviour of boids is an example of emergence, wherein a simple set of rules can be used to achieve complex behaviour.
Highlighter:
Behaviour toggles:
Rules
Separation: If two boids come close to each other, they try moving in different directions to avoid colliding. There is no form of communication between them. The light-gray circle denotes the region around the boid where this rule comes into play.
Alignment: A boid moves in the average direction of the boids around it. The medium-gray circle denotes the region whose boids are considered. The blue coloured line points towards the average direction
Cohesion: A boid moves towards the average position of the boids around it. The dark-gray circle denotes the region whose boids are considered.
Note:
- Radius of Separation region cannot be changed because it may lead to crashes
- Alignment is critical for flocking behaviour.
- However, if a single flock is formed, then turning off alignment will almost never have any effect.
- Turning off separation will cause the boids to clump together. Some of these clumps will cease net movement because they move around each other.
- Simulation may lag in low-end devices. Simulation may lag if too many boids are introduced.
Developed by ChanRT | Fork me at GitHub