top of page



Date Created: 30 July 2021

No. of people involved: Only me

Length of project: 4 weeks

Tools: SDL2, C++

This project was for an Artificial Intelligence assignment at AIE. We were given the task to create a simulation that displays evidence of pathfinding and behavioral changes using AI strategies such as state machines. My initial plan was to build a forest which would consist of plants (food), rabbits (herbivores) and foxes (predators). The rabbits would eat the plants and the foxes would eat the rabbits. I ended up ditching this idea, and decided to create a body of water where fish would swim around, displaying flocking behaviours.

In the current version of the simulation, there are fish swimming around casually wandering (using flocking behaviours such as separation, alignment and cohesion), though when they come close to a rock, they avoid it using steering behaviours. Using a state machine, they randomly decide they are hungry and search for food (coral). Using the A-Star pathfinding algorithm, they find a path to a random food source. In the meantime, there is a predator who also uses a state machine to randomly decide he is hungry, which it then chases a random fish until it is caught.


Fish Flocking Demo.gif

The fish using flocking behaviours (separation, alignment and cohesion). Also using steering behaviours to stay away from the rocks.

Fish Pathfinding Demo.gif

The fish change their behaviour on a timer. When they are red, they are looking for food (coral) by using pathfinding algorithms on a grid based map.

BOID Predator Demo.gif

Predators wandering around until they decide they're hungry using a state machine, chasing a random fish in the scene until its caught.

bottom of page