An improvement of the flocking behaviour in Jabuka is available.

There are now very simplistic birds drawn, to give an idea of the boid’s orientation.

The separation behaviour has been fixed. The behaviour was garbage before, the force away from another boid was proportional to the distance away from it. Now the force increases the nearer another boid is.

The boid’s orientation is taken as the smallest angle between being aligned with the World’s x axis, and the boid’s velocity. The roll doesn’t behave realistically (see scene 13), but the boid’s behaviour isn’t realistic. A boid would really change its velocity by adjusting its orientation (change the wing shape to apply a torque to allow it to rotate…)

This paper describes how the steering behaviours should change the intention of the boid, instead of providing actual forces onto the boid.

A simple particle system has been introduced to allow the path of a few individual boids to be more easily seen.

Running under the Visual Studio profiler, most of the time was seen to be spent finding the flockmates in proximity of the boid.

The same calculation was being done twice, for both the cohesion and alignment behaviours. Adding a ProximityFinderCache increased the frame rate by 50%, with no change in the calculations. Adjusting the code so that the boids in proximity are only calculated on every third iteration added another 20% to the framerate (giving 15fps with only two TrailGenerators attached).

2 thoughts on “Boids”

  1. If computing nearest neighbours is taking too long, you might consider incorporating a space partitioning algorithm of some sort such as an Octree or BSP as is commonly used in Raytracing applications.

  2. Hi Jeff!

    I was thinking about spacial partitioning, but was putting it off for now to keep the code simple…

    I was reading an article somewhere about this sort of thing using the GPU, and even though finding the flockmates is an O(n2) the GPU’s got so much power that it’ll just fly through the code faster, than the alternative of keeping a spacial tree upto-date and calculating a much smaller set of results…

    But maybe I should do both to compare the results!!!

    Thanks for the suggestion though, glad someone’s interested 😉

Comments are closed.