So I have some BOID behaviors that mimic schools of fish, all inside of a big maze, and sometimes the modified boid behaviors (esp the spinning behaviors) end up pushing the actors into the walls.
for a bit of context of what I mean, you can check out the game’s trailer at hive-defender.com where you’ll find a quick visual understanding of what I mean.
Anyways, I currently have some hard coded in avoidance and cohesion behaviors inside of the actor’s which exhibit boid behavior, but I’m considering a change to the code where I use Aron’d built-in RVO based local avoidance, but in order for it to work, I think I’d need to put avoidance on the walls.
The walls all have a collider on them already of course, and it’s a simple box collider 2D.
But there are definitely a couple hundred walls per match (around 450-500 at the most, but normally around 350 or so).
The actors which move on the grid are limited to 24 aliens, and 24 enemies, so 550 maximum, 500 of which are stationary, but about 400 on average.
Anyone have any experience with RVO local avoidance? Does this work? Is it a viable strategy?
Just a quick update that I haven’t tried it yet, and am still looking for a suggestion.
Sorry for the late reply.
This package’s RVO also doesn’t consider walls directly. However by default all agents will clamp their position to the navmesh, which works just fine for most use cases. It’s essentially a
AstarPath.active.GetNearest call for every agent on every frame. Is that something which could work for you too?
I’ve implemented box colliders on all the walls, and it seems like the actors are avoiding them now no problem [actually it’s working pretty darn well!]. I use these as obstacles in the grid path finding.
But an issue I’m having now is that after walls are destroyed and the map opens up, the actors now sort of sway back and forth in a wave as they move – almost as if I need so somehow rescan the walls / walkable grid. I do rescan the grid using the local rescan and setting my own bounds, but it seems like maybe this rescanned information isn’t properly being x’fered to the RVO system.
Do I need to rescan with RVO as well as with the astar grid?
Do you use the RVONavmesh component by any chance?
I’m not 100% sure.
I’m using a hexagonal grid graph which i make in runtime and then rescan over and over, and I use circle colliders for the moving agents, and box colliders for the walls – all in 2D.