How to do an Underground Magma/Lava Lake or Lava pocket?

Post Reply
Mik
New member
Posts: 4
Joined: Thu Dec 19, 2024 21:28
In-game: Mik

How to do an Underground Magma/Lava Lake or Lava pocket?

by Mik » Post

For a game I'm writing, I need a *reliable* deep underground lava lake biome. The underground biomes of minetest_game aren't reliable in that they *might* create lava_source but that is not guaranteed and they are usually not deep enough.

The basic idea is, that there is a very hard to get item, which is only found deep underground at the bottom of a lava lake -- the deeper, the higher the chance that the item is there.

For now now two weeks, I try to build such a biome, getting into the noise and mapgen math, tried to adapt paramat's lvm_example and similar mapgen examples. But I just don't get it working.


So, how do you do an underground biome that blends nicely into the surrounding map and reliably places one or two mid-sized lava lakes?


Thanks for you time!

User avatar
Krock
Developer
Posts: 4736
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: How to do an Underground Magma/Lava Lake or Lava pocket?

by Krock » Post

You could detect caves generated by the mapgen and fill those with lava.

1. Use an on_generated callback
2. Retrieve the VoxelManip objects (+ data)
3. Probe a few positions by scanning upwards or downwards in the vmanip data for "air" nodes.
4. If there are sufficient "air" nodes, do replace all of them under a certain Y coordinate with >= 1 lava source
5. Write the data back to the map
6. Test it.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

Mik
New member
Posts: 4
Joined: Thu Dec 19, 2024 21:28
In-game: Mik

Re: How to do an Underground Magma/Lava Lake or Lava pocket?

by Mik » Post

Ah! Thanks Krock! :-)
3. Probe a few positions by scanning upwards or downwards in the vmanip data for "air" nodes.
That did the trick, albeit a bit different. I had been replacing air with lava already, but that always created either massive amounts of lava_source in large caves or endless streams of lava flowing down or illogical lava in the air.

So I did it the other way around: scan upwards and replace stone with lava but only if y is above a limit and the density noise is above a threshold and the candidate positions are completely surrounded by either stone or lava.

I'm still testing, but that seems to confine the lava into pockets which don't run wild outside of the mapchunk.

It's not perfect yet, but good enough.

Thanks again! :-)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests