Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Adding decorations to terrain generated by perlin noise?

Asked by 2 years ago

So I am working on an terrain generator game and I was wondering if I could add decorations to the generated terrain like trees and houses and stuff like that. The terrain is like Minecraft, it's voxel and the decorations have to be voxel too. Here's my current script:

local mapsize = 250
local seed = 1500
local size = 4

for x = 0, mapsize do
    for y = 0, mapsize do
        local h = math.round(math.noise(x / 50 or 0, y / 50 or 0, seed) * 20) * size
        local p = Instance.new("Part")

        p.Position = Vector3.new(x * size, h, y * size)
        p.Anchored = true
        p.Size = Vector3.new(size, size, size)
        p.TopSurface = Enum.SurfaceType.Smooth
        p.BottomSurface = Enum.SurfaceType.Smooth
        p.Material = Enum.Material.Grass
        p.BrickColor = BrickColor.new("Bright green")
        p.Parent = workspace

        if p.Position.Y < 0 then
            p.Material = Enum.Material.Salt
            p.BrickColor = BrickColor.new("Cool yellow")
        end
    end
end

local w = Instance.new("Part")
w.Anchored = true
w.TopSurface = Enum.SurfaceType.Smooth
w.BottomSurface = Enum.SurfaceType.Smooth
w.Material = Enum.Material.Glass
w.Size = Vector3.new(mapsize * 5, 30, mapsize * 5)
w.Position = Vector3.new(((mapsize + 1) * 5)/2, -20, ((mapsize + 1) * 5)/2)
w.CanCollide = false
w.Transparency = 0.5
w.BrickColor = BrickColor.new("Electric blue")
w.Parent = workspace

If you know how to make it that it generates decorations and houses on the terrain and not on side of hills so the blocks are not floating then thank you!

  • Also how to make it also generate caves?
0
is this a local script, module script, normal script, and where is it? VipDanT 10 — 2y
0
its not relevant here the OP is asking how to generate parts and stuff using math.noise and the answer is Math Puppynniko 1059 — 2y

Answer this question