Biome generation

G

gamesarecool9000

Guest
Does anyone know any good tutorials on this subject? I have searched the depths of YouTube and have found helpful tutorials about Perlin noise generation but nothing about biome generation. Everything helps!
 

NightFrost

Member
Well, Perlin noise is useful for that too. It can be used to generate a terrain elevation map, which can serve as basis for biome regions.
 
K

KiD_Rager

Guest
Funny enough, I just got done mindlessly watching some guy recreate Minecraft in Unity and Perlin noise had a huge role in it.


I'm sure the process is fairly similar in GameMaker. A quick search for a GM example right off Google:

 
Well, perlin noise is literally just a range of values (usually 0 to 1 or -1 to 1 or something like that) where each "point" is related to nearby "points" via a smoothing process (meaning you are unlikely to encounter a 0 next to a 1, but very likely to encounter a 0.9 next to a 1). What that data represents is entirely up to you. People often use it for elevation maps, as @NightFrost pointed out, but that is just one potential application. Biome generation is entirely within the capability of perlin noise (though, I will tell you that generating perlin noise purely in GML is a rather slow process, much better to offload it to a shader, generating a "plasma" effect onto a surface and then reading each pixel from that surface). The way I did it when I was messing around with it was to generate an "elevation map" and then an entirely separate "moisture map" and then use both of those together to generate the biome.

Here's the script I used to decide what biome a tile should be after I'd generated the elevation and moisture maps using perlin noise (the things in all caps are just macros I setup to represent the biomes). As you can see, the biomes are just decided by number cutoffs. If elevation is X amount and moisture is Y amount, biome is Z:
Code:
///@function biome(elevation,moisture)
///@description Returns the correct biome based on the elevation and moisture values
///@param {real} elevation map
///@param {real} moisture map

var e = argument0;
var m = argument1;

if (e < 0.05) {
    return OCEAN;
}
if (e < 0.12) {
    return SHALLOWS;
}
if (e < 0.2) {
    return DESERT;
}
if (e < 0.5) {
    if (m < 0.4) {
        return DESERT;
    }
    else if (m < 0.55) {
        return GRASSLAND;
    }
    else if (m < 0.8) {
        return FOREST;
    }
    else {
        return LAKE;
    }
}
if (e < 0.7) {
    if (m < 0.3) {
        return DESERT;
    }
    else if (m < 0.7) {
        return GRASSLAND;
    }
    else {
        return FOREST;
    }
}
if (e >= 0.7) {
    if (e > 0.95) {
        return SNOWYMOUNTAIN;
    }
    return MOUNTAIN;
}
EDIT: Also, here's a quick gif of the generator in action:
 

Psycho_666

Member
Does anyone know any good tutorials on this subject? I have searched the depths of YouTube and have found helpful tutorials about Perlin noise generation but nothing about biome generation. Everything helps!
People show you those Minecraft things, but it all depends on the game you want to make.
Based on specifics you may not need Perlin noise or whatever. Worley noise is simple effective implementation for world generation of different regions. Voronoi is also an option. Weirdly similar to Worley :D
 
D

dcm

Guest
Well, perlin noise is literally just a range of values (usually 0 to 1 or -1 to 1 or something like that) where each "point" is related to nearby "points" via a smoothing process (meaning you are unlikely to encounter a 0 next to a 1, but very likely to encounter a 0.9 next to a 1). What that data represents is entirely up to you. People often use it for elevation maps, as @NightFrost pointed out, but that is just one potential application. Biome generation is entirely within the capability of perlin noise (though, I will tell you that generating perlin noise purely in GML is a rather slow process, much better to offload it to a shader, generating a "plasma" effect onto a surface and then reading each pixel from that surface). The way I did it when I was messing around with it was to generate an "elevation map" and then an entirely separate "moisture map" and then use both of those together to generate the biome.

Here's the script I used to decide what biome a tile should be after I'd generated the elevation and moisture maps using perlin noise (the things in all caps are just macros I setup to represent the biomes). As you can see, the biomes are just decided by number cutoffs. If elevation is X amount and moisture is Y amount, biome is Z:
Code:
///@function biome(elevation,moisture)
///@description Returns the correct biome based on the elevation and moisture values
///@param {real} elevation map
///@param {real} moisture map

var e = argument0;
var m = argument1;

if (e < 0.05) {
    return OCEAN;
}
if (e < 0.12) {
    return SHALLOWS;
}
if (e < 0.2) {
    return DESERT;
}
if (e < 0.5) {
    if (m < 0.4) {
        return DESERT;
    }
    else if (m < 0.55) {
        return GRASSLAND;
    }
    else if (m < 0.8) {
        return FOREST;
    }
    else {
        return LAKE;
    }
}
if (e < 0.7) {
    if (m < 0.3) {
        return DESERT;
    }
    else if (m < 0.7) {
        return GRASSLAND;
    }
    else {
        return FOREST;
    }
}
if (e >= 0.7) {
    if (e > 0.95) {
        return SNOWYMOUNTAIN;
    }
    return MOUNTAIN;
}
EDIT: Also, here's a quick gif of the generator in action:
wow, not OP but that looks really cool btw!. Have you ever thought of doing some tutorials on working with perlin noise in gamemaker?

pretty cool little gadget you have there!
 
HeHeHe, tutoral list incoming! :)

Arend Peter has a perlin noise with chunk saving tutorail series here, no boimes, but a step in the right direction. He has the project download on his videos.

And upon googling "gamemaker studio minecraft biomes" this old 1.4 tutorail for real tuts gml comes up.

There is another gamemaker minecraft youtube tutorail with biomes, I'll post it if find the link to it.

Granted, you cant just plug one project into another and hope it will work. This subect is what separates the new starters and the pros.
(I'm not a pro)


edit: i feel stupid now, i recommended the video that was already posted here, sorry.
 
Top