A simple flocking demo made in XNA. The version shown here is version 1.0.0, it features a flocking algorithm to enable boids to flock to a target, flock around themselves and scatter themselves. There are a number of runtime configurable options including an option to increase or decrease the number of boids and change the maximum velocity of the boids.
Both the executable for the demo and the source code are available from my website:
http://jamiedale.net/index.php?p=portfolio/xnaflocking
The flocking algorithm itself is based on code from:
http://www.vergenet.net/~conrad/boids/pseudocode.html
is it possible to download the source code ?very interest in it。
MrSuperHao 1 year ago
Hi. This demo does have the flocking rules enabled, however it also has two other rules for flock to target (the red dot), and scatter (from each other).
The reason it doesn't look like flocking in this demo is because the weightings on the rules is messed up so the actual flocking behaviours are essentially being overwhelmed.
The video response I posted is using the exact same flocking rules as this code, but without the two additional rules, and as a result it shows much better flocking.
tweexdotnet 2 years ago
Couldn't have said it better myself, I agree entirely.
KonigRodskjegg 2 years ago
this is not flocking, the algorithm is obviously just "get as close as possible to red dot". Flocking algorithms are more complex and require at least alignment, cohesion and separation algorithms. Your boids dont know about each other they just have collision implemented.
zvuk 2 years ago
Hi, the source code is now available from my website. The link can be found in the video description.
tweexdotnet 2 years ago
groovy!
whothehellisthat 4 years ago