How would I approach making an advanced pathfinding system like adopt me?

Hello, everyone, while I was making my pet system I wondered how did adopt me do theirs?

We're pushing a small update today:
🐶Backend Pets changes - they will allow us to make more fun pet updates in the future, but most changes won't affect gameplay yet!
🐾 Pets pathfinding improvements (video)
🏇🏾 Changes to camera movement when riding a pet
💰 Trading bug fixes pic.twitter.com/pIKOTUiCw8

— Adopt Me! (@PlayAdoptMe) November 17, 2020

In their new update, they recently updated their pathfinding system:

In the video above, when the pet finds an obstacle, it dodges it and kind of hides behind the pet owner. Similar features are found in ‘Overlook Bay!’ how can I recreate this kind of effect? Raycast or something in pathfinding? I recently started OOP so, I’m not experienced with pathfinding, can anyone help me?

Any help is appreciated :happy3:

1 Like

This might help you get a start on that.

1 Like

I heard that roblox’s default pathfinding system is bad, and I kind of have to make my own?

It purely depends on how you want the pathfinding system to work. If you manage to pull it off correctly, it could run smoothly even if you do use Roblox’s default pathfinding system. If you aren’t comfortable using Roblox’s admittingly buggy and annoying pathfinding system, you could rely on things like Raycasting to handle obstacle or hazard detection, but results can vary depending on what you do.

1 Like

So, I will have to use a Raycast in front of the pet to detect if anything, other than the white list is in front of it and the make it dodge it?

Depending on the type of map, you might need multiple raycasts to determine which directions it can dodge to avoid situations like making your pet face a wall but end up walking into another. I would however keep track of performance as some of the potential methods of pathfinding might end up becoming too expensive to be practical.

In the current pet custom pathfinding system, I am using BodyGyro, BodyVelocity, BodyPosition, and some Attachments, I also use Tweens to make it seem more smooth. I checked the place’s memory and the Script Activity and Fps, everything seems to work fine to me.

Is that kind of custom pathfinding system expensive? I did not notice any lag or memory leak. :man_shrugging:

Really it all comes to trial and error, you may need to experiment with multiple different pathfinding system ideas to find the one that best suits what you’re after. Some pathfinding systems might experience excessive strain quickly if there are many different npcs using that same system. If your current method is not causing that much strain, you can try testing its maximum limits as well as what would happen if you added raycasting. One NPC usually isn’t enough of a stress test when it comes to pathfinding, and you might need to have many different pets moving at a time to find out if it’s efficient or not.

1 Like