Update RVO Obstacles from Graphs frame spikes

I have a castle building game where 50-100 units attack a castle, where the castle walls can fall. When the walls fall it may block paths, or open new paths. The castle wall sections use DynamicGridObstacle.
The units use RVO
I’m using layered grid graph
The castle wall sections will have tunnels, etc. so I need the different layers
The terrain is about 4K meters in size, but I clamped the nodes to 200x200 for testing just for now.

In my test scene, which only has one castle wall, terrain, and no units I was getting frame spikes.

I’m guessing I can’t have everything I want?

Performance is paramount, as I can’t have frame spikes during gameplay. I also need it so paths can be opened up -
blocking is less important as I can have rubble disappear, although I would prefer not to do that.

What is my best option? I can give up RVO without impacting gameplay too much. But I can’t give up performance or the ability to open up holes in the castle wall.

Hi

The performance hit here comes from the fact that when the graph changes, it has to update the RVO obstacles that consist of the contours of the graph. You can avoid this performance penalty if your remove the RVONavmesh component that I think you are using. The downside is that the agents will no longer be constrained by the boundaries of the graph which may be problematic if you are using so many agents that they start to push each other out of the walkable region.

Aron, thanks for the quick reply. You were correct and I’ll remove RVONavmesh. So I need to make the scan area large enough that units won’t be pushed out? That takes a long-time to compute with my randomly generated terrain but I’ll do that if I have to.

Does the layered grid graph detect the overlapping areas automatically?

No, what I mean is that with the RVONavmesh component then obstacles will be created for the RVO agents (you can visualize them with the ‘Show Obstacles’ toggle on the RVOSimulator component if you are using the beta) so that the agents do not enter unwalkable nodes. You don’t need to make the scan area larger.

I’m not sure what you mean, could you elaborate?

"No, what I mean is that with the RVONavmesh component then obstacles will be created for the RVO agents "

If I understand that means that RVO won’t work as well, but it will still work to a certain extent? That is fine with me as it fixed the framerate spikes.

“Does the layered grid graph detect the overlapping areas automatically?”
“I’m not sure what you mean, could you elaborate?”

Disregard, I tested and found out that it does. I was referring to if it could detect tunnels automatically.

Yes. Agent to agent avoidance will work exactly as before. The only difference is that they can more easily be pushed into obstacles.