Enhanced PathfindingModifier for Selective Ignoring

Motivation

As a Roblox developer, it is currently too hard to create NPCs that ignore specific doors or areas where they should not go. I have tried using Key Costs in the agentParameters, but it does not achieve the desired effect. I want one or more NPCs to completely ignore certain PathfindingModifiers so that they do not move to those areas. I have also attempted workarounds, such as blocking the door with parts that become non-collidable upon opening, but these solutions do not work as intended.

Development Improvement

If this issue is addressed, it would improve my development experience because it would allow for more nuanced and dynamic NPC behaviors in my game. This would enable me to create more complex and engaging gameplay mechanics without resorting to convoluted workarounds or compromises.

Use Cases

  1. Diverse NPC Pathfinding: In my game, I have NPC A and NPC B. NPC A needs to pass through certain doors marked with a PathfindingModifier, while NPC B should ignore these modifiers and find alternate routes. This creates strategic gameplay where different NPCs have unique movement patterns.

  2. Customizable NPC Behaviors: Allowing specific NPCs to ignore certain PathfindingModifiers would enable developers to easily customize NPC behaviors. For instance, some NPCs might be able to traverse hazardous areas that others avoid, enhancing the gameplay experience.

  3. Performance and Efficiency: Instead of implementing complex scripts to manually handle pathfinding for different NPCs, having built-in support for ignoring PathfindingModifiers would streamline the development process and improve game performance by utilizing the pathfinding system already provided by Roblox.

Proposed Solution (Optional Note)
One possible implementation could involve extending the agentParameters table to include a field for ignoring specific PathfindingModifiers. For example:

local agentParameters = {
    IgnoredModifiers = {
        Door1 = true,
    }
}

In this case, NPC B would have agentParameters set to ignore the PathfindingModifier labeled Door1, while NPC A would adhere to it.

2 Likes

I understand this for example with doors, as PassThrough cannot be configured per-path, but,

, is this not already achievable by giving the two NPCs different costs for the same Modifier?

1 Like

I want to confine NPC A to a room only using one door “Door1”, while NPC B can freely pass through. NPC A should stay in the room unless NPC B opens the door, allowing NPC A to follow. Otherwise, NPC A gets stuck at the door, trying to pass through. Implementing costs is futile, I need to exempt one NPC from it.

2 Likes

What about PathfindingLinks? Have one NPC recognize the link, and give the other, dependent NPC an infinite cost for the link’s label (i.e. unusable). This also means there shouldn’t be a PassThrough Modifier on the door:

dependent-npcs-pathinglinks.rbxl (83.4 KB)

3 Likes

I tried it with my NPCs, and it actually worked. Of course, one mustn’t forget to add Path.Status ~= Enum.PathStatus.Success for it to work correctly. Thank you very much. :yellow_heart: Naturally, I would like a function as described above because it could make it easier for future developers.

1 Like