A high-performance, visually interactive 2D boids (flocking) simulation written in modern C++ using OpenGL, GLFW, and ImGui. Features GPU instancing, dynamic behavior control, and intuitive mouse interaction.
| Speed-Based Coloring | Friend Influence Visualization |
|---|---|
![]() |
![]() |
- 🚀 Instanced rendering of hundreds/thousands of boids using a single draw call
- ⚙️ Real-time control over:
- Separation, alignment, cohesion weights
- Speed limit
- Edge behavior (wrap/bounce)
- Color: speed-based or friend-averaged
- 🖱️ Mouse interaction:
- Left click — Attract boids
- Right click — Repel boids
- Middle click — Spawn 100 boids at mouse location
- 🎮 UI built with ImGui (custom sci-fi styled)
- 📐 Dynamic viewport resizing and zooming support
Each boid:
- Aligns with neighbors' direction
- Moves toward average neighbor position (cohesion)
- Avoids crowding (separation)
- Interacts with mouse position (attraction/repulsion)
- Can bounce or wrap off screen edges
- Can be colorized based on velocity or group blending

