Reachable points before commiting to grid graph

Hi there,

I’m making a builder along the same line as Two Point Hospital, in which you can drag/drop, edit, create a whole room within pre-built foundations that can contain one or several entrance points.

When I drop a room, or an item, I call an update on the grid graph so that all my agents can consider this change when calculating new paths. This works great!

Now I would like to add extra validation before having my players able to commit a whole new room. One of these validation is to make sure that all the other rooms are still accessible from the main doors.

However, since the new room is still being edited and not commited yet to the grid graph, I can’t run a path check on the current grid graph.

Any suggestion? Should I maintain 2 grid graphs?

Thanks for your help!

Hi

I think this method is exactly the one that you want https://arongranberg.com/astar/docs/graphupdateutilities.html#UpdateGraphsNoBlock2

See also the bottom of this page: https://arongranberg.com/astar/docs/graphupdates.html#blocking

Thanks Aron for the insight, I’ll try that.