Post your mapgen questions here (modding or engine)
-
- Member
- Posts: 25
- Joined: Sat Feb 18, 2023 13:31
Re: Post your mapgen questions here (modding or engine)
Sorry if this not the correct area to ask or has been answered before.
I wish to really break up the default:stone with other blocks. I understand mapgen_stone is generated in chunks so if I used a randomizer function on the mapgen_stone alias this would give me a random choice per chunk rather than per block, yes?
My first consideration was to use scatter ores but lots and lots of it to shotgun blast other blocks everywhere in the default:stone, however I am having trouble knowing what the value maximums are.
This seemed like a logical start but it errors out, I assume because it's too much:
"clust_scarcity and clust_num_ores" must be greater than 0"
minetest.register_ore({
ore_type = "scatter",
ore = "default:desert_stone",
wherein = "default:stone",
clust_scarcity = 1 * 1 * 1,
clust_num_ores = 5958200000000,
clust_size = 31000,
y_max = 0,
y_min = 0,
})
Could writing my own lua mapgen help here? If so could someone point me to some resources on where to begin with that?
Please feel free to laugh, I know what I've tried must look pretty silly. Thank you in advance of any help.
I wish to really break up the default:stone with other blocks. I understand mapgen_stone is generated in chunks so if I used a randomizer function on the mapgen_stone alias this would give me a random choice per chunk rather than per block, yes?
My first consideration was to use scatter ores but lots and lots of it to shotgun blast other blocks everywhere in the default:stone, however I am having trouble knowing what the value maximums are.
This seemed like a logical start but it errors out, I assume because it's too much:
"clust_scarcity and clust_num_ores" must be greater than 0"
minetest.register_ore({
ore_type = "scatter",
ore = "default:desert_stone",
wherein = "default:stone",
clust_scarcity = 1 * 1 * 1,
clust_num_ores = 5958200000000,
clust_size = 31000,
y_max = 0,
y_min = 0,
})
Could writing my own lua mapgen help here? If so could someone point me to some resources on where to begin with that?
Please feel free to laugh, I know what I've tried must look pretty silly. Thank you in advance of any help.
- Blockhead
- Member
- Posts: 1681
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: Post your mapgen questions here (modding or engine)
Minetest generates in chunks of 5x5x5 blocks (1 block = 16 nodes; 1 chunk = 80x80x80 nodes) at a time. Trying to make a scatter ore larger than the chunk size doesn't make sense. Also, a clust_scarity of 1*1*1 = 1 is just going to replace all the stone (docs say: "Ore has a 1 out of clust_scarcity chance of spawning in a node." -> 1 in 1 is 100%). Also this ore is applied without regard to biome or y-coordinate, which you will probably want to add once you have the other parameters worked out.minetestlover wrote: ↑Sat Feb 18, 2023 13:59Sorry if this not the correct area to ask or has been answered before.
I wish to really break up the default:stone with other blocks. I understand mapgen_stone is generated in chunks so if I used a randomizer function on the mapgen_stone alias this would give me a random choice per chunk rather than per block, yes?
My first consideration was to use scatter ores but lots and lots of it to shotgun blast other blocks everywhere in the default:stone, however I am having trouble knowing what the value maximums are.
This seemed like a logical start but it errors out, I assume because it's too much:
"clust_scarcity and clust_num_ores" must be greater than 0"
minetest.register_ore({
ore_type = "scatter",
ore = "default:desert_stone",
wherein = "default:stone",
clust_scarcity = 1 * 1 * 1,
clust_num_ores = 5958200000000,
clust_size = 31000,
y_max = 0,
y_min = 0,
})
Could writing my own lua mapgen help here? If so could someone point me to some resources on where to begin with that?
Please feel free to laugh, I know what I've tried must look pretty silly. Thank you in advance of any help.
So I would suggest upping your cluster scarcity, reducing the cluster size to something more reasonable, probably even less than 80*80*80. clust_num_ores can probably only be tuned once you have all of the ore registrations in place, since each ore needs to leave spare stone for the other ores to try. Also, you will need to use different noise parameters, at least the seed number, for each ore definition, or you'll get identical patterns.
Carefully revise the Ore definition docs and think about the consequences of each parameter in your mind, if you can, then get back to the coding.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
-
- Member
- Posts: 25
- Joined: Sat Feb 18, 2023 13:31
Re: Post your mapgen questions here (modding or engine)
Thank you block head. I did not realize chunks were so small. This is all very helpful information. Thanks again.
- Skamiz Kazzarch
- Member
- Posts: 618
- Joined: Fri Mar 09, 2018 20:34
- GitHub: Skamiz
- In-game: Skamiz
- Location: la lojbaugag.
Re: Post your mapgen questions here (modding or engine)
Depends on the result you want. If you just want the new stone type to be present in patches or blobs in the default stone, then the ore definition is sufficient.
In this case it is helpful to first generate the 'ore' in "air" rather then "default:stone", because it is very easy to see the distribution this way. Then when you are finished tweaking the parameters you just change it back to generating in stone.
If instead you want to completely break up the default stone, so that the new stone type is present in about equal amounts in the underground then a lua mapgen is the way to go.
-
- Member
- Posts: 25
- Joined: Sat Feb 18, 2023 13:31
Re: Post your mapgen questions here (modding or engine)
Code: Select all
minetest.register_ore({
ore_type = "scatter",
ore = "default:desert_stone",
wherein = {"default:stone"},
clust_scarcity = 3 * 3 * 3,
clust_num_ores = 25600,
clust_size = 80,
})
- Skamiz Kazzarch
- Member
- Posts: 618
- Joined: Fri Mar 09, 2018 20:34
- GitHub: Skamiz
- In-game: Skamiz
- Location: la lojbaugag.
Re: Post your mapgen questions here (modding or engine)
You can try out this mod: https://content.minetest.net/packages/MisterE/luamap/
It is designed to make mapgen work a fairly simple process and it looks like it's fairly well documented.
Alternatively, if you want to see a mapgen mod that is closer how it's done in a more "vanilla" way, in the topic of my mod 'noise_handler' I have a template mapgen which I use for all of my own mapgen mods.
viewtopic.php?f=9&t=27883
It is designed to make mapgen work a fairly simple process and it looks like it's fairly well documented.
Alternatively, if you want to see a mapgen mod that is closer how it's done in a more "vanilla" way, in the topic of my mod 'noise_handler' I have a template mapgen which I use for all of my own mapgen mods.
viewtopic.php?f=9&t=27883
-
- Member
- Posts: 25
- Joined: Sat Feb 18, 2023 13:31
Re: Post your mapgen questions here (modding or engine)
Thank you. I will get reading and report back.
-
- Member
- Posts: 14
- Joined: Sun Feb 26, 2023 04:17
Re: Post your mapgen questions here (modding or engine)
Does anyone recognize what mod this is from?
- Skamiz Kazzarch
- Member
- Posts: 618
- Joined: Fri Mar 09, 2018 20:34
- GitHub: Skamiz
- In-game: Skamiz
- Location: la lojbaugag.
Re: Post your mapgen questions here (modding or engine)
No, but at a guess it's either a randomizer like this one: https://content.minetest.net/packages/NO11/randomizer/
or its just a result of someone messing with mapgen code.
or its just a result of someone messing with mapgen code.
-
- Member
- Posts: 129
- Joined: Sat Jan 02, 2021 13:58
- GitHub: corarona
- IRC: cora
- In-game: cora
- Contact:
Re: Post your mapgen questions here (modding or engine)
This kind of stuff (seemingly randomly exchanged nodes) can happen when wrong (or nil!?) names are given to minetest.get_content_id() in mapgen on_generated callbacks in my experience.
-
- Member
- Posts: 129
- Joined: Sat Jan 02, 2021 13:58
- GitHub: corarona
- IRC: cora
- In-game: cora
- Contact:
Re: Post your mapgen questions here (modding or engine)
regarding the original question the easiest to simply exchange stone with a different node is to set a (different) alias for mapgen_stone
e.g.
minetest.register_alias('mapgen_stone', 'my_cool_mod:stone')
same works for mapgen_water_source and mapgen_river_water_source for the "normal" mapgens and a bunch more for v6 ( https://github.com/minetest/minetest/bl ... i.txt#L334 )
randomly exchanging it would need a lua mapgen, yeah ... the previously linked one shows how it works in relatively simple terms
EDIT:
if y_min and y_max are both 0 it would apply to just the 0 level (1 below water level i guess). To have it apply to all the map just leave out the y_min and y_max...
the actual world minimum and maximum values in default settings are -30912 and 30927
e.g.
minetest.register_alias('mapgen_stone', 'my_cool_mod:stone')
same works for mapgen_water_source and mapgen_river_water_source for the "normal" mapgens and a bunch more for v6 ( https://github.com/minetest/minetest/bl ... i.txt#L334 )
randomly exchanging it would need a lua mapgen, yeah ... the previously linked one shows how it works in relatively simple terms
EDIT:
if y_min and y_max are both 0 it would apply to just the 0 level (1 below water level i guess). To have it apply to all the map just leave out the y_min and y_max...
the actual world minimum and maximum values in default settings are -30912 and 30927
Re: Post your mapgen questions here (modding or engine)
Hi I currently have defined custom biome. The generation of the biome works but the mapgen also generates nodes above the height I've defined in my lua files. The nodes generated above are just stone. How can I tell the mapgen (v7) to not generate anything above the biome height I defined? I tried it by simply adding another biome that only consists out of air but this didn't work.
The code is as follows:
The code is as follows:
Code: Select all
-- Register a test biome
minetest.register_biome({
name = "plains",
node_top = "pangeos:dirt_with_grass",
depth_top = 1,
node_filler = "pangeos:dirt",
depth_filler = 3,
node_stone = "pangeos:stone",
node_water_top = "pangeos:water_source",
depth_water_top = 1,
node_water = "pangeos:water_source",
node_river_water = "pangeos:river_water_source",
node_riverbed = "pangeos:stone",
depth_riverbed = 2,
vertical_blend = 4,
y_min = 2,
y_max = 31,
heat_point = 50,
humidity_point = 50,
})
minetest.register_biome({
name = "plains_beach",
node_top = "pangeos:sand",
depth_top = 1,
node_filler = "pangeos:sand",
depth_filler = 3,
node_riverbed = "pangeos:sand",
depth_riverbed = 2,
vertical_blend = 3,
y_min = -4,
y_max = 1,
heat_point = 50,
humidity_point = 50,
})
minetest.register_biome({
name = "plains_sky",
node_top = "air",
depth_top = 1,
node_filler = "air",
node_riverbed = "air",
y_min = 32,
y_max = 31000,
heat_point = 50,
humidity_point = 50,
})
- Skamiz Kazzarch
- Member
- Posts: 618
- Joined: Fri Mar 09, 2018 20:34
- GitHub: Skamiz
- In-game: Skamiz
- Location: la lojbaugag.
Re: Post your mapgen questions here (modding or engine)
Adding node_stone = "air", might help?
But even then you will end up with flat areas where the mountains were cut off, so...
But even then you will end up with flat areas where the mountains were cut off, so...
-
- Member
- Posts: 1118
- Joined: Mon Dec 29, 2014 08:07
- Location: USA
Re: Post your mapgen questions here (modding or engine)
Biome definitions define where those nodes appear in the map. Biome definitions do not determine terrain height.
The terrain generates according to the heightmap. Biome definitions will not affect this. Your biome definition dictates only that those nodes appear within those y_min and y_max values, but terrain can generate well beyond those limits, above and below.
You will experience this issue in all mapgens, including lua mapgens, if the height of the heightmap exceeds the y_max value of the biome. This is what allows ocean, beach, and land based biomes within the same heat / humidity points.
Shad
The terrain generates according to the heightmap. Biome definitions will not affect this. Your biome definition dictates only that those nodes appear within those y_min and y_max values, but terrain can generate well beyond those limits, above and below.
You will experience this issue in all mapgens, including lua mapgens, if the height of the heightmap exceeds the y_max value of the biome. This is what allows ocean, beach, and land based biomes within the same heat / humidity points.
Shad
Re: Post your mapgen questions here (modding or engine)
Hello, I'm not sure if I should write here or not here, but I'll write here. I'm trying to create a game and I don't understand how to make my map be created when creating a map like in the game "Alter". "Alter" described the logic and conversations, but I didn't find any code that would create a map
- LMD
- Member
- Posts: 1396
- Joined: Sat Apr 08, 2017 08:16
- GitHub: appgurueu
- IRC: appguru[eu]
- In-game: LMD
- Location: Germany
- Contact:
Re: Post your mapgen questions here (modding or engine)
Alter doesn't use procedural mapgen. It has a world schematic baked in and just places that in the world: https://gitlab.com/yamanq/alter/-/blob/ ... t.lua#L196.Yargus wrote: ↑Wed Apr 26, 2023 09:29Hello, I'm not sure if I should write here or not here, but I'll write here. I'm trying to create a game and I don't understand how to make my map be created when creating a map like in the game "Alter". "Alter" described the logic and conversations, but I didn't find any code that would create a map
- Midnight
- Member
- Posts: 172
- Joined: Sun Dec 19, 2021 13:56
- GitHub: MidnightPhantom
- IRC: Dragon
- In-game: Dragon_Abysss
- Location: Dehradun, India
Re: Post your mapgen questions here (modding or engine)
Well thanks I needed this and forgive me for answering this late. And well thanks for giving the link to this post in another post I made.Skamiz Kazzarch wrote: ↑Sun Dec 04, 2022 14:05If you hold on for a while I will write you a mod for it, because I just realized that I also want that.
Do you want to block just lava or all liquids?
Edit: here you go.
no_cave_spill.zip
It places a stone basin around all underground liquid sources like so:
screenshot_20221204_163134.png
Works for all games which define a "mapgen_stone". aka most of them.
I really should have done this sooner, because the way liquids spill almost infinitely in Minetest annoys me to no end. So thank you for the idea.
Re: Post your mapgen questions here (modding or engine)
Hi guys, long time no see. I was wondering if minetest.delete_area is the correct way to force mapblocks to be re-generated. That is, to delete them in a way that mapgen code will need to be called next time they are emerged. Even if it worked, it is extremely slow though...
- Blockhead
- Member
- Posts: 1681
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: Post your mapgen questions here (modding or engine)
Yes that will work nicely. This is the Lua equivalent of running /deleteblocks.
I think it is slow because it performs a single delete statement against the database for each block, one at a time, instead of being able to ask it to delete a range. So I think it can involve rebuilding indexes which can involve a lot of tree re-organising operations, depending on the implementation of the database. That plus a write-back to disk.
Range deletions is kind of a hard problem because Minetest doesn't store the x, y and z of a block in separate columns in the database but instead encodes them into one value. We'd need to change this to accommodate deletions, but that may have its own problems. For instance, it probably wouldn't be worth it if it made block load operations slower, since those are frequent, whereas block deletion is only done by admins and cleanup scripts basically.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
- Desour
- Member
- Posts: 1472
- Joined: Thu Jun 19, 2014 19:49
- GitHub: Desour
- IRC: Desour
- In-game: DS
- Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
Re: Post your mapgen questions here (modding or engine)
Indeed. Minetest does one sql transaction for each deleted block. I also noticed this some weeks ago. The solution would be to put it all into one transaction. This is super simple, but I haven't gotten around to make a PR yet.
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)
Re: Post your mapgen questions here (modding or engine)
Interesting, thanks a lot you two!
- Midnight
- Member
- Posts: 172
- Joined: Sun Dec 19, 2021 13:56
- GitHub: MidnightPhantom
- IRC: Dragon
- In-game: Dragon_Abysss
- Location: Dehradun, India
Re: Post your mapgen questions here (modding or engine)
Hello everybody, here I come again.
Now here is my question,
How am I supposed to add a limit to cavern generation in minetest? Because I do not like the big void-like spaces in my world which lead to falling blocks getting stuck in the void, plus I don't get why doesn't the mtg map generate completely till -31000
Now here is my question,
How am I supposed to add a limit to cavern generation in minetest? Because I do not like the big void-like spaces in my world which lead to falling blocks getting stuck in the void, plus I don't get why doesn't the mtg map generate completely till -31000
-
- Member
- Posts: 25
- Joined: Sat Feb 18, 2023 13:31
Re: Post your mapgen questions here (modding or engine)
Sorry I can't help with the previous post.
I have a question regarding vmanip "set_lighting"
The API doc says:
I have a question regarding vmanip "set_lighting"
The API doc says:
can someone please tell me what these 'day' and 'night' values are? am I specifying how bright it should be if it generates during the day or night?set_lighting(light, [p1, p2]): Set the lighting within the VoxelManip to a uniform value.
light is a table, {day=<0...15>, night=<0...15>}
- Skamiz Kazzarch
- Member
- Posts: 618
- Joined: Fri Mar 09, 2018 20:34
- GitHub: Skamiz
- In-game: Skamiz
- Location: la lojbaugag.
Re: Post your mapgen questions here (modding or engine)
With the disclaimer that I don't know for certain.
I think it refers to natural and artificial light respectively. They are tracked as separate values.
In usual circumstances natural light value depends on on distance to closes position with unobstructed sky access and rendering brightness depends on light value and time of day.
Artificial light value depends only on closest/strongest light source node and it's rendering brightness is unchanging.
The visual brightness of a node is the greater one of the natural or artificial brightness.
At least that's my understanding of how this works.
I think it refers to natural and artificial light respectively. They are tracked as separate values.
In usual circumstances natural light value depends on on distance to closes position with unobstructed sky access and rendering brightness depends on light value and time of day.
Artificial light value depends only on closest/strongest light source node and it's rendering brightness is unchanging.
The visual brightness of a node is the greater one of the natural or artificial brightness.
At least that's my understanding of how this works.
- Blockhead
- Member
- Posts: 1681
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: Post your mapgen questions here (modding or engine)
The clue to the meaning I think is present in the description of minetest.get_node_light(pos[, timeofday]). It takes into account the natural light received, which is somewhere between day-light and night-light according to the time of day. In VoxelManip, you can set all the lighting manually, or you can allow it to be automatically recalculated upon calling write_to_map.minetestlover wrote: ↑Tue Dec 05, 2023 06:28Sorry I can't help with the previous post.
I have a question regarding vmanip "set_lighting"
The API doc says:can someone please tell me what these 'day' and 'night' values are? am I specifying how bright it should be if it generates during the day or night?set_lighting(light, [p1, p2]): Set the lighting within the VoxelManip to a uniform value.
light is a table, {day=<0...15>, night=<0...15>}
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
Who is online
Users browsing this forum: Bing [Bot] and 3 guests