Layered Grid based on procedural dynamic voxel terrain

I have a procedural voxel terrain system that generates during runtime (minecraft-like) and fits really nicely with a layered grid graph, however my plan is to have the world be multiplayer and have the server-side do all the pathing calculations, which means the area needs to be quite expansive as the terrain system is infinite and I plan to hopefully support as many players as possible.

Is there a way to generate nodes for a grid graph during my voxel generation? It would be quite easy and convenient if I can just put a grid node in the middle of each voxel and then run pathfinding calculations off that. And can the nodes be destroyed and created when voxels in my world are created/destroyed?

If the above is not possible, I plan to just have a layered grid graph follow each player around the chunks and just rescan if a block is changed-- the above would be much prefered by me if possible. but if not, how many graphs at once can be handled?

EDIT: I see some DestroyNode functions and stuff in the classes reference, so it seems like thats possible, however I’m having trouble finding anything about manually creating nodes.

EDIT 2: Based on this, it seems like I just CreateNodes(amount); and then cycle through and place all the nodes and then their connections.

Can the node amount be dynamically updated to include more or less based on voxel updates, without having to update the entire graph via the scan function?

Hi

Sorry for the late answer.

You can use a graph update to update parts of the graph when the world is changed.
See http://arongranberg.com/astar/docs_dev/graph-updates.php
There is no API to destroy or add individual nodes to a LayerGridGraph.

This is a bit problematic when the player moves outside the whole graph however.
But since this is serverside, a delay is not so critical.
So I suggest that you move the graph and then call AstarPath.active.Scan() to recalculate it completely when the player has moved far enough away from the center of the graph. This will cause a delay, but it’s only on the server.

You can set the center using:
var graph = AstarPath.active.astarData.graphs[0] as LayerGridGraph; graph.center = center;

Ideally I would rewrite the ProceduralGridMover (see Procedural example scene) to also work with a LayerGridGraph, but that would take some time since it is not as simple as with a grid graph, and unfortunately I don’t have that time right now.