Looking for tips on making a custom Pathfinding AI for city building game

I looked on the dev forums for an example on this topic but I found nothing leading me to asking for help. Roblox Pathfinding is not working for my needs. I need to make a car go from a house to a office. Whilst driving down the road the player placed. I tried to use Roblox pathfinding but that was not working the way I needed it to. Right now I stuck at what to do next, my whole game requires this simple yet daunting script.

Can someone help me out here and point me in the right direction. As it would be nice to get some help as this is foreign to me.

Thanks!

2 Likes

I did something like that with this tutorial

I need a car to follow the road like in sim city. Roblox default is not working in this case. Already tried.

For custom pathfinding i would definitely recommend looking into A* and it various iterations. There should already be some examples, here, on the devforum too.

1 Like

Will that tutorial explain everything I need to know?

The Wikipedia page isn’t much of a tutorial, but there are plenty of resources on it. in your case, it should be as simple as having nodes on the player-placed roads and searching through them, via the algorithm, most likely using a euclidean distance heuristic.

However, i don’t know how you have player-placed roads set-up, so you might have to do somethings a bit differently.

1 Like

Here is a LuaLearning tutorial on it

But, you could try to search up how cities skylines does their system if you have a massive amount of cars at once. If not, I’d say place nodes around turns and intersections and use A*.

If your car is not a humanoid, then try using CFrames to make the car go between points.

1 Like

Ok Thanks for help, Im currently experimenting with Humanoid cars. Might try without next.

1 Like