Changed the way river width is determined in settings

- min_catchment now in square nodes instead of cells
- River widening power as input instead of calculating it from max_catchment
This commit is contained in:
Gaël C 2021-07-24 13:18:58 +02:00
parent 8ce20816e1
commit 9386ef51f1
3 changed files with 11 additions and 13 deletions

View File

@ -90,11 +90,9 @@ if mapgen_rivers.settings.center then
map_offset.z = blocksize*Z/2 map_offset.z = blocksize*Z/2
end end
-- Width coefficients: coefficients solving local min_catchment = mapgen_rivers.settings.min_catchment / (blocksize*blocksize)
-- wfactor * min_catchment ^ wpower = 1/(2*blocksize) local wpower = mapgen_rivers.settings.river_widening_power
-- wfactor * max_catchment ^ wpower = 1 local wfactor = 1/(2*blocksize * min_catchment^wpower)
local wpower = math.log(2*blocksize)/math.log(max_catchment/min_catchment)
local wfactor = 1 / max_catchment ^ wpower
local function river_width(flow) local function river_width(flow)
flow = math.abs(flow) flow = math.abs(flow)
if flow < min_catchment then if flow < min_catchment then

View File

@ -44,8 +44,8 @@ mapgen_rivers.settings = {
center = def_setting('center', 'bool', true), center = def_setting('center', 'bool', true),
blocksize = def_setting('blocksize', 'number', 15), blocksize = def_setting('blocksize', 'number', 15),
sea_level = tonumber(minetest.get_mapgen_setting('water_level')), sea_level = tonumber(minetest.get_mapgen_setting('water_level')),
min_catchment = def_setting('min_catchment', 'number', 25), min_catchment = def_setting('min_catchment', 'number', 3600),
max_catchment = def_setting('max_catchment', 'number', 40000), river_widening_power = def_setting('river_widening_power', 'number', 0.5),
riverbed_slope = def_setting('riverbed_slope', 'number', 0.4), riverbed_slope = def_setting('riverbed_slope', 'number', 0.4),
distort = def_setting('distort', 'bool', true), distort = def_setting('distort', 'bool', true),
biomes = def_setting('biomes', 'bool', true), biomes = def_setting('biomes', 'bool', true),

View File

@ -9,15 +9,15 @@ mapgen_rivers_center (Center map) bool true
# the actual size of the map will be 12000. # the actual size of the map will be 12000.
mapgen_rivers_blocksize (Block size) float 15.0 2.0 100.0 mapgen_rivers_blocksize (Block size) float 15.0 2.0 100.0
# Minimal catchment area for a river to be drawn, in grid cells # Minimal catchment area for a river to be drawn, in square nodes
# (1 cell = blocksize x blocksize).
# Lower value means bigger river density # Lower value means bigger river density
mapgen_rivers_min_catchment (Minimal catchment area) float 25.0 1.0 1000.0 mapgen_rivers_min_catchment (Minimal catchment area) float 3600.0 100.0 1000000.0
# Catchment area in grid cells (1 grid cell = blocksize x blocksize) # Coefficient describing how rivers widen when merging.
# at which rivers reach their maximal width of 2*blocksize. # Riwer width is a power law W = a*D^p. D is river flow and p is this parameter.
# Higher value means a river needs to receive more tributaries to grow in width. # Higher value means a river needs to receive more tributaries to grow in width.
mapgen_rivers_max_catchment (Maximal catchment area) float 40000.0 1000.0 10000000.0 # Note that a river can never exceed 2*blocksize.
mapgen_rivers_river_widening_power (River widening power) float 0.5 0.0 1.0
# Lateral slope of the riverbed. # Lateral slope of the riverbed.
# Higher value means deeper rivers. # Higher value means deeper rivers.