As with previous concepts, it's easiest to understand flocks and herds by relating them to the real-life behaviors they model. As simple as it sounds, these concepts describe a group of objects, or boids, as they are called in artificial intelligence lingo, moving together as a group. The flocking algorithm gets its name from the behavior birds exhibit in nature, where a group of birds follow one another toward a common destination, keeping a mostly fixed distance from each other. The emphasis here is on the group. We've explored how singular agents can move and make decisions on their own, but flocks are a relatively computationally efficient way of simulating large groups of agents moving in unison while modeling unique movement in each boid that doesn't rely on randomness or predefined paths.
We'll implement two variations of flocking in this chapter. The first one will be based on a sample flocking behavior found in a demo project called...