At RDC US, ROBLOX announced some upcoming improvements to PathfindingService (1:32:35). If you aren’t able to watch the linked video, the primary improvements are improved pathing and the ability for NPCs to jump over small gaps. Here’s a screenshot showing how the new PathfindingService maps out the world:
As a developer, even with the upcoming PathfindingService improvements, it’s impossible to integrate PathfindingService with my game.
Let’s imagine that I have a troll that can break down a wall. The troll’s goal is to break into the player’s castle and steal their nexus crystal, but if the castle is fully walled-off and the gates are closed, there’s no way for PathfindingService to find a path to the crystal, despite the troll being able to break down walls. I would either have to program the troll to naively attack random walls, or develop my own pathfinding.
One thing that’d help in general is the ability to specify “portals” to PathfindingService. I’d provide it a start point, an end point, and the time it takes to move between them. I could use this to knit in literal portals with PathfindingService, or in the case of the troll, create a portals with the start/end points being on each wall segment and the “time to move” being the time it took to break through the wall. Once the NPC reached the start point of a portal, I could suspend PathfindingService, the NPC would do what it needed to do (use the literal portal to teleport to another ship, break down the wall, etc) and then resume PathfindingService when I’m done.
Another thing that’d be useful is the ability to weight certain regions with PathfindingService. For instance, once discovered I could mark tripwires as dangerous, or maybe an area a group of enemy soldiers is patrolling, and provide a distance of effect – pathing would try to find a solution around this. I could do the inverse as well, and encourage pathing to go through areas with lots of cover, or healing AoEs.
- NPCs can path through destructible objects, taking into account how long it’d take to destroy them
- NPCs can path through literal portals
- NPCs can use elevators, drawbridges, etc in their paths
- Climbable objects e.g. ladders, a rope which isn’t climbable by ROBLOX NPCs, etc
- NPCs can use Donkey Kong -like human-projectile cannons
- Encourage NPCs to walk through areas with cover, even if it’s slightly longer than a path with no cover
- Stealth NPCs can avoid patrols
- Soldiers can avoid walking into archer/artillery-covered zones
- Fire Skeletons can avoid snow terrain
- Human NPCs can avoid CrackedLava terrain
- NPCs can avoid traps
- Hostile NPCs can avoid neutral territory/safe zones for players
Further Problems Not Resolved
- Pathing for non-land, but “grounded” units e.g. boats, etc
- Pathing for units that can move on all three axes e.g. planes, spaceships, submarines, swimming NPCs, etc
- Size of NPC taken into account by PathfindingService (e.g. a footsoldier could fit through a human door, but a troll could not)
- Mass of NPC taken into account by PathfindingService when determining jumps (a flea can make huge jumps, but a troll can’t really jump)