how’d i go from point X to Y, what pathfinding algorithm do i use and how would i implement that in this situation?
(i have a dictionary containing each nodes UID as a key and a table of the connected node(s) UID(s) as a value)
i tried: looping through the connected nodes connected nodes and continued doing so until the nodes UID matches the destinations UID but as you have probably guessed that’s VERY slow and laggy specially on long distances.
Have you considered using the Pathfinding service that Roblox provides?
See one of my solutions here:
There’s a plethora of pathfinding algorithms out there. A* (pronounced: A star) is often a good option. Although the best algorithm for your particular senerio often depends on what you’re trying to accomplish based primarly on the goal(s) of the system, and secondarily on your representation/availability of data on the system. (This is assuming you aren’t using Roblox’s built-in PathfindingService like @Maelstorm_1973 suggested)
how would i implement that in this situation though, im really bad with pathfindingService
Most pathfinding methods are a variation of Dijkstra’s Algorithm. To use any pathfinding system, you have to build a graph from your map, then you can use the algorithm on that graph. A graph is a group of linked nodes. That is not very feasible on Roblox in LUA . Roblox’s pathfinding service does all this for you. That’s why I highly recommend it so you are not reinventing the wheel. Their pathfinding service is written in either C or C++ which is much faster than anything you could do in LUA.
Look at the links that I posted. The code that I posted is specific to that person’s case, but it should be easily modified to fit your purpose. Also, Roblox has example code in their API documents. That’s where I learned how to use their pathfinding service.