Post your mapgen questions here (modding or engine)

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

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

by TumeniNodes » Wed Mar 08, 2017 19:27

I just remembered this...

When I was looking for, close to what you may be trying to achieve?
It sounds like you are looking for more of a "rocky" sort of coastline? (meaning bumpy-best I can explain what I mean :D )
something like this?
http://www.americansouthwest.net/california/photographs700/cabrillo-coastline.jpg

Hope it helps...
https://forum.minetest.net/viewtopic.php?p=228627#p228627
Flick?... Flick who?
 

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

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

by burli » Wed Mar 08, 2017 19:50

I don't mean "rocky". I mean "less smoothed" and curvy. They look always like this

Image
Attachments
screenshot_20170308_204821.jpg
screenshot_20170308_204821.jpg (256.16 KiB) Viewed 13116 times
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

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

by TumeniNodes » Wed Mar 08, 2017 19:58

Then I believe this is where you want to make adjustments...

(and change the eased setting, you don;t want that)

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
mgv7_np_terrain_alt = {
   flags = eased
   lacunarity = 1
   octaves = 4
   offset = -20
   persistence = 0.3
   scale = 6
   seed = 5934
   spread = (600,600,600)
Flick?... Flick who?
 

User avatar
Wuzzy
Member
 
Posts: 2161
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 Mar 09, 2017 00:42

What does the “mudflow” flag of v6 do?

Second question: How can I disable mapgen flags at subgame level safely?
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

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

by paramat » Thu Mar 09, 2017 11:25

burli wrote:What is needed that dungeons are generated with cobble stone? I made a minimal subgame and I don't get any errors, but dungeons are generated with stone.

The same issue exists in the minimal development game. Cobble node is registered, but not used for dungeons

Some dungeons use desert stone or sandstonebrick for the walls, the mapgen aliases used are these https://github.com/minetest/minetest_game/blob/master/mods/default/mapgen.lua#L32 pus desert stone of course. There are also fallbacks if a mapgen alias is not found https://github.com/minetest/minetest/blob/master/src/mapgen.cpp#L598 note that desert stone falls back to stone.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

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

by paramat » Thu Mar 09, 2017 11:29

burli wrote:How can I make ridges in mgv7 less deep? And the underground and the shores a bit more rough. Ridges look so polished

Mgv7 rivers are fixed depth.
The riverbed will always be a smooth curve, but you can make the river course more twisty by increasing octaves and/or persistence of mgv7_np_ridge_uwater
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

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

by paramat » Thu Mar 09, 2017 11:32

Wuzzy,

"mudflow" moves dirt that sits on the edge of vertical drops and moves it to the base of the drop, like soil erosion, it's done twice in a loop.
Use 'minetest.set_mapgen_setting()' https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L2296 in a mod to set any of the mapgen flag settings.
 

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

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

by burli » Fri Mar 10, 2017 08:42

Is it possible to use biomes to generate different stone underground? I tried it, but it didn't work. Maybe I did something wrong?
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

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

by TumeniNodes » Sat Mar 11, 2017 02:10

I made a slight modification, so that trees use the "default_tree" texture completely (it just looks better to me)

But, I still want logs (fallen logs in the map) to use the "default_tree_top" texture.

I was just taking a look and, while I knew how to reduce the amount of logs in the map, I am not sure how to keep the fallen logs using the original textures?

Is there anywhere in this code I need to change to do this?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- Aspen tree and log

   minetest.register_decoration({
      deco_type = "schematic",
      place_on = {"default:dirt_with_grass"},
      sidelen = 16,
      noise_params = {
         offset = 0.0,
         scale = -0.009,
         spread = {x = 150, y = 150, z = 150},
         seed = 2,
         octaves = 3,
         persist = 0.66
      },
      biomes = {"coniferous_forest"},
      y_min = 1,
      y_max = 31000,
      schematic = minetest.get_modpath("default").."/schematics/aspen_tree.mts",
      flags = "place_center_x, place_center_z",
   })

   minetest.register_decoration({
      deco_type = "schematic",
      place_on = {"default:dirt_with_grass"},
      sidelen = 16,
      noise_params = {
         offset = 0.0,
         scale = -0.001,
         spread = {x = 150, y = 150, z = 150},
         seed = 1,
         octaves = 3,
         persist = 0.66
      },
      biomes = {"coniferous_forest"},
      y_min = 1,
      y_max = 31000,
      schematic = {
         size = {x = 3, y = 3, z = 1},
         data = {
            {name = "air", prob = 0},
            {name = "air", prob = 0},
            {name = "air", prob = 0},
            {name = "default:aspen_tree", param2 = 12},
            {name = "default:aspen_tree", param2 = 12},
            {name = "default:aspen_tree", param2 = 12, prob = 127},
            {name = "flowers:mushroom_red", prob = 63},
            {name = "flowers:mushroom_brown", prob = 63},
            {name = "air", prob = 0},
         },
      },
      flags = "place_center_x",
      rotation = "random",
   })


I'm thinking it's someplace in here
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
data = {
            {name = "air", prob = 0},
            {name = "air", prob = 0},
            {name = "air", prob = 0},
         ---   {name = "default:aspen_tree", param2 = 12},
one of these?---   {name = "default:aspen_tree", param2 = 12},
         ---   {name = "default:aspen_tree", param2 = 12, prob = 127},
            {name = "flowers:mushroom_red", prob = 63},
            {name = "flowers:mushroom_brown", prob = 63},
            {name = "air", prob = 0},


hope the pic explains better
Image
Attachments
trees n logs.png
trees n logs.png (831.13 KiB) Viewed 13116 times
Flick?... Flick who?
 

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

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

by burli » Sat Mar 11, 2017 08:16

If you want a different texture you need to make a new node and use this in the schematic
 

User avatar
Wuzzy
Member
 
Posts: 2161
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 » Sat Mar 11, 2017 14:26

OK, thanks paramat. Antother question which goes directly to you:

I know you have made a lot of work on the Minetest Game biomes for 0.4.15. How did you manage that these biome are relatively well-balanced out in terms of size? Do you maybe have a tool or a trick or something?

I understand that the heat and humity points are very important and are used in a Voronoi diagram. But I feel it is very tedious (and especially unreliable) to just blindly adjust these points and restart Minetest 1,000,000 times, hope for the best and waste a lot of time to fly over the world just to see if it worked. Whenever I try to set the biome sizes for my own biomes, the biomes are either too large or too small or don't appear at all. :-/
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

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

by TumeniNodes » Sat Mar 11, 2017 18:33

burli wrote:If you want a different texture you need to make a new node and use this in the schematic


Really? (exasperated sigh) I didn't realize fallen logs were part of the schematic, though I guess it makes sense to me now.

I did create a new node for each (I simply made, i.e., default tree use only the tree texture, and then added a new node real quick called "whichever"_tree_top, and kept that one with the original texture layout.)

Thank you burli. Guess it can wait until I finally do get around to messing with schematics or the method you have been using : )
This is just for my subgame anyway

btw, I apologize for completely misreading your "ridges" issue... I had thought you wanted steeper sides, by lowering the seabed :P Hope you got you issue resolved
Flick?... Flick who?
 

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

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

by burli » Sat Mar 11, 2017 18:54

Sadly the depth of the ridges is hard coded. Can't change it with a noise
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

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

by FaceDeer » Sun Mar 12, 2017 06:29

I've begun tinkering with my own version of a caverealms mod, with the goal of building a generalized mapgen library for creating large underground caverns and populating them with various biome-specific flora and features. I'd like to first echo Wuzzy's question above about the best way to go about balancing the area covered by various biomes. It's especially tricky to do it underground.

Edit: I just found this post by Paramat about how to use GeoGebra to work with Voronoi diagrams and it looks fantastic, this may solve that part of things. The second point below remains, though.

Second, I've discovered that the default mod adds an "underground" biome that seems to be seriously cramping my style. It stretches over the entire underground y-value range. Is there a way to override an already-registered biome so I can get it out of the way of my own underground biomes without disturbing the other biomes registered by default?
 

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

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

by burli » Sun Mar 12, 2017 06:55

You can clear all registered biomes with minetest.clear_registered_biomes() and define your own
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

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

by FaceDeer » Sun Mar 12, 2017 07:32

burli wrote:You can clear all registered biomes with minetest.clear_registered_biomes() and define your own


I'd like to leave the rest of the biomes intact, though. I want my mod to be able to act as an add-on to default (and not be bound to it if someone wants to use the mod with something other than default) rather than be a wholesale replacement of it. There are ways to override various other registered things (nodes, crafting recipes, etc) so I was hoping there'd be something similar for biomes.

I suppose I could copy-and-paste the default mod's biome registration into my mod and do the wipe-and-replace thing when the default mod is loaded, but that's pretty hacky and I'll need to update the copy-and-pasted biomes any time default gets an update.

Might simply re-registering a new biome with the same name as the old one override it? Biomes don't appear to have name restrictions on them.
 

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

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

by burli » Sun Mar 12, 2017 07:39

I think it should be possible to make a copy of minetest.registered_biomes, modify it an register again. The table looks like this. Or probably just overwrite what you want to change

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
{
   coniferous_forest_ocean = {
      node_riverbed = "default:sand",
      node_top = "default:sand",
      node_filler = "default:sand",
      depth_top = 1,
      humidity_point = 70,
      y_max = 4,
      y_min = -112,
      heat_point = 45,
      depth_riverbed = 2,
      name = "coniferous_forest_ocean",
      depth_filler = 3
   },
   tundra = {
      node_riverbed = "default:gravel",
      node_dust = "default:snowblock",
      humidity_point = 40,
      y_min = 2,
      heat_point = 0,
      depth_riverbed = 2,
      name = "tundra",
      y_max = 31000
   },
   underground = {
      humidity_point = 50,
      y_max = -113,
      heat_point = 50,
      name = "underground",
      y_min = -31000
   },
   grassland = {
      node_riverbed = "default:sand",
      node_top = "default:dirt_with_grass",
      node_filler = "default:dirt",
      depth_top = 1,
      humidity_point = 35,
      y_max = 31000,
      y_min = 6,
      heat_point = 50,
      depth_riverbed = 2,
      name = "grassland",
      depth_filler = 1
   },
}
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

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

by FaceDeer » Sun Mar 12, 2017 09:02

Well, this is baffling. I tried as you suggest, using this code to do a thorough deep copy:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.debug(dump(minetest.registered_biomes))
local replace_underground = function()
   local registered_biomes_copy = {}
   for old_biome_key, old_biome_def in pairs(minetest.registered_biomes) do
      minetest.debug("copying biome", old_biome_key)
      local copied_biome_def = {}
      for biomekey, biomevalue in pairs(old_biome_def) do
         copied_biome_def[biomekey] = biomevalue
      end
      registered_biomes_copy[old_biome_key] = copied_biome_def
   end
   if registered_biomes_copy.underground ~= nil then
      minetest.debug("replacing underground")
      registered_biomes_copy.underground = {
         name = "underground",
         y_min = -700,
         y_max = -113,
         heat_point = 50,
         humidity_point = 50,
      }
   end
   minetest.clear_registered_biomes()
   for _, new_biome_def in pairs(registered_biomes_copy) do
      minetest.debug("re-registering biome", new_biome_def.name)
      minetest.register_biome(new_biome_def)
   end
end
replace_underground()
minetest.debug(dump(minetest.registered_biomes))


And the before-and-after dumps of minetest.registered_biomes matched exactly, aside from the desired change to the underground biome. But when I regenerated the land I was on up on the surface the aspen forest I was in was suddenly mixed with new jungle trees that shouldn't have been there.

I have no idea how jungle trees are getting added. The biome's boundary is the same, and the neighboring savannah isn't affected. I'll do some more poking tomorrow and see if I can figure this out.
 

User avatar
Wuzzy
Member
 
Posts: 2161
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 » Sun Mar 12, 2017 13:51

Thanks, FaceDeer, for digging out the paramat post. This was important, now I think I can finally reasonably work with proper biomes. :-)

Jungle trees are simply added as a decoration in the biomes “rainforest” and “rainforest_swamp” in the mapgens v5, v7, valleys, flat and fractal. Look for “default.register_decorations()”. Note that in v6, biomes are hardcoded in Minetest, not added by Lua. Jungle trees in v6 are triggered by the v6 mapgen flags.

See also: http://wiki.minetest.net/Map_generator_features
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

FaceDeer
Member
 
Posts: 152
Joined: Sat Aug 29, 2015 19:01

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

by FaceDeer » Sun Mar 12, 2017 17:28

Okay, I got my biome-override code working properly. The key turned out to be wiping and re-registering all the decorations as well as the biomes. I haven't looked at the Minetest source code behind all this but I have a guess as to what's going on. Internally biome names aren't used by the mapgen, there appears to be some sort of biome ID number that gets assigned to biomes when they're registered (this is what's returned in the biome mapgen object). I suspect that when a decoration is registered the biomes it belongs to is stored as that biome ID number rather than the biome's name. Then when I wipe the biomes and re-register them some of them wind up being assigned different biome ID numbers, and the decorations don't get updated. So some decorations wind up assigned to a different biome than they had when they were first registered and that's why jungle trees were appearing in the wrong biome for me.

For the benefit of future modders who may stumble across this, here's the code I've come up with to replace the underground biome with a modified version:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local replace_underground = function()
   local registered_biomes_copy = {}
   for old_biome_key, old_biome_def in pairs(minetest.registered_biomes) do
      registered_biomes_copy[old_biome_key] = old_biome_def
   end
   local registered_decorations_copy = {}
   for old_decoration_key, old_decoration_def in pairs(minetest.registered_decorations) do
      registered_decorations_copy[old_decoration_key] = old_decoration_def
   end
   if registered_biomes_copy.underground ~= nil then
      registered_biomes_copy.underground = {
         name = "underground",
         y_min = -700,
         y_max = -113,
         heat_point = 50,
         humidity_point = 50,
      }
   end
   minetest.clear_registered_decorations()
   minetest.clear_registered_biomes()
   for biome_key, new_biome_def in pairs(registered_biomes_copy) do
      minetest.register_biome(new_biome_def)
   end
   for decoration_key, new_decoration_def in pairs(registered_decorations_copy) do
      minetest.register_decoration(new_decoration_def)
   end
end
replace_underground()


(Turns out the deep-copying I was doing in the earlier version was unnecessary, I just wanted to cover my bases).
Last edited by FaceDeer on Sun Mar 12, 2017 17:54, edited 1 time in total.
 

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

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

by burli » Sun Mar 12, 2017 17:42

Good to know that. Have to keep it in mind
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

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

by paramat » Tue Mar 14, 2017 01:44

burli wrote:Is it possible to use biomes to generate different stone underground? I tried it, but it didn't work. Maybe I did something wrong?

Yes it's possible, just define 'node stone'. But the y limits of the biome need to be > 80 nodes apart or either side of a mapchunk border because the biome for the entire node column is only calculated once at column top, then stays in effect for the whole node column.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

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

by paramat » Tue Mar 14, 2017 01:55

FaceDeer wrote:Second, I've discovered that the default mod adds an "underground" biome that seems to be seriously cramping my style. It stretches over the entire underground y-value range. Is there a way to override an already-registered biome so I can get it out of the way of my own underground biomes without disturbing the other biomes registered by default?

No, all you can do is use a mod to clear all biomes then re-register the complete set but with your changes. It has been described as hacky but this is actually the official way to alter biomes, most mods and subgames would want to completely change all biomes anyway.
To avoid the engine side of mapgen becoming overcomplex the approach is to require mods to do slightly more complex stuff in Lua.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

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

by paramat » Tue Mar 14, 2017 02:02

To balance biome areas you want to very roughly equalise the areas of the voronoi cells, however the more extreme values are less common so cell area needs to rise towards the edges and corners of the diagram.

This is our current system (the 'underground' biome is at (50, 50)):

Image

Horizontal - Temperature
Vertical - Humidity

ICE Icesheet
TAI Taiga
COF Coniferous forest
DEF Deciduous forest
RAF Rainforest

TUN Tundra
SGR Snowy grassland
GRA Grassland
SAV Savanna

CDE Cold desert
SDE Sandstone desert
DES Desert
 

User avatar
Wuzzy
Member
 
Posts: 2161
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 » Fri Mar 17, 2017 17:00

I want to place a simple 1-node decoration on the floor, namely a carved pumpkin. This is a node which can be rotated (it uses facedir). How can I use the decorations API to randomly rotate a simple decoration?


PS: I just added the biome question to the modding FAQ:
http://dev.minetest.net/Modding_FAQ#Advanced_modding
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

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

by paramat » Sat Mar 18, 2017 15:16

Looks like simple decorations cannot be randomly rotated. You can create a 1-node schematic decoration and use the random rotation flag. Define the schematic as a lua table (you won't need the 'place centre' flags:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
   minetest.register_decoration({
      deco_type = "schematic",
      place_on = {"default:dirt_with_grass"},
      sidelen = 16,
      noise_params = {
         offset = 0.0,
         scale = -0.0008,
         spread = {x = 250, y = 250, z = 250},
         seed = 2,
         octaves = 3,
         persist = 0.66
      },
      biomes = {"deciduous_forest"},
      y_min = 1,
      y_max = 31000,
      schematic = {
         size = {x = 3, y = 3, z = 1},
         data = {
            {name = "air", prob = 0},
            {name = "air", prob = 0},
            {name = "air", prob = 0},
            {name = "default:aspen_tree", param2 = 12},
            {name = "default:aspen_tree", param2 = 12},
            {name = "default:aspen_tree", param2 = 12, prob = 127},
            {name = "flowers:mushroom_red", prob = 63},
            {name = "flowers:mushroom_brown", prob = 63},
            {name = "air", prob = 0},
         },
      },
      flags = "place_center_x",
      rotation = "random",
})
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

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

by paramat » Sat Mar 18, 2017 15:20

Typos in your Wiki addition:
'align the Vonoroi cells, making balanncing a lot easier.'
Should be 'Voronoi' and 1 'n' in 'balancing'.
 

User avatar
Wuzzy
Member
 
Posts: 2161
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 » Mon Mar 20, 2017 23:06

OK, thanks. I will look into this. Also, wiki is fixed.

Paramat, you really should get a wiki account. I think Calinou is the one to ask. It is absolutely unacceptable that core developers are not allowed to edit the wiki (not your fault, of course).

What is on_mapgen_init and why isn't it documented in lua_api.txt?

Why does this code not remove dungeons?:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_mapgen_init(function()
         minetest.set_mapgen_setting("mg_flags", "nodungeons")
end)


Or this code? (Called on “top Lua level”, not inside of any function, in a brand new world)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.set_mapgen_setting("mg_flags", "nodungeons")


I have checked map_meta.txt. Mg_flags is untouched. There is only one place in the subgame + all active mods where minetest.set_mapgen_setting is called. No over mod tampers with the mapgen settings. Weird. Tested in 0.4.15. Bug or user failure? ;-)


Why does your previous decoration example have so many air? It looks like there is an entire row which is completely unused (probability of 0). Why has the schematic a height of 3 when it only needs 2?

Why doesn't this schematic decoration spawn any grass?:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
   minetest.register_decoration({
      deco_type = "schematic",
      schematic = {
         size = { x=1, y=1, z=1 },
         data = {
            { name = "default:grass_5", param1=255, },
         },
      },
      place_on = {"default:dirt_with_grass"},
      sidelen = 8,
      noise_params = {
         offset = -0.01,
         scale = 0.03,
         spread = {x = 500, y = 500, z = 500},
         seed = 420,
         octaves = 2,
         persist = 0.6,
      },
      y_min = 1,
      y_max = 40,
      flags = "",
   })


But this one does?:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
   minetest.register_decoration({
      deco_type = "schematic",
      schematic = {
         size = { x=1, y=2, z=1 },
         data = {
            { name = "air", prob = 0 },
            { name = "default:grass_5", param1=255, },
         },
      },
      place_on = {"default:dirt_with_grass"},
      sidelen = 8,
      noise_params = {
         offset = -0.01,
         scale = 0.03,
         spread = {x = 500, y = 500, z = 500},
         seed = 420,
         octaves = 2,
         persist = 0.6,
      },
      y_min = 1,
      y_max = 40,
      flags = "",
   })




EDIT: Final decoration question (in this post): Why is this even possible?:
Image
https://i.imgur.com/LAqTiKz.png

The purple flowered plant is a peony. It is supposed to be made out of 2 nodes at all times, a top part and a bottom part (like a door). It must never be seperated.
The peony to the right is the expected plant.
But the mapgen generated this “half peony” in the middle, on jungle wood. Which is wrong. It also happened to me that the top part of the peony spawned on fern (=jungle grass in Minetest Game) or tall grass (=grass in Minetest Game). Note that most peonies generated by the mapgen are correct, the seperation happens rarely.

Why did this happen and how can I prevent this?

Decorations code:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
   -- Large flowers
   local register_large_flower = function(name, seed, offset)
      minetest.register_decoration({
         deco_type = "schematic",
         schematic = {
            size = { x=1, y=3, z=1 },
            data = {
               { name = "air", prob = 0 },
               { name = "mcl_flowers:"..name, param1=255, },
               { name = "mcl_flowers:"..name.."_top", param1=255, },
            },
         },
         place_on = {"mcl_core:dirt_with_grass"},

         sidelen = 16,
         noise_params = {
            offset = offset,
            scale = 0.01,
            spread = {x = 300, y = 300, z = 300},
            seed = seed,
            octaves = 5,
            persist = 0.62,
         },
         y_min = 1,
         y_max = 30,
         flags = "",
      })
   end

   register_large_flower("rose_bush", 9350, -0.008)
   register_large_flower("peony", 10450, -0.008)
   register_large_flower("lilac", 10600, -0.007)
   register_large_flower("sunflower", 2940, -0.005)


Mapgen used: v6. You see a v6 jungle here.


EDIT 2: Hooray! The schematic rotation trick suggested by you previously worked! Thanks a bunch! :-)
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

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

by paramat » Tue Mar 21, 2017 00:41

> What is on_mapgen_init and why isn't it documented in lua_api.txt?

It's deprecated now and not needed around minetest.set_mapgen_setting().

> Why does this code not remove dungeons?:

Try:
minetest.set_mapgen_setting(name, value, [override_meta])
With true as the 3rd argument. Even in a new world map meta may need overriding.
When setting mg_flags include all arguments:
"caves,nodungeons,light,decorations"
otherwise the other flags may be set to off.

> Why does your previous decoration example have so many air? It looks like there is an entire row which is completely unused (probability of 0). Why has the schematic a height of 3 when it only needs 2?

Log decorations have the lowest level being unplaced nodes (air prob = 0) because schematics are always placed with their lowest level of nodes in the ground instead of on the ground, so a layer of non-placed nodes is needed so that the log is above ground. Air prob = 0 is the official way to specify a node that will not replace existing nodes.

> Why doesn't this schematic decoration spawn any grass?:

For the same reason, the grass is placed in the ground, also you are using
{ name = "default:grass_5", param1=255, },
that should be prob = 255, param1 will not be recognised in a lua table schem so the grass was probably not replacing the ground node it was in.

> But the mapgen generated this “half peony” in the middle, on jungle wood. Which is wrong.

Your jungletree was placed first but doesn't have root nodes in the ground, so the ground node under the peony is still dirt or grass, when the peony is placed later it simply looks at the node at ground level and therefore places a peony at that point. Because the peony is not force-placed only the top peony node appears where air is.
If your jungletree has root nodes in the ground this will stop other decorations being placed at the same position.
This is why mapgen trees in MTG have root nodes.

Ah mgv6, i guess mgv6 jungletrees do not replace the dirt or grass at ground level, that's why.

> It also happened to me that the top part of the peony spawned on fern (=jungle grass in Minetest Game) or tall grass (=grass in Minetest Game)

Order of decoration registrations determines order of placement. See default/mapgen.lua, the taller decorations are placed first to avoid them being placed 'around' smaller decorations. Register your peony before 1-node decorations like grasses.
 

User avatar
Wuzzy
Member
 
Posts: 2161
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 Mar 21, 2017 02:16

> Why does this code not remove dungeons?:

Try:
minetest.set_mapgen_setting(name, value, [override_meta])
With true as the 3rd argument. Even in a new world map meta may need overriding.
When setting mg_flags include all arguments:
"caves,nodungeons,light,decorations"
otherwise the other flags may be set to off.

OK, it works.
Is it possible to change the default mapgen flags for a subgame, so the user can still overwrite them?
I noticed when I do this, the user-supplied mg_flags has no longer an effect, so using minetest.set_mapgen_setting appears to bascially hardcode the mg_flags with no way for the user to change it. :-/

> But the mapgen generated this “half peony” in the middle, on jungle wood. Which is wrong.

Your jungletree was placed first but doesn't have root nodes in the ground, so the ground node under the peony is still dirt or grass, when the peony is placed later it simply looks at the node at ground level and therefore places a peony at that point. Because the peony is not force-placed only the top peony node appears where air is.
If your jungletree has root nodes in the ground this will stop other decorations being placed at the same position.
This is why mapgen trees in MTG have root nodes.

Ah mgv6, i guess mgv6 jungletrees do not replace the dirt or grass at ground level, that's why.

> It also happened to me that the top part of the peony spawned on fern (=jungle grass in Minetest Game) or tall grass (=grass in Minetest Game)

Order of decoration registrations determines order of placement. See default/mapgen.lua, the taller decorations are placed first to avoid them being placed 'around' smaller decorations. Register your peony before 1-node decorations like grasses.

Is it possible to prevent this?
I rather want the peony to not be generated at all instead of being generated only partially, because this is something which must never happen in my mapgen. I think of this: If Minetest fails to place any node (except those with probability 0), the entire decoration is not placed. Think of it as an “all-or-nothing decoration”. :D
Is this possible?

Your advice to generate large decorations first seems to work.
But I still have large plants over ferns (=jungle grass), maybe because it also comes from v6. This almost sounds like a bug to me and I guess I file an issue.
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 9 guests

cron