A "flock" is an autonomous system in which each agent (or "boid" as they are commonly called) updates its own direction of movement in response to the location and direction its local neighbors, or the entire system.
The rules are quite simple
Alignment: Boids steer in the direction of overall flock velocity
Cohesion: Boids steer in the direction of overall flock position
- Separation: Boids avoid other boids to prevent collision and crowding
A GLSL-based simulation stores agent data as pixel channel information, allowing for real-time performance and easy customizability.
- External forces (either global or via a map) can be defined
- Weights for specific rule's application can be altered
- Various other external forces and parameter adjustments
Textures storing agent position data are fed into a to be rendered via instancing. A vertex-shader based method could also be used for increased performance gain in large systems.
A separate demo page can be found here, and the source code is available on GitHub.