I come to the DevForum with a cry for help. (I hardly create topics like this, so you know it’s serious)
In my game, the player has a house template. They can add furniture, and walls to create seperate rooms in the house.
The player (landlord) can then rent the house out to tenants. The tenants are NPCs and currently I use Pathfinding to move them from the entrance of the house into the different areas of the house.
Unfortunately though, the Pathfinding Service is truly terrible. Players are getting stuck at the most random areas in my game.
You can see here that the NPC is stuck facing the wall, where all they had to do was walk out of the grey door behind my character:
Not only that, but when you introduce other things such as objects which the player can collide with, there is further chance of them getting stuck. I have had to make all objects uncollidable, at the expense of taking away from the realism of the game (e.g NPC walks into a shower through it’s back wall)
However, I can’t just make the walls uncollidable. That’d look so bad. I just have no idea what to do now. The problem is that because the user adds their own walls and objects, there’s always a complete different path that the NPC will need to take - and I simply cannot trust the PathfindingService to compute competently.
Example life of an NPC:
Spawn outside > Walk in to designated room of apartment/flat > Walk to shower inside room > Walk to couch > Walk out of the building > Destroy NPC
I have seen from other posts people recommending custom pathfinding solutions - however, I really don’t know where to start with a system like this nor know whether it will work, especially with user-generated furniture and walls, where each house / map is different. The NPC aspect is crucial to my game alongside the “freedom to build” ability to place walls or objects anywhere.
Any help appreciated.