I am working on boids. This article examples with some physics make great boids. Those are lovely digital creatures.
However i have one problem, for them to have any more advanced flock behavior, each one needs to know location of others.
It all works fine with sphere set to overlap dynamic actor that each boid has attached. But moment they all follow single direction (ie. lots of overlapping) everything slows to crawl (at around 50 boids alive).
Other solution (which i did not try yet) is to get array of them all in pawn (or level blueprint etc). then each boid will do foreach loop and check distance to other boids, but this again grows exponentially with number of boids.
There is also “Sphere Overlap Actors” bp node, is this cheaper to check from every actor than collision sphere with begin overlap event?
So any ideas how to solve this problem, or limit it to linear growth?
For now i am working on not letting them to create flock bigger than 10 or so, but because they wander randomly sometimes 2 flocks join together, and eventually every single of them gets in one flock, which is cool and desired behavior, but overlap events slow everything.