Path finding on generated NavMesh #2787
Replies: 7 comments 4 replies
-
Interesting :)
As this is an extension that will be in the "core", it will have to be maintained, so the rule of thumb is to check we're using something as simple, lightweight and performant as possible. In the case of an extension like this relying a lot on object hitboxes, it would be worth checking if we can store the objects in a RBush, like the platformer behavior, the existing pathfinding behavior and the light obstacle. I had a PR to do this a while ago: #1393 |
Beta Was this translation helpful? Give feedback.
-
There is a good resource about NavMesh generation: http://www.critterai.org/projects/nmgen_study/ For 2D, "only" these algorithms should be needed:
The NavMesh generation clearly seem very costly. There are algorithms to update it, but even a static one with an action to build it after the level is set should be useful. It could even be generated by the IDE if it's too long to process. |
Beta Was this translation helpful? Give feedback.
-
I still have some cleaning to do and tests to write but it's nearly done. |
Beta Was this translation helpful? Give feedback.
-
The isometric example with NavMesh (try to go to the small island in one click) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I'm trying more complex cases to find limitations. I realize a limitation (which was documented, but I didn't see the implication) about the A-star pathfinding on NavMesh library I used. The A-Star heuristic is based on the center of each polygon. This work well on rectangular grids but here with the funneling algorithm, the path won't go through polygon centers (in orange). In the following screenshot, the character will make a weird detour (in red). I also made some few changes to generate better NavMesh. |
Beta Was this translation helpful? Give feedback.
-
I continued to work on the vertex merging to handle imbrication and vertices shared by more than 3 regions. I did a small example to generate cases (it logs the obstacles positions, so if you find something weird, please copy paste it): |
Beta Was this translation helpful? Give feedback.
-
Navigation meshes seems to be a good search space in term of performances and allows to find path that seem rather natural (line segments).
There is an MIT JavaScript library that do path finding on NavMesh:
https://github.com/mikewesthad/navmesh
I guess it could be interesting to integrate a library like this into the path finding behavior. It may be challenging to handle moving obstacles if NavMesh generation is costly.
Is there some rules to follow to add a dependency to the engine?
Beta Was this translation helpful? Give feedback.
All reactions