Blog Index
The journal that this archive was targeting has been deleted. Please update your configuration.
Navigation
gallary

Wildlife simulation using Boids

These Boids are driven by the three conventional forces aswell as a drive to eat, mate and survive

This was developed as part of my artificial intelligence module during the third year of my degree.

Starving herbivores flee a predator as the predator chases down the best fed herbivore in the pack
The task for the first assignment was to implement a version of Boids using the three flocking behaviours (alignment, separation and cohesion). In this subsequent assignment we were tasked with applying our AI system to a scenario. I decided to design and implement a basic wildlife simulation.

When Boids are sufficiently fed and fertile, they seek out mates. The mother then lays an egg which grows and hatches into baby Boids

From my Boid class I created two new types of Boids: carnivore and herbivore, adding in extra steering forces such as towards food and mates, and away from predators. These additional steering forces were scaled by various factors: for instance, the more hungry a Boid was (a Boid's hunger is visualised by the colour of the Boid's belly (green to red)) the stronger the food hunting steering force was. When Boids were well fed they would seek other fertile Boids in order to mate (at which point they would become infertile for a set period); this created an egg which housed one to three clones of the mother. Boids could die from being eaten, starving, or from old age.

Two groups of Boids have flocked together and are headed towards food

 

Both of these tasks were completed using C++, with my own vector mathematics class. They were visualised with OpenGL. I also made use of an XML library to control the parameters of the simulation: how many herbivores/carnivores are present at the start of the simulation or how quickly plant life grows for the herbivores to eat.