Perlin Noise Demo

it uses Perlin noise for the waves and I think it is quite memorizing


also its only 35 lines

local runService = game:GetService("RunService")

local nodeSize = 25
local perlinNoiseResolution = 150
local perlinNoiseFrequency = 5 --number of hill
local perlinNoiseAmplitude = 100

local xDistance = 0

local function getHight(x,z)
	local noiseHeight = math.noise(x/perlinNoiseResolution*perlinNoiseFrequency, z/perlinNoiseResolution*perlinNoiseFrequency)+0.5
	noiseHeight = math.clamp(noiseHeight,0,1)
	return noiseHeight
end

runService.Heartbeat:Connect(function()
	xDistance += 1
	
	for i,v in pairs(workspace:WaitForChild("GeneratedTerrain"):GetChildren()) do
		v:Destroy()
	end
	
	for x = 1, nodeSize do
		for z = 1, nodeSize do
			local part = Instance.new("Part")
			part.Parent = workspace:WaitForChild("GeneratedTerrain")
			part.Anchored = true
			part.Size = Vector3.new(4,4,4)
			
			local partHeight = getHight(x+xDistance,z)
			
			part.Position = Vector3.new(x*4,partHeight*perlinNoiseAmplitude,z*4)
		end
	end
end)
5 Likes

Dude, this is a masterpiece. The only thing I want to tell you as feedback is to make the blocks when going up or down not have a gap between them, and also make it smoother. Keep it up! :cool:

3 Likes