Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I create a generated heightmap and put it into the game?

Hello, I am working with procedural terrain generation and I am using a script from the RDC 2019 which works; however, in the RDC presentation, there is a picture that goes along with the code that basically creates the heightmap and it's shown in the real world. The code I have doesn't do this and I am wondering how to recreate the heightmap with parts or if it's just an image.

function GenerateHeightmap(size, seed)

	local freq = 10

	local heightmap = {}
	for x = 1,size do
		local hx = {}
		heightmap[x] = hx
		for z = 1,size do
			local y = math.noise((x + seed) / freq, (z + seed) / freq)
			hx[z] = math.clamp(y + 0.5, 0, 1)
		end
	end

	return heightmap

end

local heightmap = GenerateHeightmap(100, 45)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.