Are there any examples of flocking where the flock surrounds and engages the target instead of a fish like feeding frenzy where they swoop in then fly away?
I'm working on an overhead shooter and I want the pack of melee enemies to rush the enemy and surround him and keep attacking while more file in behind. I'm trying to avoid them all bunching up on one spot and flocking seems perfect but all the "move to target" examples have them move at the target then move away immediately afterwards.
Ideas?
As I understand it, generic flocking is generated by a weighted-average of:
There are different ways to calculating these vectors and different behaviours result when they are given different weights. There are also different ways of combining the combined, weighted-average vector with the current velocity vector.
If I read your question correctly, you would like your flock to circle or flit around a central point. To do this, you've created a fourth vector, which is
Now, you can probably see where this is going... the behaviour of your flock is the result of the weights placed on each vector. If the weight you've placed on the target vector is too small relative the others, your flock will be focusing on flocking instead of attacking.
Therefore, assuming I've outlined flocking correctly, and you've programmed things in a reasonable way, you'll be wanting to try different combinations of weights until you find a behaviour that suits your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With