Page 1 of 1

minetest.register_biome(): heat_point and humidity_point?

PostPosted: Thu Mar 26, 2015 00:48
by y.st.
I found the minetest.register_biome() function in use in minetest_game, but I can't seem to find any documentation on it. I have since been experementing with it, and I think I gigured out most of what I need to make it work. However, I still have a question about the "heat_point" and "humidity_point" elements. What are the minimum and maximum values of these elements? It would be a lot easier to work on the biome distribution if I knew what my ranges were. I had assumed that both numbers were integers from 0 to 100, but using that assumption, I get bad distributions where some biomes are so rare it takes forever to find them while other biomes are found everywhere I look.

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Thu Mar 26, 2015 17:54
by paramat
Yes the biome API is not yet documented, but for an example of how to use it see my mod for mgv5/mgv7 https://github.com/paramat/biomesdev
Heat and humidity are mostly in the range 0 to 100 but can extend as far as -25 to 125.
They need to be evenly spaced out on a graph of heat agaiinst humidity for roughly equal size biomes, but even then because of the nature of perlin noise biomes will vary in size and sometimes be rare or huge.
The biomes are chosen using a voronoi diagram of heat/humidity points on a 2D graph of heat against humidity:

Image

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Fri Mar 27, 2015 00:06
by y.st.
Thank you so much for the help!

I strongly suspected a chart like that was used internally to find the biome locations (likely in the form of a least squares equasion or something). I couldn't see another way to handle biomes based on two factors (heat and humidity).

I think my initial biome layout was odd, cauing my hot/humid (100/100) biome to get squished out. I tried to define two nearly-identical biomes (one at 50/50 and one at 49/49), and it may have done funky things to the more extreme biomes. Spreading them out better, I'm getting better results.

By the way, do you know why more extreme temperatures (to -25 and to 125) are less common than those in the 0 to 100 range? Is there some sort of normalization going on that might make 50/50 the most common temperature?

Thank you for the code examples too! I'll read over your biomesdev mod and see what you have done with it.

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Fri Mar 27, 2015 02:58
by paramat
> do you know why more extreme temperatures (to -25 and to 125) are less common than those in the 0 to 100 range?

Because heat and humidity are defined as 50 + noisevalue * 50, and noise values vary roughly between -1.5 to +1.5 if they have several octaves, dependant on persistence and number of octaves.
Heat and humidity have 3 octaves with 0.5 persistence, so the maximum amplitude is:
1 + 0.5 + 0.5*0.5 = 1.75 so the variation is from -1.75 to +1.75, but the extreme values are extremely rare, the usual variation is roughly a little larger than -1 to +1.

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Fri Mar 27, 2015 06:08
by y.st.
Awesome. Thank you for all the help! I think I have everything I need to get my subgame started now.

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Fri Mar 27, 2015 17:19
by y.st.
I was just crunching the numbers, and for some reason, they aren't adding up. If the perlin noise ranges from -1.75 to +1.75 and the temperature and humidity equasion is 50 + <noise> * 50, why is the range -25 to +125 and not -37.5 to +137.5?

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Fri Mar 27, 2015 19:00
by paramat
Sure correct, when i said -25 to 125 that's just a rough example of typical not-rare variation. The extremes of -1.75 to +1.75 are so extremely rare it's best to assume a smaller range of typical variation. The chance of all 3 octaves of noise being simultaneously at +1, or at -1, is a once in a lifetime event.
If you work with -37.5 to +137.5 and create a biome that only appears at heat < -25 it will be too rare. For equal sized biomes it's best to assume the range is roughly -20 to +120. My biome points never go beyond 0 to 100,

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Wed Apr 01, 2015 04:03
by y.st.
Okay, got it. Thank you so much forthe help!

I think I will make some rare biomes as a way to get certain novelty nodes (such as default:nyancat), but will otherwise stay in the 0 to 100 range.

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Fri May 22, 2015 21:07
by Kilarin
I'm messing with mapgen, and my vast ignorance is showing. Heat_point and humidity_point being part of that. :)

Using paramat's example here:https://github.com/paramat/biomesdev/blob/master/init.lua
Ignoring the ocean biomes you have:
name = "tundra",
heat_point = 0,
humidity_point = 0,

name = "taiga",
heat_point = 0,
humidity_point = 100,

name = "grassland",
heat_point = 35,
humidity_point = 0,

name = "coniferous_forest",
heat_point = 35,
humidity_point = 100,

name = "sandstone_grassland",
heat_point = 65,
humidity_point = 0,

name = "deciduous_forest",
heat_point = 65,
humidity_point = 100,

name = "desert",
heat_point = 100,
humidity_point = 0,

name = "rainforest",
heat_point = 100,
humidity_point = 100,

So, does it work like this: the mapgen uses to create the voronoi cells? meaning that it picks some random points and draws the cells, then for each cell it figures out what biome heat_point and humidity point is a closest match at that y level, and that is the biome assigned.

So, for example, if the heat_point of the cell is 40 OR 70 it will match up with heat_point=65 because both values are closer to 65 than they are to 0 or 100.

Essentially assigning biomes with heat_point=0, heat_point=65, and heat_point=100 gives me ranges of
heat_point=0 matches -25 to +32
heat_point=65 matches +33 to +83
heat_point=100 matches +84 to +125

is that close or way off base?

thank you!

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Sat May 23, 2015 05:46
by paramat
Yes except some of your words are not exactly correct:

> meaning that it picks some random points and draws the cells, then for each cell it figures out what biome heat_point and humidity point is a closest match at that y level

Not random points.
Biome is chosen every time a new upper surface (solid or liquid) is found while working down a column.
For that y, all the biomes active at that y have their 'biome points' drawn on a 2D heat against humidity diagram.
For the surface node (x, y, z) the heat and humidity is found from noise using (x, z), and the node's 'point' is also drawn on the diagram.
As you guessed the biome with it's 'biome point' closest to the 'node point' is chosen.
The cells are simply made from lines at equal distance between biome points (the definition of a voronoi diagram) so you can immediately see what node points will belong to which biome.

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Sun May 24, 2015 01:42
by Kilarin
Thank you very much for the clarification.

It seems like a VERY nice system. alas, I need to turn off some biomes under certain conditions, so I have to try and rewrite this in lua. (unless you are willing to reconsider adding an "availability" function that is only checked if it is defined, but if it IS defined and returns false, the biome is not available for that point) :)

I'm using your paragenv7 as base to start from. Good code! But I've got a lot of learning to do.

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Sun May 24, 2015 15:15
by Kilarin
For anyone who's curious as to WHY I am trying to write a lua mapgen that allows you to have a function that determines boime availability: for my own use, I plan on using it in Fractured where I want certain biomes to exist only on the wild side of the world and not on the tame side, and some biomes to be more common the further you get from spawn.

But I think there MIGHT be possibilities for others to use this code as well. For example, a mod like Ethereal might want to ensure that crystal biomes are more rare. Setting a very narrow heat and humidity point might do that, but with the availability function, ethereal could just define an availability function for the crystal biome that did something as simple as check a random number from 1 to 3 and make the biome unavailable unless the result is 3.

Or another user might want to develop a "haunted forest" biome. It would be very similar to a regular forest in heat and humidity point, but the availability function would ensure that it only showed up rarely.

Or someone might want to have a certain special biome that only shows up once in each quarter of the world. The availability function could do that.

So, I'm trying to figure this out and make it work. :)

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Sun May 24, 2015 21:23
by paramat
As we discussed, adding hardcoded zoning of biomes is not really possible, due to it being complex specialised, that's more of a lua mapgen thing, lua mapgens can be much more powerful and specialised than the simplistic biome API.

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Sun May 24, 2015 23:53
by Kilarin
Kilarin wrote:that's more of a lua mapgen thing,

And thats what I'm working on. :) Thank you!

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Tue Jul 21, 2015 00:19
by Routhinator
Thanks for that map paramat. I designed myself a blank map for me to draw out my biomes as I plan them. I've attached the PDF and ODT files if others wish to use it for planning theirs.

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Sun Oct 02, 2016 12:22
by BirgitLachner
Very interesting discussion for me as I try to manipulate the biom-creation in the Etherreal-Mod. I will use GeoGebra - an opensource-tool for math to draw the voronoi-diagramm.

But, what I'm interessting in is if I have a possibillity to display the heat and humidity-values inside a minetest-map? I tried severall possibilites like F5 or F6 but I think I did not found it their.

Birgit

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Sun Oct 02, 2016 17:12
by paramat
An API for heat and humidity at point are intended.

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Sun Oct 02, 2016 17:24
by BirgitLachner
Thanks paramat for the information.

And here is the voronoi diagram for Etherreal Mod https://www.geogebra.org/m/u2ngcd5F

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Mon Oct 03, 2016 02:54
by paramat
Wow.

Re: minetest.register_biome(): heat_point and humidity_point

PostPosted: Thu Dec 15, 2016 04:49
by paramat
GeoGebra can be used to move biome points around with the pointer and the voronoi cells will change shape in real time, i have found this essential for designing a set of biomes, our new default set of biomes was designed this way.
How to use GeoGebra to do this: https://forum.minetest.net/viewtopic.php?p=230857#p230857