NavMesh Pathfinding

We already have a method of pathfinding, but it doesn’t always give us enough control to do what we want. Take this scenario for instance:

We would like the NPC to navigate to the entrance to the cave. This is the path we desire it to take:

However, with the current pathfinding system, this is the path the NPC will take:

The actual path it takes is not realistic – we want at least somewhat of a sense of realism in our AIs. There’s a certain amount of studs that an NPC is allowed to jump down in pathfinding, but sometimes maps aren’t always so clear cut. The path it takes in the last picture could be a rocky slope not meant to be used for travel but instead just for decoration, or it could be a path only meant for players to quickly a ccess parts of the map. Regardless of which scenario, we don’t want the NPC taking that path. In this case, our only solution is NavMesh or node map pathfinding. Node map pathfinding can’t hold a candle to NavMesh pathfinding, so NavMesh pathfinding would be the obvious choice. However, not only is such a system executed in Lua not as fast as it could be if executed from the C side of ROBLOX, not every developer can program a NavMesh pathfinding system himself/herself. Not all levels on ROBLOX are dynamic, and in that case NavMesh pathfinding may be preferred, or even a combination of the two where AIs use the existing pathfinding to navigate around short, dynamic obstacles in their current NavMesh path.

NavMesh, although tedious to set up for a level, is not difficult to use. Any developer that can use the existing pathfinding system can use a NavMesh pathfinding system. In order for us to have more control over our AI pathfinding and gain access to faster processing speed, ROBLOX should implement a NavMesh pathfinding system in tandem with the existing system at some point in time. They do not have to replace each other – the existing system is meant for dynamic maps, while NavMesh pathfinding is meant for precise control and predictable environments.

15 Likes

I greatly support this because I am always in need of a NavMesh in all of my games… Not to mention NavMesh is one of best pathfinding options available.

I don’t get what NavMesh is

Why not just use an invisible wall there

Because if there’s an invisible wall there it means that you can’t shoot projectiles (bullets, arrows, etc) through it, players can’t take paths except the ones designed for NPCs since there’s an invisible wall in the way of every other path (which would be extremely aggravating),

Using hand-placed triangles to determine bounds where NPCs can move within:

Going back to the invisible wall thing, let’s take that path on the right side of the screen. With current pathfinding, they’d just go this way:

With NavMesh, they behave like normal human beings would and take the path up to the marketplace:

If we used invisible walls there, players couldn’t take the shortcut in the first of the two images and they’d likely quit the game because they were running into invisible walls every time they tried to go somewhere.

3 Likes

I would love to have this as a built in feature along side regular path finding.

Using hand-placed triangles to determine bounds where NPCs can move within[/quote]

9 out of 10 game engines automatically calculate navmeshes for a level(On map compile, not when launching a level) Tbh I’ve never known anyone would ever hand-place navmeshes

1 Like

Using hand-placed triangles to determine bounds where NPCs can move within[/quote]

9 out of 10 game engines automatically calculate navmeshes for a level(On map compile, not when launching a level) Tbh I’ve never known anyone would ever hand-place navmeshes[/quote]

Of course the base for it is auto-generated, but you have to go back in and fine tune it. Sometimes the auto-generator missed a spot or accidentally made a path through a tiny space that isn’t accessible. In the picture in my response to Aurarus, maybe it generated a path through that grass so that NPCs would walk through the grass and not use the path. Maybe you want NPCs to be able to jump down a one-way ledge. Regardless, you always have to go back in and make sure everything is how you want it by hand.

Using hand-placed triangles to determine bounds where NPCs can move within[/quote]

9 out of 10 game engines automatically calculate navmeshes for a level(On map compile, not when launching a level) Tbh I’ve never known anyone would ever hand-place navmeshes[/quote]

Of course the base for it is auto-generated, but you have to go back in and fine tune it. Sometimes the auto-generator missed a spot or accidentally made a path through a tiny space that isn’t accessible. In the picture in my response to Aurarus, maybe it generated a path through that grass so that NPCs would walk through the grass and not use the path. Maybe you want NPCs to be able to jump down a one-way ledge. Regardless, you always have to go back in and make sure everything is how you want it by hand.[/quote]

Yeah that’s correct, you just weren’t saying that in the post, hope I wasn’t too nitpicky

I’m working on navmesh pathfinding, but I can’t guarantee I’ll finish it. Mostly because I can’t focus on writing it, and I’m working on other projects. It would use a hand placed navmesh, and in theory it would be very fast to do the precalculations and ridiculously fast to calculate the actual path. I’ve got the ideas all laid out in comments. Just a matter of writing the code…

2 Likes

Your problem is basically solved as Pathfinding modifiers and collision groups are a thing. So you can create areas where the agent won’t go while projectiles gan go through it.
[Edit]:forgot to mention that you can create areas where the agent will prefer to go, pathfinding modifiers are your solution

1 Like

I totally agree with you. Navmeshes should have been added on roblox a long time ago.

While it is possible (for some people) to make it, as you said the performance isn’t going to be as good as if it was directly implemented in roblox.

I am doing research on pathfinding and I am trying to combine navmeshes with the A* algorithm and I do have to say that there isn’t much information about it because its mainly only a built in feature in unity and the actual way that they get generated or work isn’t well documented.

Roblox has used a Navigation Mesh system for about 7 years now.

In fact, I think it’s the same system Unity and Unreal use:

:muscle: Industry Standard - Recast powers AI navigation features in Unity, Unreal, Godot, O3DE and countless AAA and indie games and engines

You should be more specific about what you need. The original request of this Feature Request has already been fulfilled with PathfindingModifiers, so ideally you should create a new Feature Request.

1 Like

Oh, i didn’t even know that! I was reading about roblox pathfinding and I heard that it uses dijkstra and it’s not the best algorithm and I heard people complaining about it. So why do people or commissioner want custom pathfinding.

What are the issues with normal pathfinding??

bro answers one eight years later and bumped the thread

Sadly I can’t express my sense of humor using a LOL in this message because it would be less than 30char so I am expressinng it with this message, that is very true what you said there!

1 Like