Skip to content
This repository has been archived by the owner on May 23, 2021. It is now read-only.

Latest commit

 

History

History
22 lines (13 loc) · 1017 Bytes

README.md

File metadata and controls

22 lines (13 loc) · 1017 Bytes

Flocking in Unity

A Unity implementation of Craig Reynold's boids.

gif

20,000 boids simulated entirely on the GPU, running at 60 fps (watch on Youtube).

About

Includes CPU and GPU implementations.

Both are naïve O(N2) implementations. The CPU version can handle about 150 boids at 60 fps, while the GPU version can handle about 20,000. (As tested on a Ryzen 5, Nvidia GTX 1060 machine. Your mileage may vary).

The GPU version requires a graphics card that supports Compute shaders and GPU instancing in Unity.

The CPU version includes a script to visualize some of the parameters of the boids. (Nearest neighbors, forces, and path over time).

To-do

  • Implement vertex animations for swimming fish and flying birds.
  • Improve performance with some kind of spatial data structure.
  • Add environmental awareness / obstacle avoidance.