Hello!
I’m trying to make procedural terrain generation with a script. I already like Roblox’s built in terrain generation in the terrain editor especially because of all the parameters/biomes/etc…, is there any way to call it from a script?
I have tried converting my old voxel (part) terrain to roblox terrain, but it’s not very efficient, especially when procedural.
I’ve looked for solutions here, but most are just how to fill a block of terrain, or link to theory.
Is there any way to use Roblox’s built in terrain generation in a script rather than just in studio?
That is a major subject. A lot to know before you can even start. That generator in Roblox is making it look easy, It so isn’t. That all works off Perlin noise and chunk algorithms. Let me see if I can find you a good link here.
Looks like I answered the wrong question here.. the answer you’re looking for is; NO there isn’t.
But you can build your own. Them links can help that.
Here is a simple start:
local Terrain = workspace.Terrain
local size = 4
local width, depth, height = 64, 64, 20
local function noise(x, z)
return math.noise(x / 10, z / 10) * height
end
for x = 0, width - 1 do
for z = 0, depth - 1 do
local y = math.max(noise(x, z), 1)
Terrain:FillBlock(CFrame.new(x * size, y / 2, z * size), Vector3.new(size, y, size), Enum.Material.Grass)
end
end
A while back I wrote a plugin that builds terrain with a few options, you can check it here if you want to test out the approach:
More useful for you, I also published the code here:
The rbxmx can be dropped into (you may have to do something like load plugin) your experience’s plugins folder to allow you to look at the code. As run time is not a big factor for plugins you may find it too slow or cpu heavy as is, but it might give you some ideas.
As others have said, it can be quite a steep learning curve. Good luck!
Thanks a lot for the Java one, it’s a familiar language to me and it’s already helpful so far.
I’ll be sure to check out other materials in the replies as well!
This plugin incorporates a client script that allows terrain to load and unload as the character moves around, along with handling terrain modifications in studio.
It also provides, as the name says, infinite terrain possibilities. It has unlimited customization options that should fit your needs.