How would i go along making this generation better?

So i am remaking minecraft, how could i make this generate more natural terrain, instead of just a superflat world?
Also, how can i make it generate in chunks, such as when the player nears a certain chunk that has yet to exist, it generates?
i want to know how to make this work.
heres my code:

local Times = 50
local BeginPos = Vector3.new(0, 0, 0)
local OffsetPos = 4
BeginPos = Vector3.new(BeginPos.X - ((Times / 2) * 4), 0, BeginPos.X - ((Times / 2) * 4))
for i = 1, Times do
	BeginPos = BeginPos + Vector3.new(0, 0, OffsetPos)
	for i = 1, Times do
		local Block = game.ServerStorage.Blocks.Bedrock:Clone()
		Block.Parent = workspace
		Block.Position = BeginPos + Vector3.new(i * OffsetPos, 0, 0)
	end
end
for i = 1, 3 do
	local BeginPos = Vector3.new(0, 0, 0)
	BeginPos = Vector3.new(BeginPos.X - ((Times / 2) * 4), i * 4, BeginPos.X - ((Times / 2) * 4))
	for i = 1, Times do
		BeginPos = BeginPos + Vector3.new(0, 0, OffsetPos)
		for i = 1, Times do
			local Block = game.ServerStorage.Blocks["Grass Block"]:Clone()
			Block.Parent = workspace
			Block.Position = BeginPos + Vector3.new(i * OffsetPos, 0, 0)
		end
	end
end

Short answer, It will take a lot more code than you have now.

Longer answer, First look into Perlin Noise to get you some hills/valleys and such. Here is a video on it. After that you’ll soon realize that you don’t want a chunk system but you need a chunk system to stop your computer from melting. Again YouTube is your friend here. You may also want look up “greeding meshing” in conjuction with your chunk system. It’s doable, just not something that can be conveyed in a post or two.

Lots of people have recreated Minecraft and there are loads of videos on how it’s done just Google “Roblox Minecraft” for hours and hours of info.

1 Like