Aman Desai
Projects

3D Multi-Species Boid Simulation

C++ · OpenGL · Spatial Audio

Motivation

This was a course project built around a 3D boid simulation in Allolib. I started from an existing boid scaffold and used it as a way to learn how flocking, rendering, and spatial audio fit together in one real-time system.

The main goal was to make the simulation feel less like one uniform swarm. I wanted different groups of boids to have their own movement behavior, and I wanted the sound to react to where those groups were in 3D space.

Approach

Each boid used the same basic flocking rules: separation, alignment, and cohesion. The interesting part was changing the parameters per species. Blue, yellow, and white boids had different speeds, separation distances, alignment weights, and turn rates, which made the groups separate visually without adding much extra logic.

For performance, the simulation used an octree-style spatial query so each boid did not need to compare itself against every other boid. I also added GUI controls for the force weights and neighbor radii so I could tune the behavior while the simulation was running.

The sound side ended up being the harder part. I tried two approaches: positioned voices that sit in fixed regions and react to nearby boids, and voices that directly follow individual boids. The fixed-region version scaled better. The direct version made the relationship between motion and sound easier to understand, but it limited how many boids could run smoothly.

  • Three visible species with different flocking parameters
  • Octree neighbor lookup for local interaction queries
  • Spatialized audio driven by grouped regions or boid-attached voices
  • Randomized frequency offsets to keep the sound from collapsing into one tone

Results

The visual side worked well enough to show distinct flocking behavior. The audio was more experimental. It was useful to hear the center of activity move through space, but it also made clear how quickly audio design becomes its own problem.

The project was a good lesson in systems tradeoffs. The simple version was easy to reason about, while the more literal per-boid audio version became expensive quickly. Most of the work was not inventing a new flocking rule. It was wiring rendering, tuning controls, spatial queries, and sound into something that could run interactively.

References

  • Reynolds, Flocks, herds and schools: A distributed behavioral model, SIGGRAPH 1987