Post your mapgen questions here (modding or engine)

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

Postby StarNinjas » Mon Mar 11, 2019 7:59 pm

thanks Shad!
StarNinjas
Member
 
Posts: 268
Joined: Wed Mar 14, 2018 12:32 am
GitHub: starninjas
In-game: J1

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

Postby paramat » Sun Mar 17, 2019 3:32 am

Sokomine's depression-filling method is faster than mine in highlandpools mod. Any method used in core mapgen has to be very fast, mine would be too slow to use.
paramat
Developer
 
Posts: 3361
Joined: Sun Oct 28, 2012 12:05 am
GitHub: paramat

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

Postby ShadMOrdre » Tue Mar 19, 2019 6:00 pm

Paramat,

I am trying to use the following code section:

Code: Select all
minetest.register_on_mapgen_init(function(mgparams)

   --######################################################################################################################################################################
   --##  world_type options:                                                                                                                                             ##
   --##  Default = 0, Valleys = 1, Continental = 2, Continental_v2 = 3, Islands = 4, Islands_x2 = 5, Islands_x25 = 6, Islands_x3 = 7, Archipelago = 8, Floatworld = 9    ##
   --######################################################################################################################################################################

   if lib_mg_params.world_type == 0 then
      minetest.set_mapgen_setting("mgname", "mgv7", true)
      minetest.set_mapgen_setting("mgv7_spflags", "mountains,ridges,nofloatlands,caverns", true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_alt", {lacunarity = 2, offset = 4, scale = 25, spread = {600,600,600}, seed = 5934, octaves = 5, persistence = 0.6, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_height_select", {lacunarity = 2, offset = -8, scale = 16, spread = {500,500,500}, seed = 4213, octaves = 6, persistence = 0.7, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_base", {lacunarity = 2, offset = 4, scale = 70, spread = {600,600,600}, seed = 82341, octaves = 5, persistence = 0.6, flags = "defaults"}, true)
   elseif lib_mg_params.world_type == 1 then
      minetest.set_mapgen_setting("mgname", "mgvalleys", true)
      minetest.set_mapgen_setting_noiseparams("mgvalleys_np_terrain_height", {lacunarity = 2, offset = -10, scale = 50, spread = {1024,1024,1024}, seed = 5202, octaves = 6, persistence = 0.4, flags = "eased"}, true)
      minetest.set_mapgen_setting_noiseparams("mgvalleys_np_valley_depth", {lacunarity = 2, offset = 5, scale = 4, spread = {512,512,512}, seed = -1914, octaves = 1, persistence = 1, flags = "eased"}, true)
      minetest.set_mapgen_setting_noiseparams("mgvalleys_np_valley_profile", {lacunarity = 2, offset = 0.6, scale = 0.5, spread = {512,512,512}, seed = 777, octaves = 1, persistence = 1, flags = "eased"}, true)
      minetest.set_mapgen_setting_noiseparams("mgvalleys_np_inter_valley_fill", {lacunarity = 2, offset = 0, scale = 1, spread = {256,512,256}, seed = 1993, octaves = 6, persistence = 0.8, flags = "eased"}, true)
      minetest.set_mapgen_setting_noiseparams("mgvalleys_np_inter_valley_slope", {lacunarity = 2, offset = 0.5, scale = 0.5, spread = {128,128,128}, seed = 746, octaves = 1, persistence = 1, flags = "eased"}, true)
   elseif lib_mg_params.world_type == 2 then
      minetest.set_mapgen_setting("mgname", "mgv7", true)
      minetest.set_mapgen_setting("mgv7_spflags", "nomountains,noridges,nofloatlands,nocaverns", true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_alt", {lacunarity = 2, offset = 4, scale = 100, spread = {2400,2400,2400}, seed = 5934, octaves = 6, persistence = 0.6, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_height_select", {lacunarity = 2, offset = -0.5, scale = 1, spread = {500,500,500}, seed = 4213, octaves = 4, persistence = 0.4, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_base", {lacunarity = 2, offset = 4, scale = 400, spread = {2400,2400,2400}, seed = 5934, octaves = 8, persistence = 0.3, flags = "defaults"}, true)
   elseif lib_mg_params.world_type == 3 then
      minetest.set_mapgen_setting("mgname", "mgv7", true)
      minetest.set_mapgen_setting("mgv7_spflags", "nomountains,noridges,nofloatlands,nocaverns", true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_alt", {lacunarity = 2, offset = 4, scale = 100, spread = {2400,2400,2400}, seed = 5934, octaves = 6, persistence = 0.6, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_height_select", {lacunarity = 2, offset = -0.5, scale = 1, spread = {500,500,500}, seed = 4213, octaves = 4, persistence = 0.4, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_base", {lacunarity = 2, offset = 4, scale = 400, spread = {2400,2400,2400}, seed = 82341, octaves = 8, persistence = 0.3, flags = "defaults"}, true)
   elseif lib_mg_params.world_type == 4 then
      minetest.set_mapgen_setting("mgname", "mgv7", true)
      minetest.set_mapgen_setting("mgv7_spflags", "nomountains,noridges,nofloatlands,nocaverns", true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_alt", {lacunarity = 2, offset = 4, scale = 100, spread = {600,600,600}, seed = 5934, octaves = 6, persistence = 0.6, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_height_select", {lacunarity = 2, offset = -0.5, scale = 1, spread = {500,500,500}, seed = 4213, octaves = 4, persistence = 0.4, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_base", {lacunarity = 2, offset = 4, scale = 400, spread = {600,600,600}, seed = 5934, octaves = 8, persistence = 0.3, flags = "defaults"}, true)
   elseif lib_mg_params.world_type == 5 then
      minetest.set_mapgen_setting("mgname", "mgv7", true)
      minetest.set_mapgen_setting("mgv7_spflags", "nomountains,noridges,nofloatlands,nocaverns", true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_alt", {lacunarity = 2, offset = 4, scale = 100, spread = {1200,1200,1200}, seed = 5934, octaves = 6, persistence = 0.6, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_height_select", {lacunarity = 2, offset = -0.5, scale = 1, spread = {500,500,500}, seed = 4213, octaves = 4, persistence = 0.4, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_base", {lacunarity = 2, offset = 4, scale = 400, spread = {1200,1200,1200}, seed = 5934, octaves = 8, persistence = 0.3, flags = "defaults"}, true)
   elseif lib_mg_params.world_type == 6 then
      minetest.set_mapgen_setting("mgname", "mgv7", true)
      minetest.set_mapgen_setting("mgv7_spflags", "nomountains,noridges,nofloatlands,nocaverns", true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_alt", {lacunarity = 2, offset = 4, scale = 100, spread = {1536,1536,1536}, seed = 5934, octaves = 6, persistence = 0.6, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_height_select", {lacunarity = 2, offset = -0.5, scale = 1, spread = {500,500,500}, seed = 4213, octaves = 4, persistence = 0.4, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_base", {lacunarity = 2, offset = 4, scale = 400, spread = {1536,1536,1536}, seed = 5934, octaves = 8, persistence = 0.3, flags = "defaults"}, true)
   elseif lib_mg_params.world_type == 7 then
      minetest.set_mapgen_setting("mgname", "mgv7", true)
      minetest.set_mapgen_setting("mgv7_spflags", "nomountains,noridges,nofloatlands,nocaverns", true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_alt", {lacunarity = 2, offset = 4, scale = 100, spread = {1800,1800,1800}, seed = 5934, octaves = 6, persistence = 0.6, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_height_select", {lacunarity = 2, offset = -0.5, scale = 1, spread = {500,500,500}, seed = 4213, octaves = 4, persistence = 0.4, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_base", {lacunarity = 2, offset = 4, scale = 400, spread = {1800,1800,1800}, seed = 5934, octaves = 8, persistence = 0.3, flags = "defaults"}, true)
   elseif lib_mg_params.world_type == 8 then
      minetest.set_mapgen_setting("mgname", "mgv7", true)
      minetest.set_mapgen_setting("mgv7_spflags", "mountains,ridges,floatlands,caverns", true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_alt", {lacunarity = 2, offset = 4, scale = 25, spread = {600,600,600}, seed = 5934, octaves = 5, persistence = 0.6, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_height_select", {lacunarity = 2, offset = -8, scale = 16, spread = {500,500,500}, seed = 4213, octaves = 6, persistence = 0.7, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_base", {lacunarity = 2, offset = 4, scale = 70, spread = {600,600,600}, seed = 82341, octaves = 5, persistence = 0.6, flags = "defaults"}, true)
   elseif lib_mg_params.world_type == 9 then
      minetest.set_mapgen_setting("mgname", "mgvalleys", true)
      minetest.set_mapgen_setting_noiseparams("mgvalleys_np_terrain_height", {lacunarity = 2, offset = -5, scale = 25, spread = {1024,1024,1024}, seed = 5202, octaves = 6, persistence = 0.4, flags = "eased"}, true)
      minetest.set_mapgen_setting_noiseparams("mgvalleys_np_valley_depth", {lacunarity = 2, offset = 5, scale = 4, spread = {512,512,512}, seed = -1914, octaves = 1, persistence = 1, flags = "eased"}, true)
      minetest.set_mapgen_setting_noiseparams("mgvalleys_np_valley_profile", {lacunarity = 2, offset = 0.6, scale = 0.5, spread = {512,512,512}, seed = 777, octaves = 1, persistence = 1, flags = "eased"}, true)
      minetest.set_mapgen_setting_noiseparams("mgvalleys_np_inter_valley_fill", {lacunarity = 2, offset = 0, scale = 1, spread = {256,512,256}, seed = 1993, octaves = 6, persistence = 0.8, flags = "eased"}, true)
      minetest.set_mapgen_setting_noiseparams("mgvalleys_np_inter_valley_slope", {lacunarity = 2, offset = 0.5, scale = 0.5, spread = {128,128,128}, seed = 746, octaves = 1, persistence = 1, flags = "eased"}, true)
   elseif lib_mg_params.world_type == 10 then

   else
      minetest.set_mapgen_setting("mgname", "mgv7", true)
      minetest.set_mapgen_setting("mgv7_spflags", "nomountains,noridges,nofloatlands,nocaverns", true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_alt", {lacunarity = 2, offset = 4, scale = 100, spread = {2400,2400,2400}, seed = 5934, octaves = 6, persistence = 0.6, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_height_select", {lacunarity = 2, offset = -0.5, scale = 1, spread = {500,500,500}, seed = 4213, octaves = 4, persistence = 0.4, flags = "defaults"}, true)
      minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_base", {lacunarity = 2, offset = 4, scale = 400, spread = {2400,2400,2400}, seed = 5934, octaves = 8, persistence = 0.3, flags = "defaults"}, true)
   end
end)


What keeps happening is this:

Code: Select all
2019-03-19 10:18:50: ACTION[Main]: Server: Shutting down
2019-03-19 10:18:50: ERROR[Main]: In thread 7efdd0359900:
2019-03-19 10:18:50: ERROR[Main]: /home/mgs/GIT/minetest/src/serverenvironment.cpp:e6: std::__cxx11::string LBMManager::createIntroductionTimesString(): A fatal error occurred: attempted to query on non fully set up LBMManager



In a nutshell, I'm simply trying to configure mapgen params in a mod, laying groundwork for pregenerated world types. I'm sure I've done something incorrectly. Please, can you help?

Shad
ShadMOrdre
Member
 
Posts: 264
Joined: Mon Dec 29, 2014 8:07 am
GitHub: ShadMOrdre
In-game: shadmordre

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

Postby paramat » Tue Mar 19, 2019 11:32 pm

Not sure if it will help but 'minetest.register_on_mapgen_init()' is deprecated and not needed , even in 0.4.16/0.4.17.1 (i think). Your code can just directly set mapgen settings.
Also, 'minetest.set_mapgen_setting("mgname", "mgv7", true)' 'mgname' -> 'mg_name'.
'mgname' was only ever used by the old 'mgparams' API.
The error bemuses me because i can't see what your code has to do with LBMs.
paramat
Developer
 
Posts: 3361
Joined: Sun Oct 28, 2012 12:05 am
GitHub: paramat

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

Postby ShadMOrdre » Fri Mar 22, 2019 6:50 pm

Paramat,

Thank you for the clarification.

After making your recommended changes to my code, I still get the same error. If I leave out any calls to
Code: Select all
minetest.set_mapgen_setting_noiseparams("mgv7_np_terrain_base", {lacunarity = 2, offset = 4, scale = 70, spread = {600,600,600}, seed = 82341, octaves = 5, persistence = 0.6, flags = "defaults"}, true)

and only set the mapgen name, it works. (NOTE: Not this specific example, but calls to set_mapgen_setting_noiseparams in general). Am I writing the above statement correctly? Unfortunately, I could not find a decent example for the new stuff in either lua_api.txt or on the wiki. The deprecated statements still dominate the documentation, as opposed to better info on the new api functions.

Also, I can only set the mapgen name outside of the if statement, which is really weird. Maybe I've got incorrect syntax somewhere.

Again, thanks very much for your assistance.

Shad
ShadMOrdre
Member
 
Posts: 264
Joined: Mon Dec 29, 2014 8:07 am
GitHub: ShadMOrdre
In-game: shadmordre

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

Postby AiTechEye » Sat Mar 23, 2019 9:41 am

can i detect or make smaller lakes? to make difference between lakes and oceans.

eg smaller water on mainland as lakes (fresh water), and all other as ocean (salt water)

Image

and what causing this?
Image2
AiTechEye
Member
 
Posts: 647
Joined: Fri May 29, 2015 9:14 pm
GitHub: AiTechEye

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

Postby Sokomine » Sun Mar 24, 2019 6:29 pm

AiTechEye wrote:can i detect or make smaller lakes? to make difference between lakes and oceans.

The local variable "hole" inside the loop that places the water via set_node has hole.size (in square meters) and hole.volume (in cubic meters) properties. You can decide there what to do with the hole and i.e. ignore it if it seems too small or shallow to your taste.

AiTechEye wrote:eg smaller water on mainland as lakes (fresh water), and all other as ocean (salt water)

Lakes are already filled with river water in my lakes mod. Oceans as such can't come to life as the largest possible theoretical lake size would be something slightly less than 80x80 m.
Sokomine
Member
 
Posts: 3746
Joined: Sun Sep 09, 2012 5:31 pm
GitHub: Sokomine

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

Postby ShadMOrdre » Mon Mar 25, 2019 8:51 am

Is it at all possible to restrict the number of "flow" nodes that emit from a source liquid node.

When a liquid source is placed, it always emits flow in each of the 8 surrounding horizontal directions. Can I, either in lua, or in the engine, possibly limit this to a single flow node? It would be nice to have liquid that only flowed in a single direction from the source. Further, maybe also limit the available directions to remove the diagonals, leaving only the +/- x and z axes. IMHO, this single option would greatly reduce the number of cascading walls of waterfalls that ultimately flood everything along the path to flat enough terrain to make them stop. Hopefully, this would allow more natural looking rivers to form, where the water follows and erodes a channel along the contours of the terrain to the lowest possible altitude, whether that be the ocean, a lake, or another river channel.

I would like this to be liquid specific, thus not applying to all liquids, just those that use it.

Does anyone have any ideas or suggestions of where I can look in the code?
ShadMOrdre
Member
 
Posts: 264
Joined: Mon Dec 29, 2014 8:07 am
GitHub: ShadMOrdre
In-game: shadmordre

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

Postby Termos » Mon Mar 25, 2019 10:23 am

ShadMOrdre wrote:Is it at all possible to restrict the number of "flow" nodes that emit from a source liquid node.
When a liquid source is placed, it always emits flow in each of the 8 surrounding horizontal directions


Actually it's 4. Diagonal neighbors are filled by first gen flowing nodes.
Good question, but how is the engine going to decide which of them to choose?

There has been a proposal, quite reasonable at the first glance, that if there's a height drop in any of the four directions, water shouldn't spread to neighbors that are at the same height as the node under the source, but it has been rejected afaik.

For a quick workaround you might look at this
It greatly reduces water horizontal spread at the cost of destroying some surface nodes
Termos
Member
 
Posts: 64
Joined: Sun Dec 16, 2018 12:50 pm

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

Postby AiTechEye » Mon Mar 25, 2019 11:27 am

ShadMOrdre wrote:Is it at all possible to restrict the number of "flow" nodes that emit from a source liquid node


i guess you mean liquid_range

set it in the water/flowing or overwrite it

Sokomine wrote:
AiTechEye wrote:can i detect or make smaller lakes? to make difference between lakes and oceans.

The local variable "hole" inside the loop that places the water via set_node has hole.size (in square meters) and hole.volume (in cubic meters) properties. You can decide there what to do with the hole and i.e. ignore it if it seems too small or shallow to your taste.

AiTechEye wrote:eg smaller water on mainland as lakes (fresh water), and all other as ocean (salt water)

Lakes are already filled with river water in my lakes mod. Oceans as such can't come to life as the largest possible theoretical lake size would be something slightly less than 80x80 m.


it wasn't about the mod i was asking for, but thanks anyway :)
AiTechEye
Member
 
Posts: 647
Joined: Fri May 29, 2015 9:14 pm
GitHub: AiTechEye

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

Postby StarNinjas » Mon Mar 25, 2019 5:17 pm

Is it it possible to make certain biomes rare?

-J1
StarNinjas
Member
 
Posts: 268
Joined: Wed Mar 14, 2018 12:32 am
GitHub: starninjas
In-game: J1

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

Postby paramat » Mon Mar 25, 2019 11:06 pm

ShadMOrdre, use 'liquid_range' in the node definition to restrict flow distance, MTG river water does this.

> There has been a proposal, quite reasonable at the first glance, that if there's a height drop in any of the four directions, water shouldn't spread to neighbors that are at the same height as the node under the source, but it has been rejected afaik.

Yes there's an engine issue at Github for reducing liquid flooding in some way, not rejected, just not coded as liquid mechanics are quite difficult.

> smaller water on mainland as lakes (fresh water), and all other as ocean (salt water)

Use a mod using the lua voxel manipulator and running in 'register_on_generated()'. if water detected, search the complete extent of the surface nodes, if the water doesn't touch the mapchunk edges it is a small lake and the nodes can be exchangd with river water.

However this will only work for the few small lakes contained within a mapchunk. Otherwise, it is impossible to decide if water is a lake or part of a large sea.

> Is it it possible to make certain biomes rare?

Yes, by changing all the heat/humidity points such that the biome occupies a small area on the voronoi diagram, see the diagram here https://forum.minetest.net/viewtopic.php?f=18&t=15939
You'll need to run 'minetest.clear_registered_biomes()' then re-register them with new heat/humidity points.
paramat
Developer
 
Posts: 3361
Joined: Sun Oct 28, 2012 12:05 am
GitHub: paramat

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

Postby ShadMOrdre » Tue Mar 26, 2019 1:08 am

I actually do not want to change the distance that liquids flow, after all, that is just a setting to change for the node in question.

What I actually want, is to limit the "flowing" nodes that spawn around source nodes. Closer to what you may have referenced in the second quote. I do think this might require an engine based solution.

Code: Select all
    ---- ---- ---- ---- ----         ---- ---- ---- ---- ----
   | wf | WF | WF | WF | wf |       |    |    | WS |    |    |
    ---- ---- ---- ---- ----         ---- ---- ---- ---- ----
   | WF | wf | WF | wf | WF |       |    |    | WF |    |    |
    ---- ---- ---- ---- ----         ---- ---- ---- ---- ----
   | WF | WF | WS | WF | WF |       |    | wf | WF |    |    |
    ---- ---- ---- ---- ----         ---- ---- ---- ---- ----
   | WF | wf | WF | wf | WF |       |    | WF | WF |    |    |
    ---- ---- ---- ---- ----         ---- ---- ---- ---- ----
   | wf | WF | WF | WF | wf |       |    | WF | wf |    |    |
    ---- ---- ---- ---- ----         ---- ---- ---- ---- ----

    WS = water source
    WF = water flowing
    wf = water flowing _diagonal_


Perhaps, so as not to alter existing water mechanics, simply defining a new special water node combo, default:rushing_river_water_source / default:rushing_river_water_flowing, whose mechanics are explicitly different, much like the new plant_rooted versus plantlike node type.

Any hints where I can look in the code?

PS. Paramat, I am still getting the same error regarding minetest.set_mapgen_setting_noiseparams function call.


@StarNinjas You can also spawn an ore dirt type within a given biome, and spawn your "biome/ecosystem" only in the dirt ore. Using an ore definition, you can further refine rarity within the biome using the noise params or rarity properties.
ShadMOrdre
Member
 
Posts: 264
Joined: Mon Dec 29, 2014 8:07 am
GitHub: ShadMOrdre
In-game: shadmordre

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

Postby StarNinjas » Tue Mar 26, 2019 8:11 pm

Thanks
StarNinjas
Member
 
Posts: 268
Joined: Wed Mar 14, 2018 12:32 am
GitHub: starninjas
In-game: J1

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

Postby paramat » Wed Mar 27, 2019 6:29 am

paramat
Developer
 
Posts: 3361
Joined: Sun Oct 28, 2012 12:05 am
GitHub: paramat



Return to Modding Discussion



Who is online

Users browsing this forum: Yandex Bot [Bot] and 0 guests