Boids

Info

Project type: C++ Simulation

Timeframe: 2022

Video

Scott-G-GD/boids-cpp

Product Overview

I worked on this for about week inspired by the lessons on steering behaviours at school.

Project Overview

An implementation of boids in C++ with sfml.

Code

Boid

The boids themselves are primarily a position, a velocity, a mass, and a collection of behaviour function pointers. These boids are then stored in a vector and each of the behaviours is run for each of the boids, resulting in the demonstrated movements.

Behaviours

As previously mentioned, the boids all store a collection of behaviours, represented by function pointers. These function pointers take as input a context object representing the program state at the start of the frame, and output a desired change in velocity. The original boids paper describes cohesion, separation, and alignment, so these are the main behaviours implemented.