New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow multiple cave liquids in a biome definition #8481
Conversation
PR also does this: If a biome defined cave liquid (or multiple) is defined, the entire cave uses that node (or a randomly chosen node from the list). If no biome defined cave liquids are defined, the behaviour falls back to the old hardcoded behaviour. There is a small performance benefit as biome is no longer being calculated for every cave segment. |
|
Error seems fixed. |
@@ -63,6 +63,7 @@ BiomeManager::BiomeManager(Server *server) : | |||
b->m_nodenames.emplace_back("mapgen_stone"); | |||
b->m_nodenames.emplace_back("ignore"); | |||
b->m_nodenames.emplace_back("ignore"); | |||
b->m_nnlistsizes.push_back(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixed the error message.
Tested with a biome with all fields used, mod code (mod 'depends' on default and stairs):
When |
This is a nice feature, but I'd like to test its functionality as soon I've got time for it. |
Simple commit 2 added, see first post. SmallJoker, dev is unbearably slow at the moment so i suggest not testing to speed up approval, you can trust my testing. I'm getting impatient and feel i should be partially trusted with mapgen stuff =) |
This allows games to specify biome cave liquids and avoid the old hardcoded behaviour, but preserves the ability to have multiple cave liquids in one biome, such as lava and water. When multiple cave liquids are defined by the biome definition, make each entire cave use a randomly chosen liquid, instead of every small cave segment using a randomly chosen liquid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected.
Although labelled a feature, this is an important step in de-hardcoding some aspects of mapgen.
We already have a biome-defined cave liquids feature, however only 1 cave liquid per biome can be defined, which cannot reproduce the current mix of water and lava caves.
This PR allows games to replace the hardcoded engine distribution of cave liquids with biome-defined cave liquids, while preserving the ability to have multiple cave liquids in a biome (such as water and lava).
Relative chances can be altered by repeated entries in the list.
If a biome defined cave liquid (or multiple) is defined, each entire cave uses that node (or a randomly chosen node from the list). Previously, biome-defined cave liquid was calculated per cave segment.
The change from per-segment to per-cave avoids every cave segment randomly choosing a node from the list, resulting in too-rapidly changing cave liquids within one cave. For example if the 2 nodes were water and lava, switching back and forth every few nodes would result in almost completely obsidian, no more lava lakes.
So the code for biome-defined liquid has moved from 'carveRoute()' (which generates each cave segment) to 'makeCave()' (which applies to the entire cave).
If no biome defined cave liquids are defined, the behaviour falls back to the old hardcoded behaviour.
There is a small performance benefit as biome is no longer being calculated for every cave segment.
This arose from discussion of MTG cave liquids:
minetest/minetest_game#2339 (comment)
minetest/minetest_game#2358
/////////////////////
Commit 2:
Don't place nodes if cave liquid is defined as 'air'
Avoids pointlessly placing huge numbers of "air" nodes when a cave liquid is defined to be air, for when no cave liquid is wanted.