Post your mapgen questions here (modding or engine)

User avatar
Slightly
Member
Posts: 174
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: Post your mapgen questions here (modding or engine)

by Slightly » Post

I've created a simple mapgen mod based on MTG to generate a gently rolling landscape suitable for advtrains. I'd like feedback on how I'm handling the non-default settings for mgV7.

The map looks great, but I'm not sure that the settings are being used on the first chunk of a new world (clearly they are as new chunks are generated) and not sure if I'm using the best (or if there is a best) order. I've tried wrapping it in minetest.register_on_mods_loaded(function() but it doesn't seem to make a difference or to be necessary. Suggestions for making sure it starts up consistently on a new world?

Code: Select all

-- Set core mgv7 flags
minetest.set_mapgen_setting("mgv7_spflags", "nomountains,noridges,nofloatlands,nocaverns", true)
minetest.set_mapgen_setting("mg_flags", "nocaves,nodungeons,light,decorations,biomes,ores", true)

minetest.set_mapgen_setting_noiseparams(
"mgv7_np_terrain_base", 
{
	octaves = 5,
	lacunarity = 2.0999999,
	persistence = 0.800000012,
	spread = {x = 1600, y = 1600, z = 1600},
	scale = 20,
	seed = 82341,
	flags = "defaults",
	offset = 4
},
true
)


minetest.set_mapgen_setting_noiseparams(
"mgv7_np_terrain_alt",
{
	octaves = 5,
	lacunarity = 2,
	persistence = 0.600000024,
	spread = {x = 600, y = 600, z = 600},
	scale = 15,
	seed = 82341,
	flags = "defaults",
	offset = 6
},
true
)

minetest.set_mapgen_setting_noiseparams(
"mgv7_np_height_select", 
{
	octaves = 6,
	lacunarity = 2.0999999,
	persistence = 0.699999988,
	spread = {x = 1000, y = 1000, z = 1000},
	scale = 4.5,
	seed = 4213,
	flags = "eased",
	offset = -7
},
true
)

AndPherb
New member
Posts: 8
Joined: Wed Jan 14, 2026 04:49

3d biomes?

by AndPherb » Post

Please tell me if I posted in the wrong place.
I want to make a mapgen mod that uses 3D biomes to create cave and sky biomes to fill all that empty vertical space, and then I want to also implement randomly generated structures.
How should I go about doing this?

User avatar
TenPlus1
Member
Posts: 4373
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: 3d biomes?

by TenPlus1 » Post

You can use the default biome function to decorate existing cave biomes and turn on floatlands for sky biomes to be enabled, or you can use custom mods like these e.g.

https://content.luanti.org/packages/TX_ ... y_islands/

https://content.luanti.org/packages/Shara/caverealms/

User avatar
Blockhead
Moderator
Posts: 2989
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: 3d biomes?

by Blockhead » Post

You can work either with a pure Lua mapgen or work with the C++ mapgens and some extra Lua in a mod. There is one major hurdle: Luanti's own biome system is a 2D map with y-slices, not full 3D noise. You can have biomes with a y_min and a y_max, but no ups and downs in the height of a biome (I hope that makes sense). So, you kind of need your own biome system, which already introduces compatibility issues for mods made for the engine's own biome system. But oh well.

To work within the engine's current C++ mapgens and biome system, you will have to forgo smooth transitions. Your world will be sliced in some specific way, like say every 1000 y levels is a new set of biomes. Then, your mod will force the world's biome noises to be offset much higher, so that the majority of the world is underground. You can see what I mean if you go to the Settings -> Mapgen -> Mapgen <some mapgen> -> section "Noises", and change the offset in each noise to 30,000 or maybe higher (the co-ordinate limit is 30912 in any direction, ~62 km of height, width, breadth). To force settings, you will need a few API calls. The world will still be trying to generate with a surface, it will just be so high it will barely matter or not even be there with enough vertical offset.

For pure Lua, you will want 3D noises. You might want to use the same parameters for biomes that the engine uses, namely heat and humdity (and height) or you might invent your own new ones. Then, you will need a callback registered with core.register_on_genreated. This will evaluate each node in the world and set it appropriately. You typically sample several 3D noise functions to make the decision. This is not very beginner-friendly if you're still a novice programmer, but, hopefully a good challenge. If you go this way (and probably even after trying the first you may decide it isn't good enough) then I heavily, heavily recommend you learn as much as you can by reading Post Your Mapgen Questions! thread and all of the mods you can find that use on_generated callbacks and VoxelManip objects.

Edit: Since a picture is worth 1000 words, added some illustrations

Edit 2: Read the relevant chapters in the modding book
Attachments
y_offset.png
y_offset.png (18.03 KiB) Viewed 230 times
noise_params_each.png
noise_params_each.png (77.79 KiB) Viewed 230 times
stepped_or_smoov.png
stepped_or_smoov.png (16.43 KiB) Viewed 230 times
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

AndPherb
New member
Posts: 8
Joined: Wed Jan 14, 2026 04:49

My stupid questions about biome and map generation

by AndPherb » Post

These will come as I read documentation
First stupid question: Can I just define a layer of underground biomes by using y_min/max, or do I have to do extra stuff?
Second stupid question: Can I make surface attributes for underground biomes without screwing with c++?
Third stupid question: Are ores transparent and just overlayed on stone?

More to come.

User avatar
Linuxdirk
Member
Posts: 3415
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: My stupid questions about biome and map generation

by Linuxdirk » Post

AndPherb wrote:
Sat Jan 17, 2026 03:03
Are ores transparent and just overlayed on stone?
You register them as individual nodes that then can be added to the world by the mapgen. How you create the node textures is up to you.

For consistency and later stone texture changes it’s the best to design the ores as transparent textures and then combine the stone texture with the transparent ore texture on node registration. The initial setup might be a bit more complex than just drawing individual opaque textures for the ores, but with this you can easily change the stone texture or re-use the ore texture in other node types without caring about the base texture.

User avatar
Blockhead
Moderator
Posts: 2989
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: My stupid questions about biome and map generation

by Blockhead » Post

AndPherb wrote:
Sat Jan 17, 2026 03:03
These will come as I read documentation
First stupid question: Can I just define a layer of underground biomes by using y_min/max, or do I have to do extra stuff?
If the engine has no biome to spit out for a given y level, everything should just spit out as basic stone in the shape of the 3D noise I think. So any missing y slices will be obvious.
AndPherb wrote:
Sat Jan 17, 2026 03:03
Second stupid question: Can I make surface attributes for underground biomes without screwing with c++?
Lua gives you complete control of map generation, and can even run multi-threaded. The only reason to write in C++ is potential speed-up* or because pure Lua mapgens can't be selected on the main menu, just "singlenode". You can do it with a Lua generator just fine, but not without one of those.

I checked two mods, Underch and Ethereal NG, and both use Lua to place mushrooms, moss and so on. The method on the surface world is a place_on property, but the link I just gave mentions that these are ground level, so multiple vertical levels in a chunk, as far as I know, will resolve to placement on just the top level. I think I have discussed this with repetitivestrain/halon before...

*but the C++ generator has bugs when running multi-threaded..
AndPherb wrote:
Sat Jan 17, 2026 03:03
Third stupid question: Are ores transparent and just overlayed on stone?
The texturing of nodes called "ores" is not considered by the generator. Ores could be not literal metal ores but anything you want placed according to the algorithms for ore placement. See LinuxDirk's answer about what choices you might make if you make your own new ore nodes. Minetest Game's own definitions of ores do use texture overlays, but it is equally valid to draw customs for each, though if you have ores embedded in different types of stone, you would get too many permutations to do manually. But each permutation will need a new ore registration.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

meggs413
New member
Posts: 1
Joined: Mon Apr 27, 2026 15:58

How to use Schematics with singlenode mapgen

by meggs413 » Post

Hi All! My apologies if this isn't the right place to post such a question, but I had trouble finding answers online. So, I have been working on a custom mapgen mod that completely overhauls terrain generation and the biome system. It's a mineclonia mod because I like the item set. The mapgen has been working great for terrain and simple deco, but I have a problem with placing schematics.

As far as I can tell, I'm not able to use the inbuilt register_decoration function, because my terrain uses single node and I coded my own biome system that is substantially different from the standard. However, placing the schematics manually using place_schematic_on_vmanip has been causing a large issue: my schematics get cut off at chunk borders! I've seen this be an issue discussed before but not generally in the context of using singlenode mapgen. I'm wondering, is there a standard way to place schematics when using singlenode mapgen that doesn't result in this issue? Either a way to rig up the register_decoration function to my own biome system or a way to code around the failure at chunk boundaries when using place_schematic_on_vmanip, or is there another function I should be using? I'm still pretty new to this.

Some notes: I tried installing a chunk visualiser mod and was able to confirm that the cutoffs are at chunk boundaries. They don't only happen with large schematics, sometimes even small trees are cut off, so I don't think its a size issue but rather an issue innate to the way I am coding.

User avatar
cx384
Member
Posts: 782
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: How to use Schematics with singlenode mapgen

by cx384 » Post

Hi, one thing you can do is to generate single nodes and let them place the semantic at a later point, such that the bordering mapblocks are already generated.

The caverealms mod does this and moretrees did it in the past (now it uses decorations).
https://github.com/mt-mods/moretrees/bl ... t.lua#L352
https://github.com/HeroOfTheWinds/minet ... ms.lua#L21
meggs413 wrote:
Mon Apr 27, 2026 18:49
Some notes: I tried installing a chunk visualiser mod and was able to confirm that the cutoffs are at chunk boundaries. They don't only happen with large schematics, sometimes even small trees are cut off, so I don't think its a size issue but rather an issue innate to the way I am coding.
You don't need a mod for this, the engine can already do it, search for the keymap_toggle_block_bounds setting.
Can your read this?

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests