Randomwalk caves: Add parameters for number, proportion flooded. Allow small caves (#8928)

Add mapgen parameters to set the range of the random number of
randomwalk caves per mapchunk, and to set the proportion that are
flooded with liquids.
Default values are, for now, unchanged from the previous hardcoded
values.

Add parameters to allow small randomwalk caves
Disabled by default for now as they have never been present in the
non-mgv6 mapgens.
This commit is contained in:
Paramat 2019-11-08 03:09:43 +00:00 committed by GitHub
parent 5506e97ed8
commit 2a74727857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 416 additions and 188 deletions

@ -1479,6 +1479,21 @@ mgv5_large_cave_depth (Large cave depth) int -256
# Y of upper limit of lava in large caves.
mgv5_lava_depth (Lava depth) int -256
# Minimum limit of random number of small caves per mapchunk.
mgv5_small_cave_num_min (Small cave minimum number) int 0 0 256
# Maximum limit of random number of small caves per mapchunk.
mgv5_small_cave_num_max (Small cave maximum number) int 0 0 256
# Minimum limit of random number of large caves per mapchunk.
mgv5_large_cave_num_min (Large cave minimum number) int 0 0 64
# Maximum limit of random number of large caves per mapchunk.
mgv5_large_cave_num_max (Large cave maximum number) int 2 0 64
# Proportion of large caves that contain liquid.
mgv5_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
# Y-level of cavern upper limit.
mgv5_cavern_limit (Cavern limit) int -256
@ -1596,6 +1611,21 @@ mgv7_large_cave_depth (Large cave depth) int -33
# Y of upper limit of lava in large caves.
mgv7_lava_depth (Lava depth) int -256
# Minimum limit of random number of small caves per mapchunk.
mgv7_small_cave_num_min (Small cave minimum number) int 0 0 256
# Maximum limit of random number of small caves per mapchunk.
mgv7_small_cave_num_max (Small cave maximum number) int 0 0 256
# Minimum limit of random number of large caves per mapchunk.
mgv7_large_cave_num_min (Large cave minimum number) int 0 0 64
# Maximum limit of random number of large caves per mapchunk.
mgv7_large_cave_num_max (Large cave maximum number) int 2 0 64
# Proportion of large caves that contain liquid.
mgv7_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
# Controls the density of mountain-type floatlands.
# Is a noise offset added to the 'mgv7_np_mountain' noise value.
mgv7_float_mount_density (Floatland mountain density) float 0.6
@ -1704,6 +1734,21 @@ mgcarpathian_large_cave_depth (Large cave depth) int -33
# Y of upper limit of lava in large caves.
mgcarpathian_lava_depth (Lava depth) int -256
# Minimum limit of random number of small caves per mapchunk.
mgcarpathian_small_cave_num_min (Small cave minimum number) int 0 0 256
# Maximum limit of random number of small caves per mapchunk.
mgcarpathian_small_cave_num_max (Small cave maximum number) int 0 0 256
# Minimum limit of random number of large caves per mapchunk.
mgcarpathian_large_cave_num_min (Large cave minimum number) int 0 0 64
# Maximum limit of random number of large caves per mapchunk.
mgcarpathian_large_cave_num_max (Large cave maximum number) int 2 0 64
# Proportion of large caves that contain liquid.
mgcarpathian_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
# Y-level of cavern upper limit.
mgcarpathian_cavern_limit (Cavern limit) int -256
@ -1788,6 +1833,21 @@ mgflat_large_cave_depth (Large cave depth) int -33
# Y of upper limit of lava in large caves.
mgflat_lava_depth (Lava depth) int -256
# Minimum limit of random number of small caves per mapchunk.
mgflat_small_cave_num_min (Small cave minimum number) int 0 0 256
# Maximum limit of random number of small caves per mapchunk.
mgflat_small_cave_num_max (Small cave maximum number) int 0 0 256
# Minimum limit of random number of large caves per mapchunk.
mgflat_large_cave_num_min (Large cave minimum number) int 0 0 64
# Maximum limit of random number of large caves per mapchunk.
mgflat_large_cave_num_max (Large cave maximum number) int 2 0 64
# Proportion of large caves that contain liquid.
mgflat_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
# Controls width of tunnels, a smaller value creates wider tunnels.
mgflat_cave_width (Cave width) float 0.09
@ -1847,6 +1907,21 @@ mgfractal_large_cave_depth (Large cave depth) int -33
# Y of upper limit of lava in large caves.
mgfractal_lava_depth (Lava depth) int -256
# Minimum limit of random number of small caves per mapchunk.
mgfractal_small_cave_num_min (Small cave minimum number) int 0 0 256
# Maximum limit of random number of small caves per mapchunk.
mgfractal_small_cave_num_max (Small cave maximum number) int 0 0 256
# Minimum limit of random number of large caves per mapchunk.
mgfractal_large_cave_num_min (Large cave minimum number) int 0 0 64
# Maximum limit of random number of large caves per mapchunk.
mgfractal_large_cave_num_max (Large cave maximum number) int 2 0 64
# Proportion of large caves that contain liquid.
mgfractal_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
# Lower Y limit of dungeons.
mgfractal_dungeon_ymin (Dungeon minimum Y) int -31000
@ -1970,6 +2045,21 @@ mgvalleys_large_cave_depth (Large cave depth) int -33
# Y of upper limit of lava in large caves.
mgvalleys_lava_depth (Lava depth) int 1
# Minimum limit of random number of small caves per mapchunk.
mgvalleys_small_cave_num_min (Small cave minimum number) int 0 0 256
# Maximum limit of random number of small caves per mapchunk.
mgvalleys_small_cave_num_max (Small cave maximum number) int 0 0 256
# Minimum limit of random number of large caves per mapchunk.
mgvalleys_large_cave_num_min (Large cave minimum number) int 0 0 64
# Maximum limit of random number of large caves per mapchunk.
mgvalleys_large_cave_num_max (Large cave maximum number) int 2 0 64
# Proportion of large caves that contain liquid.
mgvalleys_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
# Depth below which you'll find giant caverns.
mgvalleys_cavern_limit (Cavern upper limit) int -256

@ -280,18 +280,20 @@ CavesRandomWalk::CavesRandomWalk(
int water_level,
content_t water_source,
content_t lava_source,
float large_cave_flooded,
int lava_depth,
BiomeGen *biomegen)
{
assert(ndef);
this->ndef = ndef;
this->gennotify = gennotify;
this->seed = seed;
this->water_level = water_level;
this->np_caveliquids = &nparams_caveliquids;
this->lava_depth = lava_depth;
this->bmgn = biomegen;
this->ndef = ndef;
this->gennotify = gennotify;
this->seed = seed;
this->water_level = water_level;
this->np_caveliquids = &nparams_caveliquids;
this->large_cave_flooded = large_cave_flooded;
this->lava_depth = lava_depth;
this->bmgn = biomegen;
c_water_source = water_source;
if (c_water_source == CONTENT_IGNORE)
@ -322,7 +324,7 @@ void CavesRandomWalk::makeCave(MMVManip *vm, v3s16 nmin, v3s16 nmax,
this->ystride = nmax.X - nmin.X + 1;
flooded = ps->range(1, 2) == 2;
flooded = ps->range(1, 1000) <= large_cave_flooded * 1000.0f;
// If flooded:
// Get biome at mapchunk midpoint. If cave liquid defined for biome, use it.

@ -116,15 +116,14 @@ public:
s16 *heightmap;
BiomeGen *bmgn;
// configurable parameters
s32 seed;
int water_level;
float large_cave_flooded;
// TODO 'lava_depth' and 'np_caveliquids' are deprecated and should be removed.
// Cave liquids are now defined and located using biome definitions.
int lava_depth;
NoiseParams *np_caveliquids;
// intermediate state variables
u16 ystride;
s16 min_tunnel_diameter;
@ -161,7 +160,8 @@ public:
CavesRandomWalk(const NodeDefManager *ndef, GenerateNotifier *gennotify =
NULL, s32 seed = 0, int water_level = 1, content_t water_source =
CONTENT_IGNORE, content_t lava_source = CONTENT_IGNORE,
int lava_depth = -256, BiomeGen *biomegen = NULL);
float large_cave_flooded = 0.5f, int lava_depth = -256,
BiomeGen *biomegen = NULL);
// vm and ps are mandatory parameters.
// If heightmap is NULL, the surface level at all points is assumed to

@ -843,18 +843,29 @@ void MapgenBasic::generateCavesNoiseIntersection(s16 max_stone_y)
void MapgenBasic::generateCavesRandomWalk(s16 max_stone_y, s16 large_cave_depth)
{
if (node_min.Y > max_stone_y || node_max.Y > large_cave_depth)
if (node_min.Y > max_stone_y)
return;
PseudoRandom ps(blockseed + 21343);
u32 bruises_count = ps.range(0, 2);
// Small randomwalk caves
u32 num_small_caves = ps.range(small_cave_num_min, small_cave_num_max);
for (u32 i = 0; i < bruises_count; i++) {
for (u32 i = 0; i < num_small_caves; i++) {
CavesRandomWalk cave(ndef, &gennotify, seed, water_level,
c_water_source, c_lava_source, lava_depth, biomegen);
c_water_source, c_lava_source, large_cave_flooded, lava_depth, biomegen);
cave.makeCave(vm, node_min, node_max, &ps, false, max_stone_y, heightmap);
}
cave.makeCave(vm, node_min, node_max, &ps, true, max_stone_y,
heightmap);
if (node_max.Y > large_cave_depth)
return;
// Large randomwalk caves below 'large_cave_depth'
u32 num_large_caves = ps.range(large_cave_num_min, large_cave_num_max);
for (u32 i = 0; i < num_large_caves; i++) {
CavesRandomWalk cave(ndef, &gennotify, seed, water_level,
c_water_source, c_lava_source, large_cave_flooded, lava_depth, biomegen);
cave.makeCave(vm, node_min, node_max, &ps, true, max_stone_y, heightmap);
}
}

@ -280,6 +280,11 @@ protected:
float cavern_limit;
float cavern_taper;
float cavern_threshold;
int small_cave_num_min;
int small_cave_num_max;
int large_cave_num_min;
int large_cave_num_max;
float large_cave_flooded;
// TODO 'lava_depth' is deprecated and should be removed. Cave liquids are
// now defined and located using biome definitions.
int lava_depth;

@ -58,15 +58,20 @@ MapgenCarpathian::MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager
river_depth = params->river_depth;
valley_width = params->valley_width;
spflags = params->spflags;
cave_width = params->cave_width;
large_cave_depth = params->large_cave_depth;
lava_depth = params->lava_depth;
cavern_limit = params->cavern_limit;
cavern_taper = params->cavern_taper;
cavern_threshold = params->cavern_threshold;
dungeon_ymin = params->dungeon_ymin;
dungeon_ymax = params->dungeon_ymax;
spflags = params->spflags;
cave_width = params->cave_width;
large_cave_depth = params->large_cave_depth;
lava_depth = params->lava_depth;
small_cave_num_min = params->small_cave_num_min;
small_cave_num_max = params->small_cave_num_max;
large_cave_num_min = params->large_cave_num_min;
large_cave_num_max = params->large_cave_num_max;
large_cave_flooded = params->large_cave_flooded;
cavern_limit = params->cavern_limit;
cavern_taper = params->cavern_taper;
cavern_threshold = params->cavern_threshold;
dungeon_ymin = params->dungeon_ymin;
dungeon_ymax = params->dungeon_ymax;
grad_wl = 1 - water_level;
@ -148,14 +153,19 @@ void MapgenCarpathianParams::readParams(const Settings *settings)
settings->getFloatNoEx("mgcarpathian_river_depth", river_depth);
settings->getFloatNoEx("mgcarpathian_valley_width", valley_width);
settings->getFloatNoEx("mgcarpathian_cave_width", cave_width);
settings->getS16NoEx("mgcarpathian_large_cave_depth", large_cave_depth);
settings->getS16NoEx("mgcarpathian_lava_depth", lava_depth);
settings->getS16NoEx("mgcarpathian_cavern_limit", cavern_limit);
settings->getS16NoEx("mgcarpathian_cavern_taper", cavern_taper);
settings->getFloatNoEx("mgcarpathian_cavern_threshold", cavern_threshold);
settings->getS16NoEx("mgcarpathian_dungeon_ymin", dungeon_ymin);
settings->getS16NoEx("mgcarpathian_dungeon_ymax", dungeon_ymax);
settings->getFloatNoEx("mgcarpathian_cave_width", cave_width);
settings->getS16NoEx("mgcarpathian_large_cave_depth", large_cave_depth);
settings->getS16NoEx("mgcarpathian_lava_depth", lava_depth);
settings->getU16NoEx("mgcarpathian_small_cave_num_min", small_cave_num_min);
settings->getU16NoEx("mgcarpathian_small_cave_num_max", small_cave_num_max);
settings->getU16NoEx("mgcarpathian_large_cave_num_min", large_cave_num_min);
settings->getU16NoEx("mgcarpathian_large_cave_num_max", large_cave_num_max);
settings->getFloatNoEx("mgcarpathian_large_cave_flooded", large_cave_flooded);
settings->getS16NoEx("mgcarpathian_cavern_limit", cavern_limit);
settings->getS16NoEx("mgcarpathian_cavern_taper", cavern_taper);
settings->getFloatNoEx("mgcarpathian_cavern_threshold", cavern_threshold);
settings->getS16NoEx("mgcarpathian_dungeon_ymin", dungeon_ymin);
settings->getS16NoEx("mgcarpathian_dungeon_ymax", dungeon_ymax);
settings->getNoiseParams("mgcarpathian_np_filler_depth", np_filler_depth);
settings->getNoiseParams("mgcarpathian_np_height1", np_height1);
@ -186,14 +196,19 @@ void MapgenCarpathianParams::writeParams(Settings *settings) const
settings->setFloat("mgcarpathian_river_depth", river_depth);
settings->setFloat("mgcarpathian_valley_width", valley_width);
settings->setFloat("mgcarpathian_cave_width", cave_width);
settings->setS16("mgcarpathian_large_cave_depth", large_cave_depth);
settings->setS16("mgcarpathian_lava_depth", lava_depth);
settings->setS16("mgcarpathian_cavern_limit", cavern_limit);
settings->setS16("mgcarpathian_cavern_taper", cavern_taper);
settings->setFloat("mgcarpathian_cavern_threshold", cavern_threshold);
settings->setS16("mgcarpathian_dungeon_ymin", dungeon_ymin);
settings->setS16("mgcarpathian_dungeon_ymax", dungeon_ymax);
settings->setFloat("mgcarpathian_cave_width", cave_width);
settings->setS16("mgcarpathian_large_cave_depth", large_cave_depth);
settings->setS16("mgcarpathian_lava_depth", lava_depth);
settings->setU16("mgcarpathian_small_cave_num_min", small_cave_num_min);
settings->setU16("mgcarpathian_small_cave_num_max", small_cave_num_max);
settings->setU16("mgcarpathian_large_cave_num_min", large_cave_num_min);
settings->setU16("mgcarpathian_large_cave_num_max", large_cave_num_max);
settings->setFloat("mgcarpathian_large_cave_flooded", large_cave_flooded);
settings->setS16("mgcarpathian_cavern_limit", cavern_limit);
settings->setS16("mgcarpathian_cavern_taper", cavern_taper);
settings->setFloat("mgcarpathian_cavern_threshold", cavern_threshold);
settings->setS16("mgcarpathian_dungeon_ymin", dungeon_ymin);
settings->setS16("mgcarpathian_dungeon_ymax", dungeon_ymax);
settings->setNoiseParams("mgcarpathian_np_filler_depth", np_filler_depth);
settings->setNoiseParams("mgcarpathian_np_height1", np_height1);

@ -37,15 +37,20 @@ struct MapgenCarpathianParams : public MapgenParams
float river_depth = 24.0f;
float valley_width = 0.25f;
u32 spflags = MGCARPATHIAN_CAVERNS;
float cave_width = 0.09f;
s16 large_cave_depth = -33;
s16 lava_depth = -256;
s16 cavern_limit = -256;
s16 cavern_taper = 256;
float cavern_threshold = 0.7f;
s16 dungeon_ymin = -31000;
s16 dungeon_ymax = 31000;
u32 spflags = MGCARPATHIAN_CAVERNS;
float cave_width = 0.09f;
s16 large_cave_depth = -33;
s16 lava_depth = -256;
u16 small_cave_num_min = 0;
u16 small_cave_num_max = 0;
u16 large_cave_num_min = 0;
u16 large_cave_num_max = 2;
float large_cave_flooded = 0.5f;
s16 cavern_limit = -256;
s16 cavern_taper = 256;
float cavern_threshold = 0.7f;
s16 dungeon_ymin = -31000;
s16 dungeon_ymax = 31000;
NoiseParams np_filler_depth;
NoiseParams np_height1;

@ -51,17 +51,22 @@ FlagDesc flagdesc_mapgen_flat[] = {
MapgenFlat::MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge)
: MapgenBasic(MAPGEN_FLAT, params, emerge)
{
spflags = params->spflags;
ground_level = params->ground_level;
large_cave_depth = params->large_cave_depth;
lava_depth = params->lava_depth;
cave_width = params->cave_width;
lake_threshold = params->lake_threshold;
lake_steepness = params->lake_steepness;
hill_threshold = params->hill_threshold;
hill_steepness = params->hill_steepness;
dungeon_ymin = params->dungeon_ymin;
dungeon_ymax = params->dungeon_ymax;
spflags = params->spflags;
ground_level = params->ground_level;
large_cave_depth = params->large_cave_depth;
lava_depth = params->lava_depth;
small_cave_num_min = params->small_cave_num_min;
small_cave_num_max = params->small_cave_num_max;
large_cave_num_min = params->large_cave_num_min;
large_cave_num_max = params->large_cave_num_max;
large_cave_flooded = params->large_cave_flooded;
cave_width = params->cave_width;
lake_threshold = params->lake_threshold;
lake_steepness = params->lake_steepness;
hill_threshold = params->hill_threshold;
hill_steepness = params->hill_steepness;
dungeon_ymin = params->dungeon_ymin;
dungeon_ymax = params->dungeon_ymax;
// 2D noise
noise_filler_depth = new Noise(&params->np_filler_depth, seed, csize.X, csize.Z);
@ -96,17 +101,22 @@ MapgenFlatParams::MapgenFlatParams():
void MapgenFlatParams::readParams(const Settings *settings)
{
settings->getFlagStrNoEx("mgflat_spflags", spflags, flagdesc_mapgen_flat);
settings->getS16NoEx("mgflat_ground_level", ground_level);
settings->getS16NoEx("mgflat_large_cave_depth", large_cave_depth);
settings->getS16NoEx("mgflat_lava_depth", lava_depth);
settings->getFloatNoEx("mgflat_cave_width", cave_width);
settings->getFloatNoEx("mgflat_lake_threshold", lake_threshold);
settings->getFloatNoEx("mgflat_lake_steepness", lake_steepness);
settings->getFloatNoEx("mgflat_hill_threshold", hill_threshold);
settings->getFloatNoEx("mgflat_hill_steepness", hill_steepness);
settings->getS16NoEx("mgflat_dungeon_ymin", dungeon_ymin);
settings->getS16NoEx("mgflat_dungeon_ymax", dungeon_ymax);
settings->getFlagStrNoEx("mgflat_spflags", spflags, flagdesc_mapgen_flat);
settings->getS16NoEx("mgflat_ground_level", ground_level);
settings->getS16NoEx("mgflat_large_cave_depth", large_cave_depth);
settings->getS16NoEx("mgflat_lava_depth", lava_depth);
settings->getU16NoEx("mgflat_small_cave_num_min", small_cave_num_min);
settings->getU16NoEx("mgflat_small_cave_num_max", small_cave_num_max);
settings->getU16NoEx("mgflat_large_cave_num_min", large_cave_num_min);
settings->getU16NoEx("mgflat_large_cave_num_max", large_cave_num_max);
settings->getFloatNoEx("mgflat_large_cave_flooded", large_cave_flooded);
settings->getFloatNoEx("mgflat_cave_width", cave_width);
settings->getFloatNoEx("mgflat_lake_threshold", lake_threshold);
settings->getFloatNoEx("mgflat_lake_steepness", lake_steepness);
settings->getFloatNoEx("mgflat_hill_threshold", hill_threshold);
settings->getFloatNoEx("mgflat_hill_steepness", hill_steepness);
settings->getS16NoEx("mgflat_dungeon_ymin", dungeon_ymin);
settings->getS16NoEx("mgflat_dungeon_ymax", dungeon_ymax);
settings->getNoiseParams("mgflat_np_terrain", np_terrain);
settings->getNoiseParams("mgflat_np_filler_depth", np_filler_depth);
@ -118,17 +128,22 @@ void MapgenFlatParams::readParams(const Settings *settings)
void MapgenFlatParams::writeParams(Settings *settings) const
{
settings->setFlagStr("mgflat_spflags", spflags, flagdesc_mapgen_flat, U32_MAX);
settings->setS16("mgflat_ground_level", ground_level);
settings->setS16("mgflat_large_cave_depth", large_cave_depth);
settings->setS16("mgflat_lava_depth", lava_depth);
settings->setFloat("mgflat_cave_width", cave_width);
settings->setFloat("mgflat_lake_threshold", lake_threshold);
settings->setFloat("mgflat_lake_steepness", lake_steepness);
settings->setFloat("mgflat_hill_threshold", hill_threshold);
settings->setFloat("mgflat_hill_steepness", hill_steepness);
settings->setS16("mgflat_dungeon_ymin", dungeon_ymin);
settings->setS16("mgflat_dungeon_ymax", dungeon_ymax);
settings->setFlagStr("mgflat_spflags", spflags, flagdesc_mapgen_flat, U32_MAX);
settings->setS16("mgflat_ground_level", ground_level);
settings->setS16("mgflat_large_cave_depth", large_cave_depth);
settings->setS16("mgflat_lava_depth", lava_depth);
settings->setU16("mgflat_small_cave_num_min", small_cave_num_min);
settings->setU16("mgflat_small_cave_num_max", small_cave_num_max);
settings->setU16("mgflat_large_cave_num_min", large_cave_num_min);
settings->setU16("mgflat_large_cave_num_max", large_cave_num_max);
settings->setFloat("mgflat_large_cave_flooded", large_cave_flooded);
settings->setFloat("mgflat_cave_width", cave_width);
settings->setFloat("mgflat_lake_threshold", lake_threshold);
settings->setFloat("mgflat_lake_steepness", lake_steepness);
settings->setFloat("mgflat_hill_threshold", hill_threshold);
settings->setFloat("mgflat_hill_steepness", hill_steepness);
settings->setS16("mgflat_dungeon_ymin", dungeon_ymin);
settings->setS16("mgflat_dungeon_ymax", dungeon_ymax);
settings->setNoiseParams("mgflat_np_terrain", np_terrain);
settings->setNoiseParams("mgflat_np_filler_depth", np_filler_depth);

@ -36,6 +36,11 @@ struct MapgenFlatParams : public MapgenParams
s16 ground_level = 8;
s16 large_cave_depth = -33;
s16 lava_depth = -256;
u16 small_cave_num_min = 0;
u16 small_cave_num_max = 0;
u16 large_cave_num_min = 0;
u16 large_cave_num_max = 2;
float large_cave_flooded = 0.5f;
float cave_width = 0.09f;
float lake_threshold = -0.45f;
float lake_steepness = 48.0f;

@ -51,21 +51,26 @@ FlagDesc flagdesc_mapgen_fractal[] = {
MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge)
: MapgenBasic(MAPGEN_FRACTAL, params, emerge)
{
spflags = params->spflags;
cave_width = params->cave_width;
large_cave_depth = params->large_cave_depth;
lava_depth = params->lava_depth;
dungeon_ymin = params->dungeon_ymin;
dungeon_ymax = params->dungeon_ymax;
fractal = params->fractal;
iterations = params->iterations;
scale = params->scale;
offset = params->offset;
slice_w = params->slice_w;
julia_x = params->julia_x;
julia_y = params->julia_y;
julia_z = params->julia_z;
julia_w = params->julia_w;
spflags = params->spflags;
cave_width = params->cave_width;
large_cave_depth = params->large_cave_depth;
lava_depth = params->lava_depth;
small_cave_num_min = params->small_cave_num_min;
small_cave_num_max = params->small_cave_num_max;
large_cave_num_min = params->large_cave_num_min;
large_cave_num_max = params->large_cave_num_max;
large_cave_flooded = params->large_cave_flooded;
dungeon_ymin = params->dungeon_ymin;
dungeon_ymax = params->dungeon_ymax;
fractal = params->fractal;
iterations = params->iterations;
scale = params->scale;
offset = params->offset;
slice_w = params->slice_w;
julia_x = params->julia_x;
julia_y = params->julia_y;
julia_z = params->julia_z;
julia_w = params->julia_w;
//// 2D noise
if (spflags & MGFRACTAL_TERRAIN)
@ -105,21 +110,26 @@ MapgenFractalParams::MapgenFractalParams():
void MapgenFractalParams::readParams(const Settings *settings)
{
settings->getFlagStrNoEx("mgfractal_spflags", spflags, flagdesc_mapgen_fractal);
settings->getFloatNoEx("mgfractal_cave_width", cave_width);
settings->getS16NoEx("mgfractal_large_cave_depth", large_cave_depth);
settings->getS16NoEx("mgfractal_lava_depth", lava_depth);
settings->getS16NoEx("mgfractal_dungeon_ymin", dungeon_ymin);
settings->getS16NoEx("mgfractal_dungeon_ymax", dungeon_ymax);
settings->getU16NoEx("mgfractal_fractal", fractal);
settings->getU16NoEx("mgfractal_iterations", iterations);
settings->getV3FNoEx("mgfractal_scale", scale);
settings->getV3FNoEx("mgfractal_offset", offset);
settings->getFloatNoEx("mgfractal_slice_w", slice_w);
settings->getFloatNoEx("mgfractal_julia_x", julia_x);
settings->getFloatNoEx("mgfractal_julia_y", julia_y);
settings->getFloatNoEx("mgfractal_julia_z", julia_z);
settings->getFloatNoEx("mgfractal_julia_w", julia_w);
settings->getFlagStrNoEx("mgfractal_spflags", spflags, flagdesc_mapgen_fractal);
settings->getFloatNoEx("mgfractal_cave_width", cave_width);
settings->getS16NoEx("mgfractal_large_cave_depth", large_cave_depth);
settings->getS16NoEx("mgfractal_lava_depth", lava_depth);
settings->getU16NoEx("mgfractal_small_cave_num_min", small_cave_num_min);
settings->getU16NoEx("mgfractal_small_cave_num_max", small_cave_num_max);
settings->getU16NoEx("mgfractal_large_cave_num_min", large_cave_num_min);
settings->getU16NoEx("mgfractal_large_cave_num_max", large_cave_num_max);
settings->getFloatNoEx("mgfractal_large_cave_flooded", large_cave_flooded);
settings->getS16NoEx("mgfractal_dungeon_ymin", dungeon_ymin);
settings->getS16NoEx("mgfractal_dungeon_ymax", dungeon_ymax);
settings->getU16NoEx("mgfractal_fractal", fractal);
settings->getU16NoEx("mgfractal_iterations", iterations);
settings->getV3FNoEx("mgfractal_scale", scale);
settings->getV3FNoEx("mgfractal_offset", offset);
settings->getFloatNoEx("mgfractal_slice_w", slice_w);
settings->getFloatNoEx("mgfractal_julia_x", julia_x);
settings->getFloatNoEx("mgfractal_julia_y", julia_y);
settings->getFloatNoEx("mgfractal_julia_z", julia_z);
settings->getFloatNoEx("mgfractal_julia_w", julia_w);
settings->getNoiseParams("mgfractal_np_seabed", np_seabed);
settings->getNoiseParams("mgfractal_np_filler_depth", np_filler_depth);
@ -131,21 +141,26 @@ void MapgenFractalParams::readParams(const Settings *settings)
void MapgenFractalParams::writeParams(Settings *settings) const
{
settings->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal, U32_MAX);
settings->setFloat("mgfractal_cave_width", cave_width);
settings->setS16("mgfractal_large_cave_depth", large_cave_depth);
settings->setS16("mgfractal_lava_depth", lava_depth);
settings->setS16("mgfractal_dungeon_ymin", dungeon_ymin);
settings->setS16("mgfractal_dungeon_ymax", dungeon_ymax);
settings->setU16("mgfractal_fractal", fractal);
settings->setU16("mgfractal_iterations", iterations);
settings->setV3F("mgfractal_scale", scale);
settings->setV3F("mgfractal_offset", offset);
settings->setFloat("mgfractal_slice_w", slice_w);
settings->setFloat("mgfractal_julia_x", julia_x);
settings->setFloat("mgfractal_julia_y", julia_y);
settings->setFloat("mgfractal_julia_z", julia_z);
settings->setFloat("mgfractal_julia_w", julia_w);
settings->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal, U32_MAX);
settings->setFloat("mgfractal_cave_width", cave_width);
settings->setS16("mgfractal_large_cave_depth", large_cave_depth);
settings->setS16("mgfractal_lava_depth", lava_depth);
settings->setU16("mgfractal_small_cave_num_min", small_cave_num_min);
settings->setU16("mgfractal_small_cave_num_max", small_cave_num_max);
settings->setU16("mgfractal_large_cave_num_min", large_cave_num_min);
settings->setU16("mgfractal_large_cave_num_max", large_cave_num_max);
settings->setFloat("mgfractal_large_cave_flooded", large_cave_flooded);
settings->setS16("mgfractal_dungeon_ymin", dungeon_ymin);
settings->setS16("mgfractal_dungeon_ymax", dungeon_ymax);
settings->setU16("mgfractal_fractal", fractal);
settings->setU16("mgfractal_iterations", iterations);
settings->setV3F("mgfractal_scale", scale);
settings->setV3F("mgfractal_offset", offset);
settings->setFloat("mgfractal_slice_w", slice_w);
settings->setFloat("mgfractal_julia_x", julia_x);
settings->setFloat("mgfractal_julia_y", julia_y);
settings->setFloat("mgfractal_julia_z", julia_z);
settings->setFloat("mgfractal_julia_w", julia_w);
settings->setNoiseParams("mgfractal_np_seabed", np_seabed);
settings->setNoiseParams("mgfractal_np_filler_depth", np_filler_depth);

@ -39,6 +39,11 @@ struct MapgenFractalParams : public MapgenParams
float cave_width = 0.09f;
s16 large_cave_depth = -33;
s16 lava_depth = -256;
u16 small_cave_num_min = 0;
u16 small_cave_num_max = 0;
u16 large_cave_num_min = 0;
u16 large_cave_num_max = 2;
float large_cave_flooded = 0.5f;
s16 dungeon_ymin = -31000;
s16 dungeon_ymax = 31000;
u16 fractal = 1;

@ -48,15 +48,20 @@ FlagDesc flagdesc_mapgen_v5[] = {
MapgenV5::MapgenV5(MapgenV5Params *params, EmergeManager *emerge)
: MapgenBasic(MAPGEN_V5, params, emerge)
{
spflags = params->spflags;
cave_width = params->cave_width;
large_cave_depth = params->large_cave_depth;
lava_depth = params->lava_depth;
cavern_limit = params->cavern_limit;
cavern_taper = params->cavern_taper;
cavern_threshold = params->cavern_threshold;
dungeon_ymin = params->dungeon_ymin;
dungeon_ymax = params->dungeon_ymax;
spflags = params->spflags;
cave_width = params->cave_width;
large_cave_depth = params->large_cave_depth;
lava_depth = params->lava_depth;
small_cave_num_min = params->small_cave_num_min;
small_cave_num_max = params->small_cave_num_max;
large_cave_num_min = params->large_cave_num_min;
large_cave_num_max = params->large_cave_num_max;
large_cave_flooded = params->large_cave_flooded;
cavern_limit = params->cavern_limit;
cavern_taper = params->cavern_taper;
cavern_threshold = params->cavern_threshold;
dungeon_ymin = params->dungeon_ymin;
dungeon_ymax = params->dungeon_ymax;
// Terrain noise
noise_filler_depth = new Noise(&params->np_filler_depth, seed, csize.X, csize.Z);
@ -98,15 +103,20 @@ MapgenV5Params::MapgenV5Params():
void MapgenV5Params::readParams(const Settings *settings)
{
settings->getFlagStrNoEx("mgv5_spflags", spflags, flagdesc_mapgen_v5);
settings->getFloatNoEx("mgv5_cave_width", cave_width);
settings->getS16NoEx("mgv5_large_cave_depth", large_cave_depth);
settings->getS16NoEx("mgv5_lava_depth", lava_depth);
settings->getS16NoEx("mgv5_cavern_limit", cavern_limit);
settings->getS16NoEx("mgv5_cavern_taper", cavern_taper);
settings->getFloatNoEx("mgv5_cavern_threshold", cavern_threshold);
settings->getS16NoEx("mgv5_dungeon_ymin", dungeon_ymin);
settings->getS16NoEx("mgv5_dungeon_ymax", dungeon_ymax);
settings->getFlagStrNoEx("mgv5_spflags", spflags, flagdesc_mapgen_v5);
settings->getFloatNoEx("mgv5_cave_width", cave_width);
settings->getS16NoEx("mgv5_large_cave_depth", large_cave_depth);
settings->getS16NoEx("mgv5_lava_depth", lava_depth);
settings->getU16NoEx("mgv5_small_cave_num_min", small_cave_num_min);
settings->getU16NoEx("mgv5_small_cave_num_max", small_cave_num_max);
settings->getU16NoEx("mgv5_large_cave_num_min", large_cave_num_min);
settings->getU16NoEx("mgv5_large_cave_num_max", large_cave_num_max);
settings->getFloatNoEx("mgv5_large_cave_flooded", large_cave_flooded);
settings->getS16NoEx("mgv5_cavern_limit", cavern_limit);
settings->getS16NoEx("mgv5_cavern_taper", cavern_taper);
settings->getFloatNoEx("mgv5_cavern_threshold", cavern_threshold);
settings->getS16NoEx("mgv5_dungeon_ymin", dungeon_ymin);
settings->getS16NoEx("mgv5_dungeon_ymax", dungeon_ymax);
settings->getNoiseParams("mgv5_np_filler_depth", np_filler_depth);
settings->getNoiseParams("mgv5_np_factor", np_factor);
@ -121,15 +131,20 @@ void MapgenV5Params::readParams(const Settings *settings)
void MapgenV5Params::writeParams(Settings *settings) const
{
settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5, U32_MAX);
settings->setFloat("mgv5_cave_width", cave_width);
settings->setS16("mgv5_large_cave_depth", large_cave_depth);
settings->setS16("mgv5_lava_depth", lava_depth);
settings->setS16("mgv5_cavern_limit", cavern_limit);
settings->setS16("mgv5_cavern_taper", cavern_taper);
settings->setFloat("mgv5_cavern_threshold", cavern_threshold);
settings->setS16("mgv5_dungeon_ymin", dungeon_ymin);
settings->setS16("mgv5_dungeon_ymax", dungeon_ymax);
settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5, U32_MAX);
settings->setFloat("mgv5_cave_width", cave_width);
settings->setS16("mgv5_large_cave_depth", large_cave_depth);
settings->setS16("mgv5_lava_depth", lava_depth);
settings->setU16("mgv5_small_cave_num_min", small_cave_num_min);
settings->setU16("mgv5_small_cave_num_max", small_cave_num_max);
settings->setU16("mgv5_large_cave_num_min", large_cave_num_min);
settings->setU16("mgv5_large_cave_num_max", large_cave_num_max);
settings->setFloat("mgv5_large_cave_flooded", large_cave_flooded);
settings->setS16("mgv5_cavern_limit", cavern_limit);
settings->setS16("mgv5_cavern_taper", cavern_taper);
settings->setFloat("mgv5_cavern_threshold", cavern_threshold);
settings->setS16("mgv5_dungeon_ymin", dungeon_ymin);
settings->setS16("mgv5_dungeon_ymax", dungeon_ymax);
settings->setNoiseParams("mgv5_np_filler_depth", np_filler_depth);
settings->setNoiseParams("mgv5_np_factor", np_factor);

@ -35,6 +35,11 @@ struct MapgenV5Params : public MapgenParams
float cave_width = 0.09f;
s16 large_cave_depth = -256;
s16 lava_depth = -256;
u16 small_cave_num_min = 0;
u16 small_cave_num_max = 0;
u16 large_cave_num_min = 0;
u16 large_cave_num_max = 2;
float large_cave_flooded = 0.5f;
s16 cavern_limit = -256;
s16 cavern_taper = 256;
float cavern_threshold = 0.7f;

@ -62,14 +62,19 @@ MapgenV7::MapgenV7(MapgenV7Params *params, EmergeManager *emerge)
floatland_level = params->floatland_level;
shadow_limit = params->shadow_limit;
cave_width = params->cave_width;
large_cave_depth = params->large_cave_depth;
lava_depth = params->lava_depth;
cavern_limit = params->cavern_limit;
cavern_taper = params->cavern_taper;
cavern_threshold = params->cavern_threshold;
dungeon_ymin = params->dungeon_ymin;
dungeon_ymax = params->dungeon_ymax;
cave_width = params->cave_width;
large_cave_depth = params->large_cave_depth;
lava_depth = params->lava_depth;
small_cave_num_min = params->small_cave_num_min;
small_cave_num_max = params->small_cave_num_max;
large_cave_num_min = params->large_cave_num_min;
large_cave_num_max = params->large_cave_num_max;
large_cave_flooded = params->large_cave_flooded;
cavern_limit = params->cavern_limit;
cavern_taper = params->cavern_taper;
cavern_threshold = params->cavern_threshold;
dungeon_ymin = params->dungeon_ymin;
dungeon_ymax = params->dungeon_ymax;
// This is to avoid a divide-by-zero.
// Parameter will be saved to map_meta.txt in limited form.
@ -173,6 +178,11 @@ void MapgenV7Params::readParams(const Settings *settings)
settings->getFloatNoEx("mgv7_cave_width", cave_width);
settings->getS16NoEx("mgv7_large_cave_depth", large_cave_depth);
settings->getS16NoEx("mgv7_lava_depth", lava_depth);
settings->getU16NoEx("mgv7_small_cave_num_min", small_cave_num_min);
settings->getU16NoEx("mgv7_small_cave_num_max", small_cave_num_max);
settings->getU16NoEx("mgv7_large_cave_num_min", large_cave_num_min);
settings->getU16NoEx("mgv7_large_cave_num_max", large_cave_num_max);
settings->getFloatNoEx("mgv7_large_cave_flooded", large_cave_flooded);
settings->getFloatNoEx("mgv7_float_mount_density", float_mount_density);
settings->getFloatNoEx("mgv7_float_mount_height", float_mount_height);
settings->getFloatNoEx("mgv7_float_mount_exponent", float_mount_exponent);
@ -209,6 +219,11 @@ void MapgenV7Params::writeParams(Settings *settings) const
settings->setFloat("mgv7_cave_width", cave_width);
settings->setS16("mgv7_large_cave_depth", large_cave_depth);
settings->setS16("mgv7_lava_depth", lava_depth);
settings->setU16("mgv7_small_cave_num_min", small_cave_num_min);
settings->setU16("mgv7_small_cave_num_max", small_cave_num_max);
settings->setU16("mgv7_large_cave_num_min", large_cave_num_min);
settings->setU16("mgv7_large_cave_num_max", large_cave_num_max);
settings->setFloat("mgv7_large_cave_flooded", large_cave_flooded);
settings->setFloat("mgv7_float_mount_density", float_mount_density);
settings->setFloat("mgv7_float_mount_height", float_mount_height);
settings->setFloat("mgv7_float_mount_exponent", float_mount_exponent);

@ -46,6 +46,11 @@ struct MapgenV7Params : public MapgenParams {
float cave_width = 0.09f;
s16 large_cave_depth = -33;
s16 lava_depth = -256;
u16 small_cave_num_min = 0;
u16 small_cave_num_max = 0;
u16 large_cave_num_min = 0;
u16 large_cave_num_max = 2;
float large_cave_flooded = 0.5f;
s16 cavern_limit = -256;
s16 cavern_taper = 256;
float cavern_threshold = 0.7f;

@ -68,6 +68,11 @@ MapgenValleys::MapgenValleys(MapgenValleysParams *params, EmergeManager *emerge)
cave_width = params->cave_width;
large_cave_depth = params->large_cave_depth;
lava_depth = params->lava_depth;
small_cave_num_min = params->small_cave_num_min;
small_cave_num_max = params->small_cave_num_max;
large_cave_num_min = params->large_cave_num_min;
large_cave_num_max = params->large_cave_num_max;
large_cave_flooded = params->large_cave_flooded;
cavern_limit = params->cavern_limit;
cavern_taper = params->cavern_taper;
cavern_threshold = params->cavern_threshold;
@ -124,18 +129,23 @@ MapgenValleysParams::MapgenValleysParams():
void MapgenValleysParams::readParams(const Settings *settings)
{
settings->getFlagStrNoEx("mgvalleys_spflags", spflags, flagdesc_mapgen_valleys);
settings->getU16NoEx("mgvalleys_altitude_chill", altitude_chill);
settings->getS16NoEx("mgvalleys_large_cave_depth", large_cave_depth);
settings->getS16NoEx("mgvalleys_lava_depth", lava_depth);
settings->getU16NoEx("mgvalleys_river_depth", river_depth);
settings->getU16NoEx("mgvalleys_river_size", river_size);
settings->getFloatNoEx("mgvalleys_cave_width", cave_width);
settings->getS16NoEx("mgvalleys_cavern_limit", cavern_limit);
settings->getS16NoEx("mgvalleys_cavern_taper", cavern_taper);
settings->getFloatNoEx("mgvalleys_cavern_threshold", cavern_threshold);
settings->getS16NoEx("mgvalleys_dungeon_ymin", dungeon_ymin);
settings->getS16NoEx("mgvalleys_dungeon_ymax", dungeon_ymax);
settings->getFlagStrNoEx("mgvalleys_spflags", spflags, flagdesc_mapgen_valleys);
settings->getU16NoEx("mgvalleys_altitude_chill", altitude_chill);
settings->getS16NoEx("mgvalleys_large_cave_depth", large_cave_depth);
settings->getS16NoEx("mgvalleys_lava_depth", lava_depth);
settings->getU16NoEx("mgvalleys_small_cave_num_min", small_cave_num_min);
settings->getU16NoEx("mgvalleys_small_cave_num_max", small_cave_num_max);
settings->getU16NoEx("mgvalleys_large_cave_num_min", large_cave_num_min);
settings->getU16NoEx("mgvalleys_large_cave_num_max", large_cave_num_max);
settings->getFloatNoEx("mgvalleys_large_cave_flooded", large_cave_flooded);
settings->getU16NoEx("mgvalleys_river_depth", river_depth);
settings->getU16NoEx("mgvalleys_river_size", river_size);
settings->getFloatNoEx("mgvalleys_cave_width", cave_width);
settings->getS16NoEx("mgvalleys_cavern_limit", cavern_limit);
settings->getS16NoEx("mgvalleys_cavern_taper", cavern_taper);
settings->getFloatNoEx("mgvalleys_cavern_threshold", cavern_threshold);
settings->getS16NoEx("mgvalleys_dungeon_ymin", dungeon_ymin);
settings->getS16NoEx("mgvalleys_dungeon_ymax", dungeon_ymax);
settings->getNoiseParams("mgvalleys_np_filler_depth", np_filler_depth);
settings->getNoiseParams("mgvalleys_np_inter_valley_fill", np_inter_valley_fill);
@ -154,18 +164,23 @@ void MapgenValleysParams::readParams(const Settings *settings)
void MapgenValleysParams::writeParams(Settings *settings) const
{
settings->setFlagStr("mgvalleys_spflags", spflags, flagdesc_mapgen_valleys, U32_MAX);
settings->setU16("mgvalleys_altitude_chill", altitude_chill);
settings->setS16("mgvalleys_large_cave_depth", large_cave_depth);
settings->setS16("mgvalleys_lava_depth", lava_depth);
settings->setU16("mgvalleys_river_depth", river_depth);
settings->setU16("mgvalleys_river_size", river_size);
settings->setFloat("mgvalleys_cave_width", cave_width);
settings->setS16("mgvalleys_cavern_limit", cavern_limit);
settings->setS16("mgvalleys_cavern_taper", cavern_taper);
settings->setFloat("mgvalleys_cavern_threshold", cavern_threshold);
settings->setS16("mgvalleys_dungeon_ymin", dungeon_ymin);
settings->setS16("mgvalleys_dungeon_ymax", dungeon_ymax);
settings->setFlagStr("mgvalleys_spflags", spflags, flagdesc_mapgen_valleys, U32_MAX);
settings->setU16("mgvalleys_altitude_chill", altitude_chill);
settings->setS16("mgvalleys_large_cave_depth", large_cave_depth);
settings->setS16("mgvalleys_lava_depth", lava_depth);
settings->setU16("mgvalleys_small_cave_num_min", small_cave_num_min);
settings->setU16("mgvalleys_small_cave_num_max", small_cave_num_max);
settings->setU16("mgvalleys_large_cave_num_min", large_cave_num_min);
settings->setU16("mgvalleys_large_cave_num_max", large_cave_num_max);
settings->setFloat("mgvalleys_large_cave_flooded", large_cave_flooded);
settings->setU16("mgvalleys_river_depth", river_depth);
settings->setU16("mgvalleys_river_size", river_size);
settings->setFloat("mgvalleys_cave_width", cave_width);
settings->setS16("mgvalleys_cavern_limit", cavern_limit);
settings->setS16("mgvalleys_cavern_taper", cavern_taper);
settings->setFloat("mgvalleys_cavern_threshold", cavern_threshold);
settings->setS16("mgvalleys_dungeon_ymin", dungeon_ymin);
settings->setS16("mgvalleys_dungeon_ymax", dungeon_ymax);
settings->setNoiseParams("mgvalleys_np_filler_depth", np_filler_depth);
settings->setNoiseParams("mgvalleys_np_inter_valley_fill", np_inter_valley_fill);

@ -50,6 +50,11 @@ struct MapgenValleysParams : public MapgenParams {
float cave_width = 0.09f;
s16 large_cave_depth = -33;
s16 lava_depth = 1;
u16 small_cave_num_min = 0;
u16 small_cave_num_max = 0;
u16 large_cave_num_min = 0;
u16 large_cave_num_max = 2;
float large_cave_flooded = 0.5f;
s16 cavern_limit = -256;
s16 cavern_taper = 192;
float cavern_threshold = 0.6f;