Compatible with Entities (ECS) and DOTS Framework?

I will have to look into rewriting the scripts such as path modifiers so they can run in DOTS. I’ve gone over this thread a few times: LightweightRVO in ECS but I don’t quite see the big picture… not sure if I still need to rewrite a bunch of the scripts to be ECS compatible.

I tried running AstarPath.StartPath() in a job, but it fails if the job is bursted. ABPath.Construct complains that “Burst error BC1032: Using function pointers/delegates is not supported” and StartPath() complains that “get_isPlaying can only be called from the main thread”). A lot of the functions in A*PFP weren’t really developed for burst from the start so I suppose that’s to be expected. I had to move the path constructor and start-path functions to the main thread.

As for navmesh cutting, I finally gave up trying to figure it out… it seems like everything ties back to reliance on that NavmeshClipper game-object. I couldn’t find anything lower-level than that. Maybe there is a way to do it without game-objects, but I spent a long time searching and didn’t find anything.

I was able to get something working just by using UpdateGraph() and setting the boundary area to non-walkable. After setting the nodes to non-walkable, I walked through all the paths of existing agent and called a function DoesLineSegmentIntersectSphere() to determine if the particular agent intersects the building the player just dropped. If the agent’s current path intersects the new building, then I tell the agent to find another path (StartPath) and it routes around it. It seems to work okay.

One thing that I don’t like is that I’m using a grid graph, and I had the erosion value set to 1, but at 1, it leaves a large area around the newly placed building where the agents can’t go. If I set the erosion to 0, that cuts closer to the new building, which is good, but then the rest of the graph has problems because it places walking areas so close to the edge of cliffs that my agents fall off of them. I think I may try the recast graph again, although back when I first started, I wasn’t having much luck with it.