Support Forum

GraphUpdateObject does not add nodes

Hello! I need to modify layered grid graph during runtime. I am using GraphUpdateObject but it seems that it does not add new nodes during it’s update. And I need to place new nodes on top of colliders.

Is there any way to get this type of graph modification during runtime:

grid graph guo

Thanks!

Okay, so I saw in code that new nodes are being added only during ScanInternal. So there only way right now is to recalculate all graph, and it means that during runtime it’s generaly a bad idea.

What is best approach if I need grid graph and multiple layers then? For example If I need a gate where agents can ba ontop of and bellow

Hi

It should definitely add nodes when scanned during runtime.
Are you sure guo.updatePhysics = true?

Which version of the package are you using?

Yes, I am using guo.updatePhysics = true. Version latest 4.3.20. Also when using GridGraph [0 id], PointGraph[1 id], and LayeredGridGraph [2 id] after some guo’s labrary freezes somewhere in JobDependencyTracker.cs

Also guos destroy some already created nodes on layered grid graph

I am just having bad time with navigation I guess

If I scan with button in A* inspector it works ok, but this will take too much time when just placing a new building in game

You are finding so many bugs!
I guess it’s not that strange since the layer grid graph scanning system was completely rewritten to use burst a few beta versions ago, and not a lot of people are using the beta.

I have uploaded version 4.3.21 which fixes these bugs.
I had unit tests for updating layered grid graphs, but apparently I did not have any for updates that added new layers to the graph.

I am just experimenting with graph types to find a best and fastest approach for my game. I hope it helps to make this library even better. Thanks for the fix!

Does these bugs also accur on grid graph or it is ok?

1 Like

The grid graph doesn’t have layers, so that part should be fine. However in the beta I also fixed a race condition that affected both the layer grid graph and the normal grid graph.
They share almost all of the scanning code since the burst rewrite.

Great, thanks! I was using 4.2 but in my game very fast RVO was essential so I switched to beta.

Also I notices during stress test with 500 richAI+RVO agents that on cpu with 8 cores and 16 threads game occupies one of the threads more then others. Avg total PC cpu usage was around 20% while gpu at 30%. I mean that game cant occupy all PC resurces due some bottlneck in pathfinding library. Is it processing data for and after jobs done? FPS i still very good but it’s just sad that it cant reach something like 300-400+fps and stuck on 160.

Or is it due to some Unity stuff?

That’s probably the unity main thread.
Local avoidance and pathfinding is fully multithreaded, but a lot of stuff which is not local avoidance still runs on the main thread. For example the RichAI agent runs almost completely on the main thread. Furthermore the rest of your game probably also runs there. You can use the Unity Profiler to analyze this.

Okay, I will take a closer look

I can confirm that updatePhysics=true not working on RecastGraph, it won’t even update the available nodes. the version is 4.2.12 pro and unity 2019.3.5f1

@h3ll0n3arth
This thread is about the layered grid graph. Recast graph use a completely different code path.

With updatePhysics = true for a recast graph it will recalculate any tiles it touches completely. It’s not to be combined with updating tags or penalties of existing nodes since all existing nodes will be removed and recalculated.
See https://arongranberg.com/astar/docs/graphupdateobject.html#updatePhysics

thank you, i missed that part somehow. Thanks for the answer. All the best