I have a block generation system which has caves in it.
The problem is when the caves get big enough a c stack overflow appears.
I have two functions:
function module.UncoverBlocks(target,CaveInfo)
for x = -1,1 do
module.GenerateOre(x,0,0,target, CaveInfo)
end
for y = -1,1 do
module.GenerateOre(0,y,0,target, CaveInfo)
end
for z = -1,1 do
module.GenerateOre(0,0,z,target, CaveInfo)
end
end
function module.GenerateOre(x,y,z,target, CaveInfo)
If Noise > Thrash then
module.UncoverBlocks(OreCFrame, CaveInfo)
end
end
How can i fire these functions recursively without the c stack overflow appearing
Have you looked into Berezaa’s infinite mining game kit? If you haven’t you might give that a look as you can examine the code and get some ideas. He modeled the code after Azure Mines I believe.
Wow you must have some massive caves then. I played with that mining kit and the cave I get to going down through the player area has just a massive cave to the point it was taking like 30 seconds to build it causing me to rewrite it all to make it happen realtime.