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

Is there a way to make a more natural looking terrain generation with density?

Asked by 5 years ago

Ok so i did a research on about half of the internet to find how minecraft generates its terrain. All of the forums and other sites said that you will need to use noise function as density and then check if its above certain point or below and place a block.If you do this you get something different from when you use noise as height, there appear overhangs and more minecraft - like looking terrain. However it still doesnt look like minecraft terrain. What I want it to have is more natural looking overhangs and not so flat areas. So far I have this result: and . See, it doesnt look natural at all or atleast minecraft like. Here is my code:

math.randomseed(tick())
local smoothness = math.random(50,60)
local seed = math.random(1,10e6)
for x = 1, 500 do
        for z = 1, 500 do
            local height = math.noise(x/smoothness, z/smoothness, seed) --Find out the height 
            for y = 1, (height*100)+10 do
            local height = math.noise(x/smoothness, z/smoothness, seed) * 4 --Find out the height 
                local density = math.noise(x/smoothness, y/smoothness, z/smoothness) --Find out the density
                if y > 20 then
                    if density >= 0 then
                        workspace.Terrain:FillBall(Vector3.new(x * 2,y * 2,z * 2) , 5 , "Grass")
                    end
                else
                workspace.Terrain:FillBall(Vector3.new(x * 2,y * 2,z * 2) , 5 , "Grass")
            end
        end
    end
wait()
end

*And yes Its a code of someone else code that i found on internet that i first used when i didnt understand and then forgot to write my own and just edited this one.

So what i want is a way to make this look like minecraft. Maybe through some algorithm since i cant find a way to. Maybe some genious can help.

0
If you stole this script this question is not constructive. I strongly recommend that you remove it. User#19524 175 — 5y
0
Its not stolen. I just said that it may be the one example i found on the internet and based off. TOP_SECRE 28 — 5y
0
Copying someone else's script shouldn't be reason to close the question, imo. Nonetheless, I'm not sure there's answer other than "try changing the algorithm or making it more complex until you get what you want". ex, try detecting when you're generating overhangs and add more terrain near it to make them look better. (I ran the script and the output already looked pretty good to me.) chess123mate 5873 — 5y
0
You know minecraft generates its terrain in chunks, right? Theroofypidgeot 21 — 5y
0
That gives quite nothing. Except that it may generate terrain patterns on each of them. TOP_SECRE 28 — 5y

Answer this question