Hi
I’m working on a procedural generation script, the code for the generation looks something like this:
-- generate terrain --
for x = 1, X do
heightMap[x] = {} -- new row
temperatureMap[x] = {} -- new row
for z = 1, Z do
heightMap[x][z] = math.noise(SEED, x/TERRAIN_SMOOTHNESS, z/TERRAIN_SMOOTHNESS) / 1.1 + 0.5
temperatureMap[x][z] = math.noise(SEED, x/TEMPERATURE_SMOOTHNESS, z/TEMPERATURE_SMOOTHNESS) / 2 + 0.5
end
end
-- render terrrain --
local count = 0
for x = 1, X do
for z = 1, Z do
createChunk(Vector3.new(x, heightMap[x][z], z), heightMap[x][z], temperatureMap[x][z])
if X >= 300 or Z >= 300 then
count += 1
if count == 75 then
wait()
count = 0
end
end
end
wait()
end
And the result looks like this:
(Chunks are pre made, they are just spawned in the correct position in the correct biome)
Now I want to add in structures like a village or a jungle temple. The problem is I have no idea how would I do it. I guess how it would go is after terrain generated it would pick a spot then check what biome it is and place the structure depending on the biome on the 4 chunks. So the structure like a jungle temple would be 2x2 in size so the 4 chunks under it would be destroyed and the structure would spawn in, or the village would be a 3x4.