Procedural Graph Update

hello i have problem with procedural Graph update. I am creating a procedural generated World. And disabling all of the gameobjects step by step when its generating . After that when i move i am opening the disabled objects and closing by distance. So with that i am using GridGraph and ProceduralGraphMover.cs. My problem here is ProceduralGraphMover doesnt scan correctly and its not good always half is not calculated because of that I am using extra this
Bounds bounds = new Bounds(position, new Vector3(125,0,125));
GraphUpdateObject guo = new GraphUpdateObject(bounds)
{
updatePhysics = true ,// if i set false still doesnt work.
};
AstarPath.active.UpdateGraphs(guo);
AstarPath.active.FlushGraphUpdates();
this time it works
But i dont see this performance friendly.Because ProceduralGraph Mover scans and also my code scans.
There must be a way to connect both.

[Edit]
I think I understand the problem problem is im enabling and disabling objects inside the graph.It was already scanned when game objects are. disabled. So for a solution is it possible for me to create my own Graph Move so I can Update when I move and enabled gameobjects OR just modifying ProceduralGraphMover so in the description of UpdateGraphs function inside ProceduralGraphMover I saw this = “but only those nodes that have to be updated, the rest will keep their old values.” I don’t want this I want it to updated whole how can I do this ?
So basicly what I need is move graph and scan whole inside area.

thank you :slightly_smiling_face:

Hi there, you can take a look at DynamicGridObstacle and try and implement this. I just checked and can confirm that it will work with objects that are disabled and enabled.

If these objects are dynamic, you should use DynamicGridObstacle, like @tealtxgr mentions.
However, if these are part of the procedural world that you are loading in, then you should ensure that they are already created when the graph reaches them. That way it will be scanned correctly the first time.

Yes thanks for solutions. Dynamic also uses updategraph. I already managed to make it work.But i need to get better performance less fps drop. So still it will be twice or more scans.I only want to call scan once.Because still i need to use proceduralgraphmover. Procedural graph mover also scans inside i dont want this.for my situation .If i can manage to make procedural graphmover also scan old nodes. Than it will be perfect.So move to centerPos and scan nodes.

And also in my situation i cant be scan when all objects instantiated.Because game is fast and im only showing gameobject inside cameraview. Enabling and disableing.

@aron_granberg can you check please ?

Hey @sevanberkay
I am a bit confused by what you mean. you can’t scan when all objects are instantiated?

Theres a few things you could do to improve performance.
Disabling floodFill will make the graphs update faster

Acorrding to the documentation:

When the graph is moved you may notice an fps drop. If this grows too large you can try a few things:

  • Reduce the [updateDistance] This will make the updates smaller but more frequent. This only works to some degree however since an update has an inherent overhead.
  • Turn off erosion on the grid graph. This will reduce the number of nodes that need updating.
  • Reduce the grid size.
  • Turn on multithreading (A* Inspector → Settings)
  • Disable Height Testing or Collision Testing in the grid graph. This can give a minor performance boost.

What type of performance are you seeing now? Are you noticing intense slowdowns while scanning? If you are, feel free to send us some more information about your game world and use case and we’ll see what we can learn.

From your post, it looks like you’re scanning an area around the player/main unit that’s 125 units wide and long? If you don’t mind breaking down your specific situation I’d be happy to help you find the more performant method for your specific case :slight_smile: