Okay, So I am making a game with a huge area and I am kinda pushing the pathfinding. The map is 10000 by 10000. The pathfinding is pretty good however at a certain points with several impassible objects it cant find a destination.
I can however create my own sort of pathfinding assistance by basically doing this
Pathfinding failed?–> find path to object1(object that is in between the two points)
Object 1 reached-> Find path towards endpoint.
That works but it feels like extra steps. Is it possible to extend the pathfinding somehow without those extra steps?
Your approach seems reasonable. If the destination can’t be reached either retry or change the destination.
The Pathfinder behavior can be temperamental. It also has some flaws. Mainly, it doesn’t handle rotated objects correctly. It sort of treats the objects as unrotated but not exactly. It’s best to resize an object instead of rotating it. Make a 10x20 object 20x10 instead of rotating it.
There’s another Pathfinder called Nav Mesh. I don’t know if it has the same issue although in testing, it didn’t always take the shortest path.
The Pathfinder needs a method to either tell you where it’s blocked or maybe let it get as close as it can get.
You can do a few things beyond setting objects to passable. You can reduce the grid width and height. The small the grid, the closer it can get to objects. If it’s too small it’s going to take longer to process. Too large and it could ignore objects. You can also align the objects to the same grid spacing size.
The default Pathfinder uses the bounding box not the hit box. So, while you can’t use a smaller hitbox, you can use a hidden smaller object for the pathfinding with the visible object stuck to it. That would allow you to get into tighter spaces although, the objects could then overlap a little in tight spaces.
I don’t know the maximum distance. I tried it on my phone with a ridiculously large number and it locked up my browser. IDK if it’s a storage issue or it just takes a long time to process. It’s weird though because I only had a few obstacle objects in the scene.
Thanks everyone, right now I am on a holiday but I will work on it and update the thread with how it is working. If there are more suggestions please let me know.
Sadly it doesnt work at all. And that is weird, I must be doing to wrong. For now I will continue using the standard one and revisit this problem in my game later.