Hello,
Sorry to bother everyone, i was trying to post on the devforum but i still can't seem to be able to post there. Anyways, i am currently trying to make terrain generation for my game, the only issue... it has a looooooooooooooot of parts. I was wondering if there was a way to make it lag less? This is the script i have that generates the terrain.
noiseScale = 30 -- Smoothing (Default 30) amplitude = 10 -- Height Fluctuation (Default 10) blockSize = 4 -- Size of each block (Default 4) maxXSize = 2048/blockSize maxYSize = 64 maxZSize = 2048/blockSize seed = math.randomseed(tick()) for x = -(maxXSize / 2), maxXSize do for z = -(maxZSize / 2), maxZSize do for y = 0, maxYSize do xNoise = math.noise(y/noiseScale, z/noiseScale, seed) * amplitude yNoise = math.noise(x/noiseScale, z/noiseScale, seed) * amplitude zNoise = math.noise(x/noiseScale, y/noiseScale, seed) * amplitude density = xNoise + yNoise + zNoise + y if density < 25 and density > 23 then parts = Instance.new("Part",game.Workspace.Terrain) parts.Anchored = true; parts.Size = Vector3.new(blockSize, blockSize, blockSize) parts.CFrame = CFrame.new(x * blockSize, y * blockSize, z * blockSize) parts.TopSurface = Enum.SurfaceType.Smooth parts.CastShadow = false parts.Massless = true end end end wait(0.3) end
I have tried everything i can think of to make each part lag less but it has reached the point where it is not enough. With my current script, there should be around...524,288 parts(this is just an approximation, maybe there is 100k more for all i know...). Anyways, is there a way to use less parts or at least not make it lag as much.
Thank you! :D