Post your mapgen questions here (modding or engine)
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
MommyKat, best find the moretrees mod thread in the forum and ask the author.
As far as i know the mod is now configured to place special 'mapgen' saplings during mapgen, that then grow soon after, so you may need to wait in an area for a few minutes for the trees to appear.
As far as i know the mod is now configured to place special 'mapgen' saplings during mapgen, that then grow soon after, so you may need to wait in an area for a few minutes for the trees to appear.
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: Post your mapgen questions here (modding or engine)
Check this post by Paramat:roboto wrote:@duane,
You were unclear about comparing the biome id with the (xz location??) So I took a peek at the spoilers and used set biome = biomemap[location]???? as
local biome = biomemap["-200", "-250"]
-200 is the x coordinate whereas -250 is the z coordinate. That was my assumption of what you meant.
I also put a link between lottmapgen.lottmapgen_biomes(11) and minetest.get_biome_id("iron_hills") because lottmapgen.lottmapgen_biomes(11) was not named "iron_hills" in the lottmapgen mod.
viewtopic.php?f=47&t=15272&p=293766&hil ... ex#p293766
Believe in people and you don't need to believe anything else.
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
local biome = biomemap[index]
Where:
index = (z - minp.z) * zstride + (x - minp.x) + 1
'minp' is the minimum point of the mapchunk and is a provided variable in an 'on generated' function.
'zstride' is the mapchunk size in nodes:
zstride = maxp.x - minp.x
You can only use the biomemap in an 'on generated' function for the mapchunk just generated.
Where:
index = (z - minp.z) * zstride + (x - minp.x) + 1
'minp' is the minimum point of the mapchunk and is a provided variable in an 'on generated' function.
'zstride' is the mapchunk size in nodes:
zstride = maxp.x - minp.x
You can only use the biomemap in an 'on generated' function for the mapchunk just generated.
-
- Member
- Posts: 62
- Joined: Wed Jul 19, 2017 15:21
- GitHub: NewbProgrammer101
- In-game: akoek
Re: Post your mapgen questions here (modding or engine)
I get it now.paramat wrote:local biome = biomemap[index]
Where:
index = (z - minp.z) * zstride + (x - minp.x) + 1
'minp' is the minimum point of the mapchunk and is a provided variable in an 'on generated' function.
'zstride' is the mapchunk size in nodes:
zstride = maxp.x - minp.x
You can only use the biomemap in an 'on generated' function for the mapchunk just generated.
- v-rob
- Developer
- Posts: 971
- Joined: Thu Mar 24, 2016 03:19
- GitHub: v-rob
- IRC: v-rob
- Location: Right behind you.
Re: Post your mapgen questions here (modding or engine)
I have a few questions for my subgame Subterranean. How can I:
• Place a schematic only at 0,0,0 for player spawning?
• Coat the walls, ceiling, and floor of lava caves with a layer of obsidian?
• Make lava caves spawn at every Y-level?
• Make caves with the exact same parameters as lava caves, but with different liquid?
• Place a schematic only at 0,0,0 for player spawning?
• Coat the walls, ceiling, and floor of lava caves with a layer of obsidian?
• Make lava caves spawn at every Y-level?
• Make caves with the exact same parameters as lava caves, but with different liquid?
Last edited by v-rob on Fri Nov 03, 2017 04:00, edited 1 time in total.
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
1. In an 'on generated' function detect if the mapchunk contains position 0,0,0, if so, place the schematic.
2. For lava caves only? You can't.
3. In 0.5.0 i added a parameter for the upper limit of lava caves.
4. Set the 'mapgen alias' for lava source to a different liquid.
2. For lava caves only? You can't.
3. In 0.5.0 i added a parameter for the upper limit of lava caves.
4. Set the 'mapgen alias' for lava source to a different liquid.
Re: Post your mapgen questions here (modding or engine)
Is it possible to get a more flat landscape, but still deep oceans in mg v7?
I changed the scale in mgv7_np_terrain_alt to 15 and now I get nearly the landscape I want, but now also the oceans are flat. Reducing offset is not enough and makes oceans bigger
I changed the scale in mgv7_np_terrain_alt to 15 and now I get nearly the landscape I want, but now also the oceans are flat. Reducing offset is not enough and makes oceans bigger
Re: Post your mapgen questions here (modding or engine)
I found a setting that works for me, but another question:
Is it possible to disable water on floatlands? I don't want to have water because it is buggy
Is it possible to disable water on floatlands? I don't want to have water because it is buggy
Re: Post your mapgen questions here (modding or engine)
Ok, another question: is it possible to find a specific biome on the map? For example
/find_biome rainforest
to get teleported to the next rainforest biome
/find_biome rainforest
to get teleported to the next rainforest biome
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: Post your mapgen questions here (modding or engine)
Of course it is -- the same way the mapgen does. You'd have to do the same calculation the mapgen uses to get the biome, on a series of points getting farther away, until you generate the one you're after. You could fudge some of the details, like skipping the blend noises for heat and humidity.burli wrote:Ok, another question: is it possible to find a specific biome on the map? For example
/find_biome rainforest
to get teleported to the next rainforest biome
Believe in people and you don't need to believe anything else.
Re: Post your mapgen questions here (modding or engine)
That means, doing voronoi calculation in Lua. Has anyone ever done this before?
Re: Post your mapgen questions here (modding or engine)
I try to set up an ore with the stratum type, but I can't find any values that are working in any way and it seems that no one ever used it because I can't find anything about it. An example with some starting values would be nice.
Also some examples for the other not in MTG used ores (puff, vein and sheet) would be nice
Also some examples for the other not in MTG used ores (puff, vein and sheet) would be nice
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
> Is it possible to disable water on floatlands? I don't want to have water because it is buggy
Yes by clearing and reregistering the floatland biome registrations (they are in a separated function in default/mapgen.lua). We now have an API for clearing single biomes. Or in 0.4.16 stable clear all registered biomes then reregister them with your changes.
Set biome 'node_water' to "air".
> Ok, another question: is it possible to find a specific biome on the map?
What duane wrote.
Please post your stratum ore definition and describe what you are trying to acheive.
Yes by clearing and reregistering the floatland biome registrations (they are in a separated function in default/mapgen.lua). We now have an API for clearing single biomes. Or in 0.4.16 stable clear all registered biomes then reregister them with your changes.
Set biome 'node_water' to "air".
> Ok, another question: is it possible to find a specific biome on the map?
What duane wrote.
Please post your stratum ore definition and describe what you are trying to acheive.
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: Post your mapgen questions here (modding or engine)
While that's technically true, you're overcomplicating it. This is the relevant code:burli wrote:That means, doing voronoi calculation in Lua. Has anyone ever done this before?
Code: Select all
Biome *BiomeGenOriginal::calcBiomeFromNoise(float heat, float humidity, s16 y, s16 radius) const
{
Biome *b, *biome_closest = NULL;
float dist_min = FLT_MAX;
for (size_t i = 1; i < m_bmgr->getNumObjects(); i++) {
b = (Biome *)m_bmgr->getRaw(i);
if (!b || y > b->y_max || y < b->y_min)
continue;
float d_heat = heat - b->heat_point;
float d_humidity = humidity - b->humidity_point;
float d_radius = fabs(radius - b->radius) * 0.1f;
float dist = (d_heat * d_heat) +
(d_humidity * d_humidity) + d_radius;
if (dist < dist_min) {
dist_min = dist;
biome_closest = b;
}
}
return biome_closest ? biome_closest : (Biome *)m_bmgr->getRaw(BIOME_NONE);
}
You don't need to know every point where a biome exists. You only need to know a point -- unless it's vital that you get to the closest edge of the closest biome.
Believe in people and you don't need to believe anything else.
Re: Post your mapgen questions here (modding or engine)
Create an undulating layer of stone to create something like thisPlease post your stratum ore definition and describe what you are trying to acheive.
http://www.lichtkontrast.de/wp-content/ ... ichten.jpg
But everything I'm trying to do is fill the whole area.
Code: Select all
minetest.register_ore({
ore_type = "stratum",
ore = "default:glass",
wherein = {"default:stone"},
y_min = 0,
y_max = 100,
noise_threshold = 0.1,
np_stratum_thickness = 1,
clust_scarcity = 1,
noise_params = {
offset = 0.005,
scale = 0.002,
spread = {x = 20, y = 20, z = 20},
seed = 424,
octaves = 1,
persist = 0.0
},
biomes = {"tundra_hills", "tundra", "tundra_mountains"}
})
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
Here's an example:
'np stratum thickness' is a noise, you have supplied a number. In docs:
"If either of the 2 noise parameters are omitted the ore will occur from y_min
to y_max in a simple horizontal stratum."
Noise threshold is ignored here:
"The parameters `clust_num_ores`, `clust_size`, `noise_threshold` and
`random_factor` are ignored by this ore type."
Your 'noise params' does not define the y co-ordinate of the stratum centre (i can see my docs are not completely clear here). My example above is for a stratum centre that has an average y co-ordinate of y = 32 and varies roughly 16 nodes either side of that. However with > 1 octave you should assume that the variation either side can be as large as 2 * scale, and set y_min/max accordingly.
Code: Select all
minetest.register_ore({
ore_type = "stratum",
ore = "default:meselamp",
wherein = {"default:stone"},
clust_scarcity = 1,
y_min = -8,
y_max = 72,
noise_params = {
offset = 32,
scale = 16,
spread = {x = 256, y = 256, z = 256},
seed = 90122,
octaves = 3,
persist = 0.5
},
np_stratum_thickness = {
offset = 8,
scale = 4,
spread = {x = 128, y = 128, z = 128},
seed = -316,
octaves = 1,
persist = 0.0
},
})
"If either of the 2 noise parameters are omitted the ore will occur from y_min
to y_max in a simple horizontal stratum."
Noise threshold is ignored here:
"The parameters `clust_num_ores`, `clust_size`, `noise_threshold` and
`random_factor` are ignored by this ore type."
Your 'noise params' does not define the y co-ordinate of the stratum centre (i can see my docs are not completely clear here). My example above is for a stratum centre that has an average y co-ordinate of y = 32 and varies roughly 16 nodes either side of that. However with > 1 octave you should assume that the variation either side can be as large as 2 * scale, and set y_min/max accordingly.
Re: Post your mapgen questions here (modding or engine)
I never would have thought of that. Thanks
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
Maybe i should add the ability to have a fixed stratum thickness instead of requiring a noise for that, yes i think so.
- Wuzzy
- Member
- Posts: 4804
- Joined: Mon Sep 24, 2012 15:01
- GitHub: Wuzzy2
- IRC: Wuzzy
- In-game: Wuzzy
- Contact:
Re: Post your mapgen questions here (modding or engine)
Given a schematic with known node types which require on_construct to be called, and I know which node types in the schematic require on_construct to be called, but I do not know where they are, what is the most efficient way to find these nodes?
To illustrate:
Let's say I have a large schematic (30×30×30 or larger) and I know it has at least one chest in it, and I know this chest must have on_construct called, but I do not know where the chests are. If I just do minetest.place_formspec, the chests won't work because the function completely ignores on_construct. So I have to manually call on_construct on each chest. So far, so good.
Question is: How do I efficiently get the positions of these chests so I can properly call on_construct on these?
The naive solution seems to be minetest.find_nodes_in_area, but this seems wasteful since Minetest already knows the chest positions when placing them, so searching the entire area for the chest is unneccessary.
To illustrate:
Let's say I have a large schematic (30×30×30 or larger) and I know it has at least one chest in it, and I know this chest must have on_construct called, but I do not know where the chests are. If I just do minetest.place_formspec, the chests won't work because the function completely ignores on_construct. So I have to manually call on_construct on each chest. So far, so good.
Question is: How do I efficiently get the positions of these chests so I can properly call on_construct on these?
The naive solution seems to be minetest.find_nodes_in_area, but this seems wasteful since Minetest already knows the chest positions when placing them, so searching the entire area for the chest is unneccessary.
Re: Post your mapgen questions here (modding or engine)
@Wuzzy: maybe this helps (even if you voted it down)
https://github.com/minetest/minetest_game/issues/1926
https://github.com/minetest/minetest_game/issues/1926
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
Wuzzy if you don't rotate the schematic and the chest does not have a chance of placement, then you know where it is from it's position in the schematic, add relative position of chest from schematic minimum point, to placement position.
However if rotated or if there is a chance of placement, 'find nodes in area' is currently the best way.
Indeed it would be possible to store whether each node had been placed, and also return the rotation, to calculate positions later, but it's not worth all the extra code for these rare situations.
I'll implement that MTG suggestion.
However if rotated or if there is a chance of placement, 'find nodes in area' is currently the best way.
Indeed it would be possible to store whether each node had been placed, and also return the rotation, to calculate positions later, but it's not worth all the extra code for these rare situations.
I'll implement that MTG suggestion.
-
- Member
- Posts: 1118
- Joined: Mon Dec 29, 2014 08:07
- Location: USA
Re: Post your mapgen questions here (modding or engine)
When thinkning about running water and rivers, would it make sense to just have the water flow from a source, (a spring node), searching for the shortest route to the next lowest elevation, or falling until it hits the surface, while digging in one node deep from the surrounding terrain, so that water carves a path, instead of flowing over open terrain.
Would someone be willing to write a simple routine for pathfinding according to the rule above? I do believe this might solve the rivers problem.
Shad MOrdre
Would someone be willing to write a simple routine for pathfinding according to the rule above? I do believe this might solve the rivers problem.
Shad MOrdre
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
I have had similar thoughts about creating rivers that go downhill and erode. It would need to happen in a process after mapgen has created the initial riverless terrain. The disadvantage is it cannot create a 'finished world' as soon as you generate a mapchunk, but would be an interesting experiment.
River generation is very challenging, i have spent so long thinking about it.
River generation is very challenging, i have spent so long thinking about it.
- BirgitLachner
- Member
- Posts: 393
- Joined: Thu May 05, 2016 10:18
- In-game: Bibs
Re: Post your mapgen questions here (modding or engine)
Guys ... I already know a little bit about Mod creating but Mapgen stuff is much to far away form me.
But may be my wishes are very simple for you:
For use in the classroom or for similar purposes, it would be useful to be able to define the world a little more precisely. Some things that might be interesting:
1) a flat world with uniform ground, e. g. a layer of earth with grass, underneath stones to the bottom, without caves, without decoration and trees.
.... I have asked about it before and got some ideas for solutions, but none of them were perfect, i. e. as I described it. It would be nice if you could create a map-generator, where you could for example choose the layout of the map, so you could define the layers.
2) You should be able to choose certain biomes. This doesn't have to be done with the same Mapgen-Mod as in 1.) but can also be done with an extra mod. This would be interesting for certain topics, such as the server that was set up by religious educators for Advent/Christmas time https://www.facebook.com/minetestAdvent ... &fref=five
... I know that this can be done by hand by deleting the definitions of the other Biom types, but it's important to me that you don't need to change anything in a file.
3) Also for the water level and thus the size of the water surface it would be interesting, if you can easily select this. This is about the topic of the ocean and if you want to build in water, you need more sea.
... here too I found out that you can adjust the height of the water level. But the point is that it should be even easier and you don't have to fight with the landscape decoration that is still visible in the water.
4) It would also be interesting, if you can make specifications at the average temperature and humidity, for example that you have more deserts or more jungle or more snow bioms.
... I don't know how to do that yet.
Me and all the other teachers that are interessting in Minetest would be really happy about nice and simple Mapgen mods,
Birgit
But may be my wishes are very simple for you:
For use in the classroom or for similar purposes, it would be useful to be able to define the world a little more precisely. Some things that might be interesting:
1) a flat world with uniform ground, e. g. a layer of earth with grass, underneath stones to the bottom, without caves, without decoration and trees.
.... I have asked about it before and got some ideas for solutions, but none of them were perfect, i. e. as I described it. It would be nice if you could create a map-generator, where you could for example choose the layout of the map, so you could define the layers.
2) You should be able to choose certain biomes. This doesn't have to be done with the same Mapgen-Mod as in 1.) but can also be done with an extra mod. This would be interesting for certain topics, such as the server that was set up by religious educators for Advent/Christmas time https://www.facebook.com/minetestAdvent ... &fref=five
... I know that this can be done by hand by deleting the definitions of the other Biom types, but it's important to me that you don't need to change anything in a file.
3) Also for the water level and thus the size of the water surface it would be interesting, if you can easily select this. This is about the topic of the ocean and if you want to build in water, you need more sea.
... here too I found out that you can adjust the height of the water level. But the point is that it should be even easier and you don't have to fight with the landscape decoration that is still visible in the water.
4) It would also be interesting, if you can make specifications at the average temperature and humidity, for example that you have more deserts or more jungle or more snow bioms.
... I don't know how to do that yet.
Me and all the other teachers that are interessting in Minetest would be really happy about nice and simple Mapgen mods,
Birgit
- Wuzzy
- Member
- Posts: 4804
- Joined: Mon Sep 24, 2012 15:01
- GitHub: Wuzzy2
- IRC: Wuzzy
- In-game: Wuzzy
- Contact:
Re: Post your mapgen questions here (modding or engine)
Sigh.Wuzzy if you don't rotate the schematic and the chest does not have a chance of placement, then you know where it is from it's position in the schematic, add relative position of chest from schematic minimum point, to placement position.
This is exactly what I do not want to do. This forces me to hardcode the chest positions in Lua, which a horrible idea. What if the schematic is changed?
The idea is that this must work for schematics with arbitrary chest positions.
Or do you want me to do find_nodes_in_area every time after a schematic is placed? This is stupid since Minetest first knows the chest positions, then throws it away, then it scans the chest positions again.
Who is online
Users browsing this forum: No registered users and 9 guests