How does the NPC works in the Roblox experience Piggy?

I assume everybody had played Piggy before, heck it even is my favorite game I always wonder how their NPC works. I know for a fact that it used PathfindingService, however what surprised me is that the path seems to work even though there’s blocking obstacles in the path. For example, when you go to a room with a shutted door, the NPC somehow still go to the path regardless of the path is blocked by the door, and when they touch it, they open the door and continue walking. How does this works?

1 Like

I am not really sure, but I think the doors use a trigger zone for the bot and when the bot “opens” the door, it stops it’s movement, makes the door effects, and then continue with moving along. The trigger zone must be higher than the bot, atleast 2x in size.

The NPC in piggy uses something called Character Pathfinding | Roblox Creator Documentation. You can read this article for more information about it.

He already said it. No need to say it again

1 Like

That answers the “hitbox” for the door. I’m still amazed how the path doesn’t errors. I remember that PathfindingService counts non-collidable instances as an obstacle.

I am not into Pathfinding, so I can’t say much about it. I used my imagination there, and if I had luck, it could be the actual use of the mechanic.

1 Like

I’d guess that the doors are set up to not block pathfinding (so would be blacklisted out in some way) that way the path calculated will ignore them.
But then just need some other logic that when it hits a door (using a touched or a region detection or something) it then stops/opens the door, and can then carry on pathfinding

1 Like

That isn’t my question. Please reread.

Some parts of the map could be client generated therefore won’t be visible in the server allowing pathfinding to not error.