As a roblox developer, I am constantly trying to think of new ways to make my NPCs seem smarter, react faster and ultimately reach goals within my games.
Being able to pathfind is essential for this and the recent Pathfinding service (Both for the voxel based pathfinding and now the more recent Navigation Mesh) is a fantastic way to achieve this. Its incredibly quick, and really dynamic!
However, it doesn’t come problem free. Voxel based path-finding uses voxels, which can make traversing a map not built specifically for (Or even a few studs out) of the voxel grid very difficult. The new Navigation Mesh (While I’m sure is still being improved) has some issues creating the mesh within small spaces.
Navigation mesh minor bugs
These also don’t take into account use besides default humanoids. There are methods around this which require either some strange uses of BodyMovers or CFraming. I have noticed there is a property in Waypoints called “Action”. So far there are only two applications of this; Walk or Jump. But what if there were more actions we could tie to this?
The issue is that with the current system, I can’t. I could create an object at the base of this part that would send an npc up, but the pathfinder couldn’t see that or I could do create two paths, but even then I would have to know that this is the part I want to be climbing. This is where I think it would be really useful to be able to access and edit the Navmesh, or at the very least be able to create action flags and links between edges.
Here is an example of reaching a raised platform using Joins in the Navmesh and writable Actions
Our setup
There are two joins in the navmesh here.
The first is a point to point join, our green “teleport” line. We can treat this as a single waypoint and give it the Action “Teleport”. As with everything to do with Pathfinding, we can code an NPCs response to this action.
Our second is an edge to edge join, our red edges with black connections and our green “leap” line. If we give this the action “Leap” when our NPC reaches this section of the path, it will know that it must increase its walkspeed while between these edges. The act of getting across could be an animation, but being able to define it in a path is the only thing we’ll worry about.
Logic
The ability to define an Action property doesn’t necesarily have to deal with just movement either, it can be used to help an NPC work logic, such as doors with switches.
We don’t actually have a clear path though. There is a door in the way.
We could however define this particular part of the Navmesh as “Door” and create an appropriate Action, like “Switch”
At the point of creating the path, we could see this and tell our NPC that we have a closed door and we should go and open it.
Thats really three paths, one to find a piece of information and two to solve the problem it faces. We don’t even necessarily need to go to another point, we could just call the first lines action “Door” and tell the character to search for and open a door at this point.
Conclusion
This would be an incredibly powerful tool when creating NPCs, either being able to create our own joints or setting Actions for waypoints by themselves would be incredibly useful. It would allow us to further create enemies/allies/characters that can navigate a maps with notable “intelligence”.
It would also be cool if we edit the navmesh to determine what we want considered for a specific place.
Thank you for reading this far, if you’ve been following my posts and replies for the past few months I’m sure you’ll know why I’m pushing for this sort of thing!
Either way, these are fantastic services and if you aren’t already using them I would suggest looking into them for your games
Wiki article: http://wiki.roblox.com/index.php?title=API:Class/PathfindingService
Voxel based: http://wiki.roblox.com/index.php?title=Pathfinding