Voxel world multiple graphs?

I’ve been trying to figure this one out but with no luck, would love your advice.
I am working on a procedural generation game so I’m working with chunks.
at any moment there are about 150 chunks loaded.

Is it possible to run multiple graphs, a small one per monster/worker and the main one for the player?
any recommendations? thank you in advance.

Hi

It’s tricky, but possible.
Are you sure it is not possible to use a single LayeredGridGraph?
You could perhaps combine it with the ProdeduralGridMover component (see example scene called ‘Procedural’) to move it around as different chunks are loaded.

1 Like

First of all thank you for the fast reply.
Currently I’m using a single LayeredGridGraph and
I’m moving the graph with the ProdeduralGridMover (on the player) so it covers the loaded chunks.
But when I’m destroying chunks I’m setting the ‘workers’ to be not active, so they won’t fall bellow the map and simply setting them to active once the chunk is loaded again.
the thing is once I set them to active I get this error message.

ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
Pathfinding.Util.PathInterpolator.MoveToSegment (Int32 index, Single fractionAlongSegment) (at Assets/AstarPathfindingProject/Core/Misc/PathInterpolator.cs:89)

{ line 89 : if (index < 0 || index >= path.Count - 1) throw new System.ArgumentOutOfRangeException(“index”); }

the problem is with the path list being empty… path.Count set to zero.
Couldn’t fix it so I thought maybe having mini graphs for every ‘worker’ will do the trick.

Would love your help if you know how to fix the path list problem.
Thanks in advance!

Hi

Ah, that shouldn’t happen. Which version are you using?
Try upgrading to 4.1.10 if you are using an older version. (see https://www.arongranberg.com/astar/download).

1 Like

Wow… I’ll be honest, I feel like an idiot right now.
Tried to fix the problem for a week now and I’ve been saying to myself nah the update shouldn’t matter,
I’m too lazy to readjust the changes I’ve made to the scripts.
And what do you know… It looks like the update was the solution.
Anyhow thank you for your help and fast responses! Love the new update and additions you’ve added!

1 Like