- A* version: 5.2.2
- Unity version: 6000.0.29f1
I’m developing a city-building game. I have been using the point graph since the start of the development, as it is easy to include new nodes in the buildings I place, and I’m using AIPath + Seeker to move the agents. The problem is, that the nodes define preferable points for the AI to walk through, but they are not limited to the points, which is good, as I want the agents to be able to find a path even if I place something far from the roads, but this also means that my agents do not avoid obstacles. I’m not talking about other agents, RVO controller does a good job for that, but static buildings and dynamic objects that come, stay in a position for a while, then move (like a parked car). Adding collision doesn’t fix the path, they keep walking towards the object instead of searching a path around it. I was thinking about constraining them to the graph, but that doesn’t really seem to work for the point graph, and it’s also pretty heavy.
Another option I’ve tried was to add a recast graph that covers the entire map, and keep the point graph with the nodes I already have with my buildings. This way I could add penalty to the recast, so they would prefer to walk in the sidewalks, but a single path going through multiple graphs isn’t a thing (can you confirm that please?);
For this second setup, with a point and a recast graph, I had progress meaning they were mostly walking through sidewalks by making them recalculate paths more often and cutting the recast navmesh around the sidewalks, but that also created some failing edge cases, where they recalculated so quick and were stuck going to one way, and then another infinitely.
I would try just recast, as I can cut the navmesh easily in runtime, but I believe defining the sidewalks wouldn’t work very well. Also, There are animals in the game that should not prioritize the sidewalks, so different agents need different setups.
I think maybe using 2 graphs and writing my own path-seeking entity would prolly be the most accurate choice, and that’s an option for the near future, but I have a very important playtest coming soon so I need to solve this ASAP, even if it is not perfect.