Hey guys, so I tried making a voxel terrain generator because I was bored and wanted to just get a headache on how to do it. It took me a bunch of brain damage to figure out how to do it because I don’t know the maths required to make a Perlin noise based procedural terrain generation.
Model link:
If you don’t want to get the model, here is the script I used:
--Terraingenerator.lua
local terrain = {}
local size = Vector3.new(100, 16, 100)
function terrain.Create()
for x = 1, size.X do
for z = 1, size.Z do
local noise = math.noise(z * 0.05, size.Y, x * 0.05) * 10
local part = Instance.new("Part")
part.Anchored = true
part.Position = Vector3.new(x - size.X / 2,noise/2 , z - size.Z / 2)
part.Size = Vector3.new(1, 1, 1)
part.Parent = workspace.voxelTerrainFolder
end
game:GetService("RunService").Heartbeat:Wait()
end
end
terrain.Create()
return terrain
also I used the ModuleScript syntax to make it look cooler lol.
Apart from customisation, what is your feedback?