Procedural island generation

Please could you get that code snippet you said about? I’m so confused :joy:

Sorry if I’m being annoying but this is making 0 sense to me

Despite the optimization benefits, I’ve personally always found Roblox terrain textures very unoriginal, so I generally don’t use it.
I might use it for water sometimes but that’s about it.

I guess I should clarify what I meant by cframing.

It’s fairly easy to cframe terrain. Using Terrain:FillBlock(cframe,size,material) and Terrain:FillBall(position,radius,material) you can place chunks of terrain anywhere.
https://developer.roblox.com/en-us/api-reference/function/Terrain/FillBlock
https://developer.roblox.com/en-us/api-reference/function/Terrain/FillBall

If you’re doing a proof of concept, then working out the math would be really cool.

If you’re trying to build a game however, I recommend going the easier rout of taking an island made out of Parts and converting said island into terrain with a function similar to this:

function fill(part,material)
	if part.Shape == 'Ball' then
		Terrain:FillBall(part.Position,part.Size.Y/2,Enum.Material[material])
	else
		Terrain:FillBlock(part.CFrame,part.Size,Enum.Material[material])
	end
end

function convertIslandToTerrain(model)
	for i,v in pairs(model:GetChildren()) do
		if v.Name == 'Grass' then
			Terrain:FillBlock(v.CFrame,v.Size,Enum.Material.Grass)
			v:Destroy()
		elseif v.Name == 'Rock' then
			Terrain:FillBlock(v.CFrame,v.Size,Enum.Material.Rock)
			v:Destroy()
		end
	end
end

From personal experience, unless you’re really into the math itself, the end product will be very similar.

This is not to say that your islands can not be random.
You can still have lots of randomness if you take a bunch of premade islands and mixed them together.

Again, the product will be very similar.
That’s my personal opinion on the matter.
Hope this helps ¯\(ツ)/¯

2 Likes

This will give a very blocky feel because you’re just converting a cube part to terrain. I don’t think it’s going to work for my use case. Plus, I want all the islands to be different.

It doesn’t necessarily have to be blocky.
You can use Ball shaped parts to make smooth islands.
Mixing different islands together would give you the most flexibility with the least amount of effort.
This is a minimum viable product mindset, but you do you. To each their own.

1 Like