Hello, I’m a novice programmer in C#, but I’ve managed to get a project working with a procedurally generated point graph. I’ve been instantiating empty game objects, parenting them to a A* gameobject with AStartPath script attached, and then I just call AstarPath.active.Scan (), every time I want it to update. It’s a voxel world so you can imagine that as the player digs through the terrain, empty gameobjects are instantiated, and then the scan can start freezing the game for a second. I’m pretty sure this is not the optimal way of doing things. I’ve tried implementing graph updates as described here: arongranberg.com/astar/docs/graph-updates.php but I’m doing something wrong, I just don’t know what. Does anyone have a similar project that I could take a look at that uses the Graph Update and adds and subtracts points on a point graph at runtime? You would make my day! Actually you would make my month!
Hi
Are you using the pro version?
If you are, make sure that “Optimize For Sparse Graph” is enabled. That can reduce the calculation time drastically (like, by a factor of 100 on normal graphs).
There is an API in the point graph for adding points (here), but currently it cannot remove points, however you could consider making points unwalkable instead which has roughly the same effect, and then maybe reusing them instead of creating new points later on).
Thanks for your answer.
I’m not using the pro version, but it looks like I’ll be shelling out the ben franklin for that soon. Not that I’m complaining - from what I can tell this is a well written asset, and I’ve gotten farther with this than any other one I’ve tried so far.
So then would it make sense to create a waypoint on every voxel, and then just update whether they are walkable or unwalkable as the voxel world updates? The world is not that big at the moment: 128 wide x 64 high x 3 deep = 24,576 waypoints. I don’t anticipate it getting much bigger than that.
If this is possible, could you point me towards example code for making waypoints walkable and unwalkable?