How is it squared tho, would i use incrementing (snapping) for this?
eg: math.floor(Position.X / 4) * 4
How is it squared tho, would i use incrementing (snapping) for this?
eg: math.floor(Position.X / 4) * 4
I think you should try your luck with rounding numbers
It’s not too easy to make, you should check this link if you want to know how it works: Heap (data structure) - Wikipedia
Also here’s a video to see it better (@IDontWantToBuild made it) :
Another alternative is to get all the Positions of points on a grid and find the point closest to the waypoint using magnitude and highlighting it
Yeah that was what i was thinking i should do, build premade grids, update pathfinding then use magnitude to find the closest grid to that waypoint and highlight.
Thank you so much i’m gonna take a look at this and come back to you, but do you know how i could implement it into roblox, i see pathfinding in the output which makes sense.
I’ll try to write up a script for grids.
I’m not too experienced on this type of pathfind (btw it doesn’t use the Roblox Pathfind service), but this calculates the closest part to the part that is currently the color on (the color is just to visualize it) on an specific grid.
I actually think you’re looking for a graph searching algorithm, like A*? Using a grid map–it’s usually trivial to implement. Also, a heap is just a data structure that you might find commonly being used alongside a pathfinding algorithm like A* (it’s used for other things).
Oh, so for example so it finds the closest part to that grid using math.min and magnitudes and so on, i’m not sure still.
In the vid you sent it fills the corners so we might want to consider a function that does that also.
is this possible in lua, i’m still not sure if the pathfinding system is custom or roblox system based.
I think you can just use pathfinding without the person moving.
Can you tell us the context of what your trying to do? it may help us find easier solutions
I’m just trying to implement a unique pathfinding system into my future games,
better than a beam or something lol.
I’m unsure if it is custom or not–if the path is only constrained to a specific place on the ground, it might be.
In terms of if it’s possible to implement, the answer is absolutely. I implemented A* not too long ago (even though it was a bit rough, in terms of organization). If you search for ‘A* pathfinding’ or ‘Custom pathfinding system’ on the dev forum there should a quite a bit of posts and topics about it.
Also pinging, @IdiomicLanguage, as he’s making a pathfinding system, that might improve on some of Roblox’s current pathfinding shortcomings.
I will now risk brain damage by trying to edit the pathfinding system lol
I never heard about A* considering it’s my first time doing a “custom pathfinding”, although do you think i can replicate this pathfinding system in a simpler way, this is confusing me
If the grid is unweighted, you can simply perform a Breadth-First Search starting from your start location. It’s very simple:
function findShortestPath(src, dest)
local queue = {src}
local visited = {[src] = true}
local parent = {}
while #queue > 0 do
local node = table.remove(queue, 1)
if node == dest then break end
for _, neighbor in ipairs(node.neighbors) do
if not neighbor.isObstructed then
-- you can have another separate routine updating this property
if not visited[neighbor] then
visited[neighbor] = true
parent[neighbor] = node
table.insert(queue, neighbor)
end
end
end
end
if parent[dest] then
-- if destination has a parent, there exists a path from start to finish
local path = {}
local temp = dest
while temp do
table.insert(path, temp)
temp = parent[temp]
end
-- list of nodes from destination to source (start)
return path
end
end
It may also help to familiarize yourself with some of the basics of Graph Theory.