There's only 1,024 "birds" in this flock, but I have tested the system with much larger flocks at high framerates. This current simulation runs on a GeForce GT 9600+ at 140 FPS. This, as most others GPU things I do uses OpenGL + GLSL. This also can be found in cppgpgpu's subversion repository. It's only tested on NVIDIA GPUs in Linux.
Also, the algorithm isn't quite a Boids flock algorithm.
There is no computation being done on the CPU - all of them are actually just pixels in a 32x32 texture, with the R,G,B,A, representing different properties about the bird. Their behavior is determined inside a fragment shader.
The trick here to make it GPU friendly is to allow the birds to mark off the area around them with locality information, i.e. the general direction and desnsity of birds. Using this, they can flock.
CNLohr 1 year ago