How could I go about custom pathfinding?

Hello everyone, today I set on a project to create my own pathfinding system as it is known that roblox doesn’t provide every situation based best pathfinding system on the platform.

My aim here is to use the given nodes to calcualte a path from the Red to the green cube effectively but have ran into some logical issues whilst thinking of a solution. I am aware of weight systems that can be applied to get the best way to advance to the final destination but what about when we have different distance between each nodes?

I have thought of using depth search from the last node to see all possible routes and the weighted times that it can compare to pick the best one to use but I need some opinions on this.

image

1 Like

A* is a great starting point.

Multiply the weight by the distance.

Depth first search? You can use that but A* is much better suited for this problem.

1 Like

So I continued on the A* process but have ran into an issue, what would be the best way to assign weight to each node on the grid? Currently I just use random index value from a for loop for every node but it causes then these small issues where the algorithm takes a more complicated way towards the end target.

https://gyazo.com/9f9edce88d726737cab849754eb055fa

2 Likes

If you just want to find the shortest path then you don’t need any other cost parameter (weight) than the distance between nodes. Additional weight parameters are for discounting certain edges compared to others, for example in a strategy game like Civ you might have a high weight for edges that go through certain terrain like forest or hills and lower weights for flat ground and even lower for roads.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.