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

More unique terrain (& biomes) with math.noise() ?

Asked by
0b1w 13
4 years ago

Simplified version of my current system:

math.randomseed(tick()*999);

local RunService = game:GetService("RunService");

local noise = math.noise;
local floor = math.floor;

local mapSize = 500;

local startVec = Vector3.new(-4*mapSize-4,0,-4*mapSize-4);

local function createBlock(vec)
    local Block = Instance.new("Part");
    Block.Color = Color3.fromRGB(58,125,21);
    Block.Material = Enum.Material.Grass;
    Block.Size = Vector3.new(4,4,4);
    Block.Position = startVec/2 + vec;
    Block.Anchored = true;
    Block.Parent = workspace;
end;

local function generateTerrain()
    local Seed = Random.new():NextInteger(100000,999999);
    for z = 1,mapSize do RunService.Heartbeat:Wait();
        for x = 1,mapSize do
            local y = noise(x/40,z/40,Seed);
            createBlock(Vector3.new(4*x,4*floor(y*10),4*z));
        end;
    end;
end;

generateTerrain();

Playing with the math I can get some pretty nice terrain, but at least 50% of the time there are cloned hills, etc.

Also, I've been attempting to generate biomes, but I don't really know how to go about doing it.

Any help or information would help a lot. Thanks!

Answer this question