Visualize 3D simulation of a large shoal of fish.
CPU and GPU-based boiding simulation, rendered using OpenGL.
As with most artificial life simulations, Boids is an example of emergent behavior; that is, the complexity of Boids arises from the interaction of individual agents adhering to a set of simple rules. The rules applied in the simplest Boids world are as follows:
-separation: steer to avoid crowding local flockmates
-alignment: steer towards the average heading of local flockmates
-cohesion: steer to move towards the average position (center of mass) of local flockmates
Spatial hashing was implemented to omit a major bottleneck-random memory access looking for nearby flockmates. Start/end indicies array were used to allow constant time access to given cell. Entire informatation about boids, i.e. position and valocity is stored on the GPU side. Data to OpenGl is directly transfered using CUDA buffers. Boids are simulated in a one CUDA thread - one boid manner.