Hello! I made a procedural terrain generation system, and I’m wondering how exactly I can smooth out… Well… This:
if x % BiomeSize == 0 and z % BiomeSize == 0 then -- In this example it will pause after each 100 loops
if debounce == true then
debounce = false
print("Change biomes!")
currentBiome = Biomes[math.random(1, #Biomes)]
print(currentBiome)
wait(1)
debounce = true
end
end
function module.GenerateTerrain()
if currentBiome == nil then
currentBiome = Biomes[math.random(1, #Biomes)]
end
for z = 1, Area2 do
for x = 1, Area2 do
local Brush = currentBiome:GetAttribute("Brush")
local ErosionScaleFactor = currentBiome:GetAttribute("ErosionScaleFactor")
local Foilage = currentBiome:GetAttribute("Foilage")
local Rocks = currentBiome:GetAttribute("Rocks")
local ScaleFactor = currentBiome:GetAttribute("ScaleFactor")
local Trees = currentBiome:GetAttribute("Trees")
local Ymultiplier = currentBiome:GetAttribute("Ymultiplier")
local ErosionY = Ymultiplier - math.random(-2, 2)
local Content = math.noise(x / ScaleFactor + ofsX, z / ScaleFactor + ofsZ, 0)
local Erosion = math.noise(x / ErosionScaleFactor + ofsX, z / ErosionScaleFactor + ofsZ, 0)
module.CreateVoxel(x * Ratio,(Content * (Ymultiplier * Ratio)) - (Erosion * (ErosionY * Ratio)), z * Ratio)
if x % ChunkSize == 0 then -- In this example it will pause after each 100 loops
task.wait()
end
local debounce = true
if x % BiomeSize == 0 and z % BiomeSize == 0 then -- In this example it will pause after each 100 loops
if debounce == true then
debounce = false
print("Change biomes!")
currentBiome = Biomes[math.random(1, #Biomes)]
print(currentBiome)
wait(1)
debounce = true
end
end
end
end
workspace.Terrain:SetAttribute("Loading", false)
module.GenerateSealevel(58)
end
Thanks,
- Luke