Hello there! I make a generation like in minecraft, but I have one problem. It takes so long to generate it. for example, while generating 50x50x50 world it would cause script execution limit. Or if I place task.wait(), it will take forever to load 125000 blocks. Here are the parts used to generate blocks:
for x = 0,50,1 do
for z = 0,50,1 do
for y = 80,130,1 do
block=generationmodule.GetBlock(x,y,z,0.1)
blockdata.AddBlockToList(block,{x,y,z},{})
task.wait()
end
end
end
print("Successfully Generated The World!")
rs.RemoteEvents.RenderWorld:FireAllClients(blockdata.BlockList)
function module.AddBlockToList(name,pos,data)
local x= tostring(pos[1])
local y = tostring(pos[2])
local z =tostring(pos[3])
if not module.BlockList[x] then
module.BlockList[x]={}
end
if not module.BlockList[x][y] then
module.BlockList[x][y]={}
end
module.BlockList[x][y][z]={['name']=name,['position']=pos,['data']=data}
end
function module.GetBlock(x,y,z,seed)
local amplitude=100
--print(math.noise(x,z,seed))
--local sin=math.sin(x*4)/4
--print(sin)
local noise=math.noise(x/100,z/100,seed)
--local noise=perlinnoise.new({x,0,z,seed},amplitude,4)
local surfacey=80+(noise)*amplitude
if surfacey>y then
return 'Stone'
else
return 'Air'
end
end