Boids Simulation

University Project (Year 2)
Windows
C++

View project on GitHub: 

GitHub Repository

In my second year at university, I created a boid simulation application using several C++ libraries, and without the use of a game engine. It features adjustable forces to control the behaviours exhibited by the flock of boids and utilises techniques such as an octree to help with performance.

 

The project expanded my knowledge of performance optimisation algorithms, implementing application controls and feedback using Imgui, and how entity component systems work.

Entity Component System

The application uses several unique components to create and simulate the boids. These are the transform, model, brain, and collider components, with each one being responsible for a different aspect of the boid's functionality.

 

Boid Behaviours

The boids use several forces to control their overall behaviour: separation; alignment; cohesion; wonder, and each of them can be controlled through the application's user interface.

 

Collision System

The simulation features some basic collision detection which is implemented through the collider component attached to each boid.

 

User Interface

The application's user interface was built with the Imgui library and features an array of controls for spawning & destroying boids; changing the boids' behaviours; rendering each boids' collider component; pausing the application; and rendering the application one frame at a time.

 

Optimisations

The simulation uses an octree to update the boids in batches which helps maintain a stable framerate whilst simulating hundreds of boids.

Boids Simulation
Boids Simulation Colliders

Entity Component System

Each boid is built from several different components to simulate an entity component system approach when creating game objects. These are the brain, transform, and model components, each written by myself and responsible for a different aspect of the boids functionality.

 

Boid Behaviour

The boids use several adjustable forces to control their overall behaviour: separation; alignment; cohesion; wonder.

 

Octree

The project uses an octree, created by myself, to update the boids in batches, helping increase the boid count to several thousand with stable results.