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!
///@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;
}
People show you those Minecraft things, but it all depends on the game you want to make.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!
wow, not OP but that looks really cool btw!. Have you ever thought of doing some tutorials on working with perlin noise in gamemaker?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:
EDIT: Also, here's a quick gif of the generator in action: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; }