Birds are smart, while they are flying, they won't "crash" with each other. Craig Reynolds named those birds as boids in his simulation program.
This behaviors is very useful when you are simulating a group of units moving to certain target.
Since my current game needed flocking behaviors so I need to learn how to implement it!
Luckily I found an useful tutorials:
In short, you just need 3 main rules to achieve flocking effect:
1) Boids try to fly towards the centre of mass of neighbouring boids.
2) Boids try to keep a small distance away from other objects.
3) Boids try to match velocity with near boids.
Sample screenshots:
* Just initialized
*Pursuing the target
*Target changed
Video demo:
Download link here:
PS: It's in XNA 4.0, so you need to install XNA redistributable 4.0 before you can run it.
No comments:
Post a Comment