I want to thank @Artzified for his tutorial and @tracedrounds that helped me a lot there, thanks to them i managed to create a somewhat stable Optimized A* pathfinding algorithm.
I am so happy to announce that i am open sourcing my pathfinding code for everyone.
Here is the place for testing TestAStar.rbxl (79.0 KB)
(Please if you find any bugs or Any improvements post them here below)
In the next Episode i will try to make An a* pathfinding algorithm based on @tracedrounds code. if i get time
here is a video to demonstrate: robloxapp-20240731-1251031.wmv (700.4 KB)
That comment doesnt help at all. saying “3d flying is unoptimized” doesnt help much. Adding 2 more nodes for +vector3.YAxist and -Vector3.Yaxis is not any different than adding 2 nodes in the X or Z scale. Also you are not helping.
If you cant help, please refrain from adding more comments here.
Let’s say your algorithm searches an area 10x10 studs, that’s 100 studs scanned, seem pretty good. Scanning an additional axis would mean 1000 studs and doing this on a larger scale could be devastating. Especially if there are multiple obstacles. This would mean too much lag on computing. Rather, take my approach of using raycasts to see if the next node is above our initial height and then set our height to that specified height which is much more optimised and that’s what I did for my algorithm.
Also you’re suppose to upload an mp4 file for a better preview as well as benchmark results on how much optimised this is.
take my approach of using raycasts to see if the next node is above our initial height
Elaborate on that? You dont need raycast to check if the next node is higher than the initial node. You can check the Y coordinates for that also Workspace:getPartBoundsInRadius is sort of raycasting to check if the point is inside a map block
Regarding the 3dgrid. I am using a dynamic(No premade node) pathfinding that is based on directions only. Seems like you havent opened the project to check the code.
Guys you do not need 3d movement. You only need to move the npc 2d based on ground below while checking front and up directions for collisions and adjusting flight height with it. Yes it will rarely take longer paths but you are saving a lot of frames.
That’s true but most games usually have some depth to them as well. It could be good for some games but for most you need some y axis implementation that is optimised.
Maybe. I am currently on vacation but just giving a basic idea is that you need to cast a ray 7 studs or move above from your presummed next point downwords to about 20 studs and also cast rays from the point where the topray impacted a part to see if there is sufficient space. Also use workspace:GetPartsInRadius to see if that point is actually traversible or not. Or just use raycasts.
Basically:
parentNode -- our parent node
local nodePosition = -- our nodes position
local heightRay = Raycast(nodePosition+Vector3.yAxis*10-Vector3.yAxis*20)
if heightRay then
local upCheckRay = Raycast(heightRay.Position,Vector3.yAxis*7)
local collissionRay = Raycast(parentNode.Position+Vector3.yAxis*7,direction) -- where direction is basically where the new node would be.
if not upCheckRay and not collissionRay then
--make your point
end
end
Yep, sometimes it happens and i dont know why. I have been looking for help about the timeout for 2 months now. I cant seem to trace the issue sadly. That is why i seek for help as well.