Simulating a bait ball (flocking)
I agree that you can go ahead and hard code the circling of the predators. That's a shared behavior that has likely evolved over thousands of years. You can just assume it.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play
"Reducing the world to mathematical equations!"
Hey,
Sorry for not replying, I got distracted from this for a few days, but I’m back on now!
To cover some of the newer replies:
Actually I disagree with some of this. I've read one study (don't have the link sorry, but it's a paper called "Dynamics of fish shoals: identifying key decision rules") and seen many videos of bait balls. Fish may not want to form balls but they DO want to stay together, as close and as cohesive as possible. Safety in numbers is a valid survival trait. Predators are nervous about attacking a great ball of fish that is acting as one. They only snip at the sides to start and it is only when the shoal is split and the shoal becomes chaotic that the bait ball becomes decimated. I may be wrong of course, but this is what I perceive and the aim is to make it look right after all, even if the mechanics behind it are not 100% accurate.
As for the zones, yes you've pretty much got it right. In the presence of predators the fish will stay closer together, any fish that stray too far from the main shoal will be quickly eaten.
This might be possible by only taking into account the nearest threat. It may not be perfect but it will probably simulate it to a believable degree.
@Vorpy, actually I've modified my rules somewhat and what you've suggested closely matches what I have. I've kept the centre of the flock having an effect. However the way the centre is calculated is changing. Fish that are too far away from the 'previous' centre are not taken into account for the new centre. This way if some fish become separated they don't have a pull affect of the other fish.
Progress:
I've made the shoal avoid me (controlling a predator for the moment to see exact effects). It's working quite nicely. If I charge into the centre of the shoal the shoal will split and try to work themselves back together. At close ranges avoiding me quickly becomes the priority over almost everything else
The difficulty I'm having now is thinking of an algorithm for the predators, Thanks for the suggestions of just hard coding a circular behaviour, I think I'll go down that route.
Cheers.
Sorry for not replying, I got distracted from this for a few days, but I’m back on now!
To cover some of the newer replies:
Quote: Original post by caffiene
The fish will usually try to escape and move away from the ball, toward whatever cover / open water / whatever they use for their defence mechanism, but are actively herded into the ball by the predator.
One question I have is, what exactly do you mean by "making the zones tighter"? Do you mean you are decreasing the area-of-effect for the repulsion effect, so that the fish group more tightly?
In nature, Id say that that isn’t really what happens... rather the closeness is, again, in spite of their efforts rather than because of them. It is the predators pushing them so that the fish don’t have enough room to stay out of each other’s space.
Actually I disagree with some of this. I've read one study (don't have the link sorry, but it's a paper called "Dynamics of fish shoals: identifying key decision rules") and seen many videos of bait balls. Fish may not want to form balls but they DO want to stay together, as close and as cohesive as possible. Safety in numbers is a valid survival trait. Predators are nervous about attacking a great ball of fish that is acting as one. They only snip at the sides to start and it is only when the shoal is split and the shoal becomes chaotic that the bait ball becomes decimated. I may be wrong of course, but this is what I perceive and the aim is to make it look right after all, even if the mechanics behind it are not 100% accurate.
As for the zones, yes you've pretty much got it right. In the presence of predators the fish will stay closer together, any fish that stray too far from the main shoal will be quickly eaten.
Quote: Original post by InnocuousFox
One of the reasons that fish will consent to moving into the ball rather than out of the ring through any gap that they can is that they don't know they are in a ring. They only see the predator on their side. As far as their perception goes, they are moving in the right direction - i.e. away from the perceived threat. How do you model that without a ton of LOS checks
This might be possible by only taking into account the nearest threat. It may not be perfect but it will probably simulate it to a believable degree.
@Vorpy, actually I've modified my rules somewhat and what you've suggested closely matches what I have. I've kept the centre of the flock having an effect. However the way the centre is calculated is changing. Fish that are too far away from the 'previous' centre are not taken into account for the new centre. This way if some fish become separated they don't have a pull affect of the other fish.
Progress:
I've made the shoal avoid me (controlling a predator for the moment to see exact effects). It's working quite nicely. If I charge into the centre of the shoal the shoal will split and try to work themselves back together. At close ranges avoiding me quickly becomes the priority over almost everything else
The difficulty I'm having now is thinking of an algorithm for the predators, Thanks for the suggestions of just hard coding a circular behaviour, I think I'll go down that route.
Cheers.
Without the 0, alot of bigger numbers would just stand around feeling rather silly.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement