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

How would you do "Minecraft" like terrain generation? [closed]

Asked by 6 years ago

I want to make terrain generation like in minecraft with places where there is flat surface and places where there are mountains. However while i was using perlin noise and looked at all roblox terrain generation examples i noticed that you can only make it either have tons of mountains or just a flat surface. I looked up on google and it said that i need to use multiple octaves but i dont know how to do that in roblox. Anyone knows how to do it?

Closed as Not Constructive by titaneagle, xPolarium, green271, zblox164, and User#21908

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
Nabfam 20
6 years ago

This is a very complex system. To perform this, you would have to have algorythms that change the frequency of the generation system. Here's an example from the wiki:

local seed = math.random()
local width = 200
local length = 200
local amplitude = 20
local frequency = 25

for x = -width/2,width/2 do
    for z = -length/2,length/2 do
        local y = (math.noise(seed,x/frequency,z/frequency) * (amplitude/2)) + (amplitude/2)
        workspace.Terrain:FillBlock(CFrame.new(x*4,y*2,z*4),Vector3.new(4,y*4,4),Enum.Material.Grass)
    end
end

Now, to make the different frequencies, we can do this:

amplitude = amplitude + math.random(-1.0,1.0)
frequency = frequency + math.random(-1.0,1.0)

And that makes:

local seed = math.random()
local width = 200
local length = 200
local amplitude = 20
local frequency = 25

for x = -width/2,width/2 do
    for z = -length/2,length/2 do
        local y = (math.noise(seed,x/frequency,z/frequency) * (amplitude/2)) + (amplitude/2)
        amplitude = amplitude + math.random(-1.0,1.0)
        frequency = frequency + math.random(-1.0,1.0)
        workspace.Terrain:FillBlock(CFrame.new(x*4,y*2,z*4),Vector3.new(4,y*4,4),Enum.Material.Grass)
    end
end

Hope this helps!

0
It does fine but after 1 or 2 seconds it stops and gives an error : Extents cannot be empty? TOP_SECRE 28 — 6y
0
It seems to work if you add a wait() after each fillblock, but this means the terrain takes forever to generate turtle2004 167 — 6y
0
Still the landshape looks weird TOP_SECRE 28 — 6y
View all comments (2 more)
0
This is a very wide and broad topic. You cannot just ask one question and get an answer that will match all your needs. This answer gives the framework for which to begin, but I suggest you do your own research on this topic. RayCurse 1518 — 6y
0
I already looked through all roblox pages about it and all non roblox. Even if i found a good one that described everything i couldnt think of how to implent it in roblox.Also i didnt ask for the whole thing, I asked how could i do octaves since i already have a working script that just generates either plains or mountains. TOP_SECRE 28 — 6y
Ad