Hey guys, this thread might be a little vague so bare with me and please try and understand.
I’ve created my own custom pathfinding system which requires a grid[x][y] to be created for all possible nodes. On startup, my game takes about 81 seconds to load that grid data fully. I thought to my self if I’m already creating a set of data, and this set never changes, why don’t I just read it in from somewhere rather then recreate.
At this point, I was referred to Lua-AABB-Octree/Octree.lua at master · idiomic/Lua-AABB-Octree · GitHub
What i did was I tried to use this and create a Octree.Octree() with center as 0,0,0 and size as (gridsizeX*gridsizeY)
and basically with my current createGrid method during the create part
I have this currently
function CreateGrid()
local worldBottomLeft = (Vector3.new(0,0,0) - Vector3.new(1,0, 0) * gridWorldSizeX / 2 - Vector3.new(0,0,1) * gridWorldSizeY / 2)
local finalTable = {}
local dataStuffTable = {}
if(makeGrid == true) then
for x=1,gridSizeX, 1 do
Grid[x] = {}
for y=1,gridSizeY, 1 do
local WorldPoint = worldBottomLeft + Vector3.new(1,0,0) * (x * nodeDiameter + nodeRadius) + Vector3.new(0,0,1) * (y * nodeDiameter + nodeRadius)
local min = WorldPoint - (((nodeDiameter + nodeRadius)) * part.Size)
local max = WorldPoint + (((nodeDiameter + nodeRadius)) * part.Size)
local currentRegion = Region3.new(min, max)
local notWalkableFound = false
for _,Part in pairs(game.Workspace:FindPartsInRegion3(currentRegion,nil,5)) do
if(Part.Parent.Name == "Unwalkable" == true) then
notWalkableFound = true
break;
end
end
local walkable = (notWalkableFound == false)
local penalty = 0
if(walkable == false) then
penalty = penalty + obstaclePromityPenalty
--print("obstacle found.")
end
Grid[x][y] = NodeClass.new(walkable, WorldPoint, x, y, penalty)--]]
end
wait()
end
else
print("load from datastore.")
end
Grid.CompletedLoad = true
repeat wait() until Grid.CompletedLoad == true
print("added to datastore.")
--DrawBlocks()
end
Using the octree i add octree:(min.X, min.Y, min.Z, max.X,max.Y, max.Z, NodeClass.new(walkable, WorldPoint, x, y, penalty)
Once this table is done loading, and i try to add the table I still get a datastore max character limit…