A* Pathfinding Project

Open World, Inside areas and outside areas



I am making an open world game. At the moment I’m using a grid graph which works pretty well. I don’t want to use a recast graph because of the scan time and it doesn’t handle penalties so well (please tell me if this is incorrect). I also see repeatedly in the forums that one graph is recommended. However I need finer detail and would like to rotate my graph to match the inside of the building (otherwise obstacle diameter is not straight and the nodes are to big). How best to deal with this? , it seems like one grid graph for inside buildings(per buidling) and another for the openworld is the way to go?



That’s pretty tricky. Are your buildings connected to the outside so that the character can just walk between them, or do they not need to be connected?


The buildings are in the game world, the character can just walk in through an open door, I believe I have almost mitigated the problems by using a recast graph on my 2049x2049 world chunk and navmesh cutting. I realized that it was the accuracy of the obstacles that is the real problem not the pathfinding so much. I would still be interested in a way of doing this. Since you recommend only one graph (i presume this is for optimization/the fact that points on the graphs would have to match up perfectly to travel between them?) I will probably stick with what i have.


I do find it odd that I will need to have a navmesh cut for my npcs and a collider for my player on every object. I suppose this is normal (I am still learning).


That’s usually not normal. Why do you need navmesh cuts on your NPCs? Agents that move around should pretty much never have navmesh cuts attached to them.


Oh sorry I did not make myself clear. The navmesh cuts are for obstacles, npc collision with the player is handled with rvo. I meant the player will need normal unity box colliders on all obstacles etc and the npcs will need navmesh cuts for all the obstacles. I can’t really use the obstacles layer because the recast graph is so big its hard to control the borders on everything in a 2049x2049 chunk.


Ah I see.
Yeah, that’s unfortunately how it has to be. Normally one wouldn’t use it of course because the recast graph would use the colliders directly, but since you are running into resolution problems then you will have to use navmesh cutting.
Note that you can use tiling on the recast graph. If you are not using that I strongly recommend it. That can bring down the scanning times a lot as it can use multi-threading more effectively.