Flocking Autonomous Agents
Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Other than moving about and being fun to look at, autonomous agents can have a purpose.
You could be simulating creatures in a hazardous environment, in which case boids should include a survival goal. In fact, boids can have any kind of relationship with the environment you put them in.
For example, boids could grow hungry and die if they do not find a source of food, in which case they would cooperate by sending each other information on the whereabouts of foodstuffs but compete for the food once they find it. A possible implementation of this could be adding a force to your boids towards distant pheremones that the boids secrete once they start eating, as well as a force to move towards nearby food once it is spotted.
Maybe the boids could even eat each other. With such a mechanic it would make sense to add a fear force to your boids, which would steer them away from potential danger.
The environment could include walls that the boids cannot pass. The boids could then include an avoid running into a wall force. This force, combined with the nature of flocking could be used to navigate a maze. If the maze is a particularly complicated one, boids would need to develop a memory or other persistent system to retain information about dead-ends and such. For instance, ants place pheromones on the ground that other ants can follow.
In this example boids try to stay clear from walls and are attracted to food. Left click in the viewer to place some food.