Page 1 of 1

modding forest

PostPosted: Mon May 02, 2016 09:28
by Robsoie
Hello

I would like to have less dense forest/jungle biome, basically my goal would be to increase the minimum spacing between trees, both for navigation and performance reasons.

I gave a look into the ...\games\minetest_game\mods\default\ mapgen.lua to test things around, but unfortunately, not having any coding ability, it's rather hard for me to try to figure out what does what.
And unfortunately the wiki
http://dev.minetest.net/Mapgen_Parameters
Is not detailling much of what is going on in the mapgen file, all i seem to have understood is that there's some kind of tree noise distribution generated and that is what is used to place the trees, and for jungles it has to do with a humidity noise distribution.

So i guess to do what i would like to do, i would have to find on how to modify those humidity noise and tree noise.

Looking further in the mapgen.lua i see by example
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
function default.register_decorations()
   minetest.clear_registered_decorations()

   -- Apple tree and log

   minetest.register_decoration({
      deco_type = "schematic",
      place_on = {"default:dirt_with_grass"},
      sidelen = 16,
      noise_params = {
         offset = 0.036,
         scale = 0.022,
         spread = {x = 250, y = 250, z = 250},
         seed = 2,
         octaves = 3,
         persist = 0.66
      },
      biomes = {"deciduous_forest"},
      y_min = 1,
      y_max = 31000,
      schematic = minetest.get_modpath("default").."/schematics/apple_tree.mts",
      flags = "place_center_x, place_center_z",
   })


Could
noise_params = {
offset = 0.036,
scale = 0.022,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
Be what i need to edit ?
Or am i on the completely wrong track and things are elsewhere ?

Re: modding forest

PostPosted: Mon May 02, 2016 10:43
by qwertymine3
Are you using mapgen v5/v7 or mapgen v6?

If you are using v5/v7 this is the correct place to edit. You will also have to edit the registration jungle trees to make jungles less dense.

Although it isn't documented anywhere, based off some quick testing I think I can (quickly) explain how this works.

The perlin noise is used to generate a map of probabilities of the decoration being placed on any given node. The range of probabilities should be offset +- scale.

So to reduce the density, reduce either the offset, scale or both.
The larger scale is in comparison to offset, the more variation in density you will get.

You may also want to edit spread, which is how quickly the forest density changes.

Re: modding forest

PostPosted: Mon May 02, 2016 11:47
by burli
Interesting. Maybe I can use this for something else

Re: modding forest

PostPosted: Mon May 02, 2016 17:18
by Robsoie
Thank you, this is very helpful.

Re: modding forest

PostPosted: Mon May 02, 2016 17:40
by paramat
Yes offset is average density, scale is variation of density.
For jungletrees the noise is replaced by a fixed density parameter called 'fill_ratio'.
You can use a mod with 'minetest.clear_registered_decorations' as it's first line, then copy-paste all decoration definitions but with your changes. The mod should depends on default.