I am trying to make a minecraft-like terrain generation. I am on the first phase right now - generating a terrain with cool stuff like overhangs etc.
It somewhat works but the generation is unrealistic.
I have some questions.
- How can I make this realistic?
- How do I go about texturing all the blocks? For e.g texturing the first 2 layers as grass etc.
- How can I add different biomes?
- How can I add oceans?
- How can I add lakes and isolated bodies of water?
CURRENT CODE:
local RunService = game:GetService("RunService")
local wait = require(workspace.FastWait)
local map_size_in_blocks
if (RunService:IsStudio()) then
map_size_in_blocks = Vector3.new(128,32,128)
else
map_size_in_blocks = Vector3.new(256,64,256)
end
local block_size = Vector3.new(2,2,2)
local noise_scale = 40
local amplitude = 15
local rand = Random.new(os.clock()+os.time())
local seed = rand:NextNumber(1,500000)
for X = 0,(map_size_in_blocks.X-1) do
for Y = 0,(map_size_in_blocks.Y-1) do
for Z = 0,(map_size_in_blocks.Z-1) do
local noise_x = math.noise(Z/noise_scale,Y/noise_scale,seed)*amplitude
local noise_y = math.noise(X/noise_scale,Z/noise_scale,seed)*amplitude
local noise_z = math.noise(X/noise_scale,Y/noise_scale,seed)*amplitude
local density = (noise_x + noise_y + noise_z)
if (Y == 0) then -- Similar to "Bedrock" in MC
local part = Instance.new("Part")
part.Anchored = true
part.Size = block_size
part.Position = Vector3.new(X,Y,Z) * block_size
part.Parent = workspace.World
elseif (((density + Y) <= 15)) then
local part = Instance.new("Part")
part.Anchored = true
part.Size = block_size
part.Position = Vector3.new(X,Y,Z) * block_size
part.Parent = workspace.World
end
end
end
wait()
end