Post your mapgen questions here (modding or engine)

User avatar
paramat
Developer
 
Posts: 3088
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Thu Oct 12, 2017 03:01

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.
 

User avatar
duane
Member
 
Posts: 1253
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

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

by duane » Thu Oct 12, 2017 04:34

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.


Check this post by Paramat:

viewtopic.php?f=47&t=15272&p=293766&hilit=map+index#p293766
Believe in people and you don't need to believe anything else.
 

User avatar
paramat
Developer
 
Posts: 3088
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Fri Oct 13, 2017 22:23

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.
 

roboto
Member
 
Posts: 59
Joined: Wed Jul 19, 2017 15:21
GitHub: NewbProgrammer101
In-game: akoek

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

by roboto » Sat Oct 14, 2017 21:19

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.


I get it now.
 

v-rob
Member
 
Posts: 454
Joined: Thu Mar 24, 2016 03:19

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

by v-rob » Fri Oct 20, 2017 01:06

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?
Last edited by v-rob on Fri Nov 03, 2017 04:00, edited 1 time in total.
 

User avatar
paramat
Developer
 
Posts: 3088
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Tue Oct 31, 2017 23:39

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.
 

User avatar
burli
Member
 
Posts: 1605
Joined: Fri Apr 10, 2015 13:18

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

by burli » Thu Nov 09, 2017 19:45

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
 

User avatar
burli
Member
 
Posts: 1605
Joined: Fri Apr 10, 2015 13:18

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

by burli » Fri Nov 10, 2017 17:42

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
 

User avatar
burli
Member
 
Posts: 1605
Joined: Fri Apr 10, 2015 13:18

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

by burli » Mon Nov 13, 2017 11:43

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
 

User avatar
duane
Member
 
Posts: 1253
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

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

by duane » Mon Nov 13, 2017 15:22

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


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.
Believe in people and you don't need to believe anything else.
 

User avatar
burli
Member
 
Posts: 1605
Joined: Fri Apr 10, 2015 13:18

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

by burli » Mon Nov 13, 2017 16:05

That means, doing voronoi calculation in Lua. Has anyone ever done this before?
 

User avatar
burli
Member
 
Posts: 1605
Joined: Fri Apr 10, 2015 13:18

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

by burli » Mon Nov 13, 2017 18:26

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
 

User avatar
paramat
Developer
 
Posts: 3088
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Mon Nov 13, 2017 20:03

> 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.
 

User avatar
duane
Member
 
Posts: 1253
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

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

by duane » Tue Nov 14, 2017 02:35

burli wrote:That means, doing voronoi calculation in Lua. Has anyone ever done this before?


While that's technically true, you're overcomplicating it. This is the relevant code:

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);
}


There's nothing difficult about it -- just loop through each biome and see which is the closest match. I did something similar here.

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.
 

User avatar
burli
Member
 
Posts: 1605
Joined: Fri Apr 10, 2015 13:18

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

by burli » Tue Nov 14, 2017 06:40

Please post your stratum ore definition and describe what you are trying to acheive.


Create an undulating layer of stone to create something like this
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"}
})


@duane: thanks. Will try this
 

User avatar
paramat
Developer
 
Posts: 3088
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Sat Nov 18, 2017 01:26

Here's an example:
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
      },
   })


'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.
 

User avatar
burli
Member
 
Posts: 1605
Joined: Fri Apr 10, 2015 13:18
 

User avatar
paramat
Developer
 
Posts: 3088
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Sat Nov 18, 2017 19:39

Maybe i should add the ability to have a fixed stratum thickness instead of requiring a noise for that, yes i think so.
 

User avatar
Wuzzy
Member
 
Posts: 3013
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

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

by Wuzzy » Thu Nov 23, 2017 17:24

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.
My projects: MineClone 2. Hades Revisited. Help modpack. A ton of other mods, see here.
 

User avatar
burli
Member
 
Posts: 1605
Joined: Fri Apr 10, 2015 13:18
 

User avatar
paramat
Developer
 
Posts: 3088
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Fri Nov 24, 2017 00:22

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.
 

ShadMOrdre
Member
 
Posts: 110
Joined: Mon Dec 29, 2014 08:07
Location: USA
In-game: shadmordre

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

by ShadMOrdre » Sun Nov 26, 2017 03:27

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
My other virtual world is an Opensimulator.
 

User avatar
paramat
Developer
 
Posts: 3088
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

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

by paramat » Fri Dec 01, 2017 03:33

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.
 

User avatar
BirgitLachner
Member
 
Posts: 354
Joined: Thu May 05, 2016 10:18
In-game: Bibs

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

by BirgitLachner » Fri Dec 01, 2017 14:25

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
 

User avatar
Wuzzy
Member
 
Posts: 3013
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

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

by Wuzzy » Tue Dec 05, 2017 10:47

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.

Sigh.
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.
My projects: MineClone 2. Hades Revisited. Help modpack. A ton of other mods, see here.
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 2 guests