Biome API changes, world maintainers please read

User avatar
paramat
Developer
 
Posts: 3546
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Biome API changes, world maintainers please read

by paramat » Mon Dec 29, 2014 02:13

The biome API can be used in mgv5 and mgv7, and hopefully also any future mapgen.
See https://github.com/minetest/minetest/pull/2019 for some initial details, this pull request is now merged.
Do not use the changed biome API in any existing worlds until you have understood the changes and have rewritten your biome registrations, i will detail how to do this in this thread soon.
When you have rewritten your biome definitions test them in a copy of your existing world first.
Last edited by paramat on Mon Dec 29, 2014 06:51, edited 3 times in total.
 

User avatar
paramat
Developer
 
Posts: 3546
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: Biome API changes, world maintainers please read

by paramat » Mon Dec 29, 2014 05:36

Here is the biome system i used for testing the code:

Code: Select all
minetest.clear_registered_biomes()

minetest.register_biome({
   name = "grassland",
   node_top = "default:dirt_with_grass",
   node_shore_top = "default:sand",
   depth_top = 1,
   node_filler = "default:dirt",
   node_shore_filler = "default:sand",
   depth_filler = 2,
   height_shore = 3,
   node_underwater = "default:sand",
   --node_stone = "",
   --node_water_top = "",
   --depth_water_top = ,
   --node_water = "",
   --node_dust = "",
   y_min = -32000,
   y_max = 32000,
   heat_point = 50,
   humidity_point = 50,
})

minetest.register_biome({
   name = "desert",
   node_top = "default:desert_sand",
   node_shore_top = "default:desert_sand",
   depth_top = 1,
   node_filler = "default:desert_sand",
   node_shore_filler = "default:sand",
   depth_filler = 1,
   height_shore = 3,
   node_underwater = "default:sand",
   node_stone = "default:desert_stone",
   --node_water_top = "",
   --depth_water_top = ,
   --node_water = "",
   --node_dust = "",
   y_min = -32000,
   y_max = 32000,
   heat_point = 90,
   humidity_point = 10,
})

minetest.register_biome({
   name = "rainforest",
   node_top = "default:dirt_with_grass",
   node_shore_top = "default:dirt_with_grass",
   depth_top = 1,
   node_filler = "default:dirt",
   node_shore_filler = "default:dirt",
   depth_filler = 3,
   height_shore = 3,
   node_underwater = "default:sand",
   --node_stone = "",
   --node_water_top = "",
   --depth_water_top = ,
   --node_water = "",
   --node_dust = "",
   y_min = -32000,
   y_max = 32000,
   heat_point = 70,
   humidity_point = 90,
})

minetest.register_biome({
   name = "tundra",
   node_top = "default:dirt_with_snow",
   node_shore_top = "default:sand",
   depth_top = 1,
   node_filler = "default:dirt",
   node_shore_filler = "default:sand",
   depth_filler = 2,
   height_shore = 3,
   node_underwater = "default:sand",
   --node_stone = "",
   node_water_top = "default:ice",
   depth_water_top = 4,
   --node_water = "",
   node_dust = "default:snow",
   y_min = -32000,
   y_max = 32000,
   heat_point = 10,
   humidity_point = 50,
})
Last edited by paramat on Mon Jan 05, 2015 23:10, edited 2 times in total.
 

User avatar
paramat
Developer
 
Posts: 3546
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: Biome API changes, world maintainers please read

by paramat » Mon Dec 29, 2014 05:47

>>> How to rewrite your existing biome registrations <<<

Replace node_dust_water with node_water_top, and below add a line to set depth_water_top to your chosen depth.

For land biomes:
Previously under an overhang or floatland, a land biome's surface nodes would be placed on the shore and underwater. Now in this situation you can force your choice of nodes to appear there instead.
Add node_shore_top, node_shore_filler and node_underwater

For shore biomes that include nodes at water level (usually y = 1):
Replace node_top and node_filler with node_shore_top, node_shore_filler.
Add your choice of height_shore
Add node_underwater if the biome extends below water level.

For underwater biomes, below water level:
Replace node_top and node_filler with node_underwater.

Finally make a copy of your existing world to test continuity of biomes.
Last edited by paramat on Fri Jan 02, 2015 08:11, edited 1 time in total.
 

User avatar
paramat
Developer
 
Posts: 3546
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: Biome API changes, world maintainers please read

by paramat » Tue Dec 30, 2014 07:37

Hmmmm and i found a bug introduced yesterday by commit https://github.com/minetest/minetest/commit/863379a4c68b9862ea6913c1b1e475d022aba100 that broke simple decorations.
To fix this 'height_min' and 'height_max' have now become 'y_min' and 'y_max' for decoration and biome definitions, so you will need to edit your biome definitions. For example:

Code: Select all
    minetest.clear_registered_biomes()

    minetest.register_biome({
       name = "grassland",
       node_top = "default:dirt_with_grass",
       node_shore_top = "default:sand",
       depth_top = 1,
       node_filler = "default:dirt",
       node_shore_filler = "default:sand",
       depth_filler = 2,
       height_shore = 3,
       node_underwater = "default:sand",
       --node_stone = "",
       --node_water_top = "",
       --depth_water_top = ,
       --node_water = "",
       --node_dust = "",
       y_min = -32000,
       y_max = 32000,
       heat_point = 50,
       humidity_point = 50,
    })
 

User avatar
TenPlus1
Member
 
Posts: 2649
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Biome API changes, world maintainers please read

by TenPlus1 » Tue Dec 30, 2014 10:29

Are these changes active in the 0.4.11 stable version ? or will it be the dev versions from here in ?
 

User avatar
Jordach
Member
 
Posts: 4523
Joined: Mon Oct 03, 2011 17:58
Location: Blender Scene
GitHub: Jordach
IRC: Jordach
In-game: Jordach

Re: Biome API changes, world maintainers please read

by Jordach » Tue Dec 30, 2014 16:10

paramat wrote:Hmmmm and i found a bug introduced yesterday by commit https://github.com/minetest/minetest/commit/863379a4c68b9862ea6913c1b1e475d022aba100 that broke simple decorations.
To fix this 'height_min' and 'height_max' have now become 'y_min' and 'y_max' for decoration and biome definitions, so you will need to edit your biome definitions. For example:

Code: Select all
    minetest.clear_registered_biomes()

    minetest.register_biome({
       name = "grassland",
       node_top = "default:dirt_with_grass",
       node_shore_top = "default:sand",
       depth_top = 1,
       node_filler = "default:dirt",
       node_shore_filler = "default:sand",
       depth_filler = 2,
       height_shore = 3,
       node_underwater = "default:sand",
       --node_stone = "",
       --node_water_top = "",
       --depth_water_top = ,
       --node_water = "",
       --node_dust = "",
       y_min = -32000,
       y_max = 32000,
       heat_point = 50,
       humidity_point = 50,
    })

Easy to do in most code editors:

Step 1: Move all biome registation code to say a new init.lua for the time being.

Step 2: Use find and replace to change height_min to y_min, and height_max to y_max.

Step 3: Paste said code back into the original Lua file you were using.
viewtopic.php?f=10&t=19056 Solar Plains Dev Server
 

User avatar
paramat
Developer
 
Posts: 3546
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: Biome API changes, world maintainers please read

by paramat » Tue Dec 30, 2014 19:25

All information in this thread is for changes since 0.4.11 stable. So for 0.4.11 stable use the old API, see older versions of BFD, ethereal etc. for code examples.
 

User avatar
Jordach
Member
 
Posts: 4523
Joined: Mon Oct 03, 2011 17:58
Location: Blender Scene
GitHub: Jordach
IRC: Jordach
In-game: Jordach
 

User avatar
HeroOfTheWinds
Member
 
Posts: 470
Joined: Wed Apr 23, 2014 23:16
Location: Hawaii
GitHub: HeroOfTheWinds
IRC: WindHero

Re: Biome API changes, world maintainers please read

by HeroOfTheWinds » Tue Dec 30, 2014 21:26

At the risk of being slightly off-topic, I have two questions slightly related to the biome system.
1. Are the heat and humidity noises 2D or 3D?
2. Do minetest.get_heat() and minetest.get_humidity() work again, and if so, why does the dev wiki still say they were removed?

Regarding the biome changes themselves, cool! I haven't really used the biome registration system very much, bar for adding moon trees to MoonTest. I do have some ideas for how to exploit them a bit more on the modding end, however...
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P
 

User avatar
paramat
Developer
 
Posts: 3546
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: Biome API changes, world maintainers please read

by paramat » Wed Dec 31, 2014 06:29

2D, but y_min/y_max for each biome essentially makes the system 3D-capable.

As far as i know get heat/humidity were actually for accessing a second set of dynamic heat/humidity values in proller's infamous and removed 'dynamic weather'.
Currently use the mapgen objects https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L2309 since you're more likely to need a mapchunk's worth of values at a time.
That data is already generated per mapchunk during mapgen so for accessing value at point it's very probably faster than calculating value at point usng noise.
 

User avatar
HeroOfTheWinds
Member
 
Posts: 470
Joined: Wed Apr 23, 2014 23:16
Location: Hawaii
GitHub: HeroOfTheWinds
IRC: WindHero

Re: Biome API changes, world maintainers please read

by HeroOfTheWinds » Fri Jan 02, 2015 04:49

Thanks, paramat. I was mainly wondering for the purposes of determining whether to switch SkyLands to engine-based heat/humidity, but the 2D nature makes me vote "no."
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P
 

User avatar
paramat
Developer
 
Posts: 3546
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: Biome API changes, world maintainers please read

by paramat » Fri Jan 02, 2015 08:14

The third post of tis thread '>>> How to rewrite your existing biome registrations <<<' is completed.
 

User avatar
paramat
Developer
 
Posts: 3546
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: Biome API changes, world maintainers please read

by paramat » Thu Feb 26, 2015 04:00

In latest 0.4.12 dev the biome API has now been much improved:
Biomes are re-calculated at every surface in a mapchunk column, enabling multiple biome layers within a single mapchunk.
Biome is only calculated if non-air nodes are encountered, possibly improving overall speed.
'node shore top', 'node shore filler', 'node underwater' and 'height shore' are removed.
Your original biome definitions can be used but with 'node dust water' replaced with 'node water top' to a depth of 'depth water top'.
Ocean biomes now require their own definitions again.
As a rough guide here are my test biomes, 4 stacked within a mapchunk:

Code: Select all
minetest.clear_registered_biomes()
minetest.clear_registered_decorations()

-- Biomes

-- Temperate

minetest.register_biome({
   name = "grassland",
   node_top = "default:dirt_with_grass",
   depth_top = 1,
   node_filler = "default:dirt",
   depth_filler = 1,
   --node_stone = "",
   --node_water_top = "",
   --depth_water_top = ,
   --node_water = "",
   --node_dust = "",
   y_min = 18,
   y_max = 32,
   heat_point = 50,
   humidity_point = 50,
})

--Hot

minetest.register_biome({
   name = "desert",
   node_top = "default:desert_sand",
   depth_top = 1,
   node_filler = "default:desert_sand",
   depth_filler = 1,
   node_stone = "default:desert_stone",
   --node_water_top = "",
   --depth_water_top = ,
   --node_water = "",
   --node_dust = "",
   y_min = 3,
   y_max = 17,
   heat_point = 50,
   humidity_point = 50,
})

-- Cold

minetest.register_biome({
   name = "tundra",
   node_top = "default:dirt_with_snow",
   depth_top = 1,
   node_filler = "default:dirt",
   depth_filler = 1,
   --node_stone = "",
   --node_water_top = "",
   --depth_water_top =,
   --node_water = "",
   node_dust = "default:snow",
   y_min = 33,
   y_max = 31000,
   heat_point = 50,
   humidity_point = 50,
})

-- Ocean

minetest.register_biome({
   name = "ocean",
   node_top = "default:sand",
   depth_top = 1,
   node_filler = "default:sand",
   depth_filler = 2,
   --node_stone = "",
   --node_water_top = "",
   --depth_water_top = ,
   --node_water = "",
   --node_dust = "",
   y_min = -256,
   y_max = 2,
   heat_point = 50,
   humidity_point = 50,
})
 

User avatar
TenPlus1
Member
 
Posts: 2649
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Biome API changes, world maintainers please read

by TenPlus1 » Thu Feb 26, 2015 07:34

Thanks for the update Paramat... will go through Ethereal biomes at some point and see if it all works out :)
 

nackstein
New member
 
Posts: 3
Joined: Mon Mar 02, 2015 09:00

Re: Biome API changes, world maintainers please read

by nackstein » Tue Mar 03, 2015 15:13

thanks paramat for this change.
I have a question:
it's possible to define a biome that work for both mg6 and mg7 that instead of _replacing_
old parameter (like node_dust_water) with new one (like node_water_top/below) it adds all
of them? I espect that some elements of the lua list just get ignored if not pertinent to the
mg version in use. I'm right?

thanks
 

User avatar
paramat
Developer
 
Posts: 3546
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: Biome API changes, world maintainers please read

by paramat » Wed Mar 04, 2015 22:58

nackstein wrote:I espect that some elements of the lua list just get ignored if not pertinent to the
mg version in use.

Correct, as far as i know.
So it seems possible to have the biome API act differently in different mapgens but with a single biome definition usable in both, however the biome API is meant to work the same in all mapgens, hmmmm was about to centralise it.
The full biome API doesn't work in mgv6, only decorations are placed.
Node dust water was replaced because it failed under overhangs and was usually used for icesheet, i don't want to have both.
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: Biome API changes, world maintainers please read

by 4aiman » Tue Jun 23, 2015 08:42

Hi, paramat!

Could you explain to some greater extent the new biomes registration system?
I'd like to comment the registration of a biome with some statements/questions and it would be great to hear out your comments and/or corrections if you'll have enough time to post those here.
Should anyone else be able to comment - you're welcome!

Code: Select all
name = "grassland"

^ Ok, this is self-explanatory.
Code: Select all
heat_point = 50,
humidity_point = 50,

^ Ok, this ones too. The only question is: is there any limits? how low/high can be heat/humidity?
Code: Select all
y_min = 18,
y_max = 32,

^ MAX and MIN altitude for a biome.
Node_top will appear at y==32 within this biome.
Biome won't affect any nodes below y==18.
Code: Select all
node_top = "default:dirt_with_grass",
depth_top = 1,

^ This is the node that will be on top of the biome and it will be placed only at the very top of it, 'cause depth_top is set to 1. Should I want to have a 2-node-height "blanket" to cover my biome, I'm to set depth_top to 2.
Code: Select all
node_filler = "default:dirt",
depth_filler = 1,

^ slightly more confusing, but still, node_filler is the node that will appear under the node_top and will be of depth_filler nodes high.
Code: Select all
--node_stone = "",

^ Now this IS interesting. Does this field help to replace all stone with some other node?
Will it enable me to have 1-node-height biome of some node at any altitude if I omit the node_top and node_filler fields in the definition?
Code: Select all
--node_water_top = "",

^This works like node_top except it replaces water at the y_max with a node_water_top wherever the biome goes below water_level.
Now... say I have water_level set to 1.
What will happen if I define a biome with node_filler and node_top set to "default:water"?
Does node_water_top affect only naturally (not biome-defined) placed water at and below the water_level?
Code: Select all
--depth_water_top = ,

^This confuses me even more. does it work like node_filler only for water @water_level and below?
Code: Select all
--node_water = "", 

^ I bet setting this to lava will effectively turn all water within biome to lava. Is that true?
Code: Select all
 --node_dust = "",

^ This was removed... or was it?


Overall, it will definitely help to see a fresh example with notes on what every field is responsible for.
I guess, that would be helpful for minetest wiki and minetest dev resources.

Regards!


Edit:
Having played around with mapgen, I found out that currently biomes can go beyond y_max & y_min if there's no other biome above or below (or there is, but it's humidity and heat made the center of that second biome too far.)

What I'm trying to do is to have all mountains above y==50 to be covered with default:snowblock.
Currently I have to use multiple biomes to ensure that there would be only one type of a landscape above y==50.

I found it impossible to omit heat and/or humidity and still get a biome registered and generated.
 

User avatar
paramat
Developer
 
Posts: 3546
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: Biome API changes, world maintainers please read

by paramat » Sun Jun 28, 2015 05:32

> The only question is: is there any limits? how low/high can be heat/humidity?

See viewtopic.php?f=47&t=11603

> Does this field help to replace all stone with some other node?
Will it enable me to have 1-node-height biome of some node at any altitude if I omit the node_top and node_filler fields in the definition?

All stone nodes will be replaced by the node of your choice.
Thin biomes are not possible though because biome is only recalculated at each upper surface found while working down a node column and remains selected all the way down a column until air.

'node_water_top' is usually used for icesheet, it will replace default water with the chosen node from 'water_level' down to 'water_level' - 'depth_water_top'. See my biomesdev mod to see how this works for icesheet.
'node_water' is the chosen node to replace the remaining water below the top layer of 'water_top'.

> Does node_water_top affect only naturally (not biome-defined) placed water at and below the water_level?

Yes.

'node_dust_water' was removed, but 'node_dust' remains.

For a full biome system example using latest biome API see:
https://github.com/paramat/biomesdev

> What I'm trying to do is to have all mountains above y==50 to be covered with default:snowblock.
Currently I have to use multiple biomes to ensure that there would be only one type of a landscape above y==50.
I found it impossible to omit heat and/or humidity and still get a biome registered and generated.

First edit the ymax of all lower biomes to 49.
Then add your high mountain biome with heat/humidity points both set to 50 (the mid-point value).
Remember to clear the default biomes first before defining your own system (see biomesdev mod) otherwise the 2 systems will interfere.
 

User avatar
paramat
Developer
 
Posts: 3546
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat
 


Return to General Discussion



Who is online

Users browsing this forum: No registered users and 2 guests