Mapgen: Make 3D noise tunnels' width settable

Correct parameter names mg_valleys to mgvalleys
Remove biome NoiseParams from MapgenValleysParams
Improve format of parameter code
This commit is contained in:
paramat 2016-04-25 11:47:25 +01:00 committed by kwolekr
parent 46fd114e9a
commit 8b1f8e99cf
12 changed files with 244 additions and 205 deletions

@ -886,6 +886,9 @@ mg_biome_np_humidity_blend (Mapgen biome humidity blend noise parameters) noise_
[***Mapgen v5] [***Mapgen v5]
# Controls width of tunnels, a smaller value creates wider tunnels.
mgv5_cave_width (Mapgen v5 cave width) float 0.125
mgv5_np_filler_depth (Mapgen v5 filler depth noise parameters) noise_params 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0 mgv5_np_filler_depth (Mapgen v5 filler depth noise parameters) noise_params 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0
mgv5_np_factor (Mapgen v5 factor noise parameters) noise_params 0, 1, (250, 250, 250), 920381, 3, 0.45, 2.0 mgv5_np_factor (Mapgen v5 factor noise parameters) noise_params 0, 1, (250, 250, 250), 920381, 3, 0.45, 2.0
mgv5_np_height (Mapgen v5 height noise parameters) noise_params 0, 10, (250, 250, 250), 84174, 4, 0.5, 2.0 mgv5_np_height (Mapgen v5 height noise parameters) noise_params 0, 10, (250, 250, 250), 84174, 4, 0.5, 2.0
@ -940,6 +943,9 @@ mgv6_np_apple_trees (Mapgen v6 apple trees noise parameters) noise_params 0, 1,
# Flags starting with 'no' are used to explicitly disable them. # Flags starting with 'no' are used to explicitly disable them.
mgv7_spflags (Mapgen v7 flags) flags mountains,ridges mountains,ridges,nomountains,noridges mgv7_spflags (Mapgen v7 flags) flags mountains,ridges mountains,ridges,nomountains,noridges
# Controls width of tunnels, a smaller value creates wider tunnels.
mgv7_cave_width (Mapgen v7 cave width) float 0.3
mgv7_np_terrain_base (Mapgen v7 terrain base noise parameters) noise_params 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0 mgv7_np_terrain_base (Mapgen v7 terrain base noise parameters) noise_params 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0
mgv7_np_terrain_alt (Mapgen v7 terrain altitude noise parameters) noise_params 4, 25, (600, 600, 600), 5934, 5, 0.6, 2.0 mgv7_np_terrain_alt (Mapgen v7 terrain altitude noise parameters) noise_params 4, 25, (600, 600, 600), 5934, 5, 0.6, 2.0
mgv7_np_terrain_persist (Mapgen v7 terrain persistation noise parameters) noise_params 0.6, 0.1, (2000, 2000, 2000), 539, 3, 0.6, 2.0 mgv7_np_terrain_persist (Mapgen v7 terrain persistation noise parameters) noise_params 0.6, 0.1, (2000, 2000, 2000), 539, 3, 0.6, 2.0
@ -968,6 +974,9 @@ mgflat_ground_level (Mapgen flat ground level) int 8
# Y of upper limit of large pseudorandom caves. # Y of upper limit of large pseudorandom caves.
mgflat_large_cave_depth (Mapgen flat large cave depth) int -33 mgflat_large_cave_depth (Mapgen flat large cave depth) int -33
# Controls width of tunnels, a smaller value creates wider tunnels.
mgflat_cave_width (Mapgen flat cave width) float 0.3
# Terrain noise threshold for lakes. # Terrain noise threshold for lakes.
# Controls proportion of world area covered by lakes. # Controls proportion of world area covered by lakes.
# Adjust towards 0.0 for a larger proportion. # Adjust towards 0.0 for a larger proportion.
@ -995,6 +1004,9 @@ mgflat_np_cave2 (Mapgen flat cave2 noise parameters) noise_params 0, 12, (128, 1
[***Mapgen fractal] [***Mapgen fractal]
# Controls width of tunnels, a smaller value creates wider tunnels.
mgfractal_cave_width (Mapgen fractal cave width) float 0.3
# Choice of 18 fractals from 9 formulas. # Choice of 18 fractals from 9 formulas.
# 1 = 4D "Roundy" mandelbrot set. # 1 = 4D "Roundy" mandelbrot set.
# 2 = 4D "Roundy" julia set. # 2 = 4D "Roundy" julia set.
@ -1074,60 +1086,63 @@ mgfractal_np_cave2 (Mapgen fractal cave2 noise parameters) noise_params 0, 12, (
mg_valleys_spflags (Valleys C Flags) flags altitude_chill,humid_rivers altitude_chill,noaltitude_chill,humid_rivers,nohumid_rivers mg_valleys_spflags (Valleys C Flags) flags altitude_chill,humid_rivers altitude_chill,noaltitude_chill,humid_rivers,nohumid_rivers
# The altitude at which temperature drops by 20C # The altitude at which temperature drops by 20C
mg_valleys_altitude_chill (Altitude Chill) int 90 mgvalleys_altitude_chill (Altitude Chill) int 90
# Depth below which you'll find large caves. # Depth below which you'll find large caves.
mg_valleys_large_cave_depth (Large cave depth) int -33 mgvalleys_large_cave_depth (Large cave depth) int -33
# Creates unpredictable lava features in caves. # Creates unpredictable lava features in caves.
# These can make mining difficult. Zero disables them. (0-10) # These can make mining difficult. Zero disables them. (0-10)
mg_valleys_lava_features (Lava Features) int 0 mgvalleys_lava_features (Lava Features) int 0
# Depth below which you'll find massive caves. # Depth below which you'll find massive caves.
mg_valleys_massive_cave_depth (Massive cave depth) int -256 mgvalleys_massive_cave_depth (Massive cave depth) int -256
# How deep to make rivers # How deep to make rivers
mg_valleys_river_depth (River Depth) int 4 mgvalleys_river_depth (River Depth) int 4
# How wide to make rivers # How wide to make rivers
mg_valleys_river_size (River Size) int 5 mgvalleys_river_size (River Size) int 5
# Creates unpredictable water features in caves. # Creates unpredictable water features in caves.
# These can make mining difficult. Zero disables them. (0-10) # These can make mining difficult. Zero disables them. (0-10)
mg_valleys_water_features (Water Features) int 0 mgvalleys_water_features (Water Features) int 0
# Controls width of tunnels, a smaller value creates wider tunnels.
mgvalleys_cave_width (Cave width) float 0.3
# Noise parameters # Noise parameters
[****Noises] [****Noises]
# Caves and tunnels form at the intersection of the two noises # Caves and tunnels form at the intersection of the two noises
mg_valleys_np_cave1 (Cave noise #1) noise_params 0, 12, (100, 100, 100), 52534, 4, 0.5, 2.0 mgvalleys_np_cave1 (Cave noise #1) noise_params 0, 12, (100, 100, 100), 52534, 4, 0.5, 2.0
# Caves and tunnels form at the intersection of the two noises # Caves and tunnels form at the intersection of the two noises
mg_valleys_np_cave2 (Cave noise #2) noise_params 0, 12, (100, 100, 100), 10325, 4, 0.5, 2.0 mgvalleys_np_cave2 (Cave noise #2) noise_params 0, 12, (100, 100, 100), 10325, 4, 0.5, 2.0
# The depth of dirt or other filler # The depth of dirt or other filler
mg_valleys_np_filler_depth (Filler Depth) noise_params 0, 1.2, (256, 256, 256), 1605, 3, 0.5, 2.0 mgvalleys_np_filler_depth (Filler Depth) noise_params 0, 1.2, (256, 256, 256), 1605, 3, 0.5, 2.0
# Massive caves form here. # Massive caves form here.
mg_valleys_np_massive_caves (Massive cave noise) noise_params 0, 1, (768, 256, 768), 59033, 6, 0.63, 2.0 mgvalleys_np_massive_caves (Massive cave noise) noise_params 0, 1, (768, 256, 768), 59033, 6, 0.63, 2.0
# River noise -- rivers occur close to zero # River noise -- rivers occur close to zero
mg_valleys_np_rivers (River Noise) noise_params 0, 1, (256, 256, 256), -6050, 5, 0.6, 2.0 mgvalleys_np_rivers (River Noise) noise_params 0, 1, (256, 256, 256), -6050, 5, 0.6, 2.0
# Base terrain height # Base terrain height
mg_valleys_np_terrain_height (Terrain Height) noise_params -10, 50, (1024, 1024, 1024), 5202, 6, 0.4, 2.0 mgvalleys_np_terrain_height (Terrain Height) noise_params -10, 50, (1024, 1024, 1024), 5202, 6, 0.4, 2.0
# Raises terrain to make valleys around the rivers # Raises terrain to make valleys around the rivers
mg_valleys_np_valley_depth (Valley Depth) noise_params 5, 4, (512, 512, 512), -1914, 1, 1.0, 2.0 mgvalleys_np_valley_depth (Valley Depth) noise_params 5, 4, (512, 512, 512), -1914, 1, 1.0, 2.0
# Slope and fill work together to modify the heights # Slope and fill work together to modify the heights
mg_valleys_np_inter_valley_fill (Valley Fill) noise_params 0, 1, (256, 512, 256), 1993, 6, 0.8, 2.0 mgvalleys_np_inter_valley_fill (Valley Fill) noise_params 0, 1, (256, 512, 256), 1993, 6, 0.8, 2.0
# Amplifies the valleys # Amplifies the valleys
mg_valleys_np_valley_profile (Valley Profile) noise_params 0.6, 0.5, (512, 512, 512), 777, 1, 1.0, 2.0 mgvalleys_np_valley_profile (Valley Profile) noise_params 0.6, 0.5, (512, 512, 512), 777, 1, 1.0, 2.0
# Slope and fill work together to modify the heights # Slope and fill work together to modify the heights
mg_valleys_np_inter_valley_slope (Valley Slope) noise_params 0.5, 0.5, (128, 128, 128), 746, 1, 1.0, 2.0 mgvalleys_np_inter_valley_slope (Valley Slope) noise_params 0.5, 0.5, (128, 128, 128), 746, 1, 1.0, 2.0
[*Security] [*Security]

@ -1098,6 +1098,10 @@
#### Mapgen v5 #### Mapgen v5
# Controls width of tunnels, a smaller value creates wider tunnels.
# type: float
# mgv5_cave_width = 0.125
# type: noise_params # type: noise_params
# mgv5_np_filler_depth = 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0 # mgv5_np_filler_depth = 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0
@ -1176,6 +1180,10 @@
# type: flags possible values: mountains, ridges, nomountains, noridges # type: flags possible values: mountains, ridges, nomountains, noridges
# mgv7_spflags = mountains,ridges # mgv7_spflags = mountains,ridges
# Controls width of tunnels, a smaller value creates wider tunnels.
# type: float
# mgv7_cave_width = 0.3
# type: noise_params # type: noise_params
# mgv7_np_terrain_base = 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0 # mgv7_np_terrain_base = 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0
@ -1228,6 +1236,10 @@
# type: int # type: int
# mgflat_large_cave_depth = -33 # mgflat_large_cave_depth = -33
# Controls width of tunnels, a smaller value creates wider tunnels.
# type: float
# mgflat_cave_width = 0.3
# Terrain noise threshold for lakes. # Terrain noise threshold for lakes.
# Controls proportion of world area covered by lakes. # Controls proportion of world area covered by lakes.
# Adjust towards 0.0 for a larger proportion. # Adjust towards 0.0 for a larger proportion.
@ -1265,6 +1277,10 @@
#### Mapgen fractal #### Mapgen fractal
# Controls width of tunnels, a smaller value creates wider tunnels.
# type: float
# mgfractal_cave_width = 0.3
# Choice of 18 fractals from 9 formulas. # Choice of 18 fractals from 9 formulas.
# 1 = 4D "Roundy" mandelbrot set. # 1 = 4D "Roundy" mandelbrot set.
# 2 = 4D "Roundy" julia set. # 2 = 4D "Roundy" julia set.
@ -1356,79 +1372,83 @@
# Flags that are not specified in the flag string are not modified from the default. # Flags that are not specified in the flag string are not modified from the default.
# Flags starting with 'no' are used to explicitly disable them. # Flags starting with 'no' are used to explicitly disable them.
# type: flags possible values: altitude_chill, noaltitude_chill, humid_rivers, nohumid_rivers # type: flags possible values: altitude_chill, noaltitude_chill, humid_rivers, nohumid_rivers
# mg_valleys_spflags = altitude_chill,humid_rivers # mgvalleys_spflags = altitude_chill,humid_rivers
# The altitude at which temperature drops by 20C # The altitude at which temperature drops by 20C
# type: int # type: int
# mg_valleys_altitude_chill = 90 # mgvalleys_altitude_chill = 90
# Depth below which you'll find large caves. # Depth below which you'll find large caves.
# type: int # type: int
# mg_valleys_large_cave_depth = -33 # mgvalleys_large_cave_depth = -33
# Creates unpredictable lava features in caves. # Creates unpredictable lava features in caves.
# These can make mining difficult. Zero disables them. (0-10) # These can make mining difficult. Zero disables them. (0-10)
# type: int # type: int
# mg_valleys_lava_features = 0 # mgvalleys_lava_features = 0
# Depth below which you'll find massive caves. # Depth below which you'll find massive caves.
# type: int # type: int
# mg_valleys_massive_cave_depth = -256 # mgvalleys_massive_cave_depth = -256
# How deep to make rivers # How deep to make rivers
# type: int # type: int
# mg_valleys_river_depth = 4 # mgvalleys_river_depth = 4
# How wide to make rivers # How wide to make rivers
# type: int # type: int
# mg_valleys_river_size = 5 # mgvalleys_river_size = 5
# Creates unpredictable water features in caves. # Creates unpredictable water features in caves.
# These can make mining difficult. Zero disables them. (0-10) # These can make mining difficult. Zero disables them. (0-10)
# type: int # type: int
# mg_valleys_water_features = 0 # mgvalleys_water_features = 0
# Controls width of tunnels, a smaller value creates wider tunnels.
# type: float
# mgvalleys_cave_width = 0.3
##### Noises ##### Noises
# Caves and tunnels form at the intersection of the two noises # Caves and tunnels form at the intersection of the two noises
# type: noise_params # type: noise_params
# mg_valleys_np_cave1 = 0, 12, (100, 100, 100), 52534, 4, 0.5, 2.0 # mgvalleys_np_cave1 = 0, 12, (100, 100, 100), 52534, 4, 0.5, 2.0
# Caves and tunnels form at the intersection of the two noises # Caves and tunnels form at the intersection of the two noises
# type: noise_params # type: noise_params
# mg_valleys_np_cave2 = 0, 12, (100, 100, 100), 10325, 4, 0.5, 2.0 # mgvalleys_np_cave2 = 0, 12, (100, 100, 100), 10325, 4, 0.5, 2.0
# The depth of dirt or other filler # The depth of dirt or other filler
# type: noise_params # type: noise_params
# mg_valleys_np_filler_depth = 0, 1.2, (256, 256, 256), 1605, 3, 0.5, 2.0 # mgvalleys_np_filler_depth = 0, 1.2, (256, 256, 256), 1605, 3, 0.5, 2.0
# Massive caves form here. # Massive caves form here.
# type: noise_params # type: noise_params
# mg_valleys_np_massive_caves = 0, 1, (768, 256, 768), 59033, 6, 0.63, 2.0 # mgvalleys_np_massive_caves = 0, 1, (768, 256, 768), 59033, 6, 0.63, 2.0
# River noise -- rivers occur close to zero # River noise -- rivers occur close to zero
# type: noise_params # type: noise_params
# mg_valleys_np_rivers = 0, 1, (256, 256, 256), -6050, 5, 0.6, 2.0 # mgvalleys_np_rivers = 0, 1, (256, 256, 256), -6050, 5, 0.6, 2.0
# Base terrain height # Base terrain height
# type: noise_params # type: noise_params
# mg_valleys_np_terrain_height = -10, 50, (1024, 1024, 1024), 5202, 6, 0.4, 2.0 # mgvalleys_np_terrain_height = -10, 50, (1024, 1024, 1024), 5202, 6, 0.4, 2.0
# Raises terrain to make valleys around the rivers # Raises terrain to make valleys around the rivers
# type: noise_params # type: noise_params
# mg_valleys_np_valley_depth = 5, 4, (512, 512, 512), -1914, 1, 1.0, 2.0 # mgvalleys_np_valley_depth = 5, 4, (512, 512, 512), -1914, 1, 1.0, 2.0
# Slope and fill work together to modify the heights # Slope and fill work together to modify the heights
# type: noise_params # type: noise_params
# mg_valleys_np_inter_valley_fill = 0, 1, (256, 512, 256), 1993, 6, 0.8, 2.0 # mgvalleys_np_inter_valley_fill = 0, 1, (256, 512, 256), 1993, 6, 0.8, 2.0
# Amplifies the valleys # Amplifies the valleys
# type: noise_params # type: noise_params
# mg_valleys_np_valley_profile = 0.6, 0.5, (512, 512, 512), 777, 1, 1.0, 2.0 # mgvalleys_np_valley_profile = 0.6, 0.5, (512, 512, 512), 777, 1, 1.0, 2.0
# Slope and fill work together to modify the heights # Slope and fill work together to modify the heights
# type: noise_params # type: noise_params
# mg_valleys_np_inter_valley_slope = 0.5, 0.5, (128, 128, 128), 746, 1, 1.0, 2.0 # mgvalleys_np_inter_valley_slope = 0.5, 0.5, (128, 128, 128), 746, 1, 1.0, 2.0
## Security ## Security

@ -67,14 +67,15 @@ MapgenFlat::MapgenFlat(int mapgenid, MapgenParams *params, EmergeManager *emerge
this->humidmap = NULL; this->humidmap = NULL;
MapgenFlatParams *sp = (MapgenFlatParams *)params->sparams; MapgenFlatParams *sp = (MapgenFlatParams *)params->sparams;
this->spflags = sp->spflags;
this->ground_level = sp->ground_level; this->spflags = sp->spflags;
this->ground_level = sp->ground_level;
this->large_cave_depth = sp->large_cave_depth; this->large_cave_depth = sp->large_cave_depth;
this->lake_threshold = sp->lake_threshold; this->cave_width = sp->cave_width;
this->lake_steepness = sp->lake_steepness; this->lake_threshold = sp->lake_threshold;
this->hill_threshold = sp->hill_threshold; this->lake_steepness = sp->lake_steepness;
this->hill_steepness = sp->hill_steepness; this->hill_threshold = sp->hill_threshold;
this->hill_steepness = sp->hill_steepness;
//// 2D noise //// 2D noise
noise_terrain = new Noise(&sp->np_terrain, seed, csize.X, csize.Z); noise_terrain = new Noise(&sp->np_terrain, seed, csize.X, csize.Z);
@ -139,14 +140,14 @@ MapgenFlat::~MapgenFlat()
MapgenFlatParams::MapgenFlatParams() MapgenFlatParams::MapgenFlatParams()
{ {
spflags = 0; spflags = 0;
ground_level = 8;
ground_level = 8;
large_cave_depth = -33; large_cave_depth = -33;
lake_threshold = -0.45; cave_width = 0.3;
lake_steepness = 48.0; lake_threshold = -0.45;
hill_threshold = 0.45; lake_steepness = 48.0;
hill_steepness = 64.0; hill_threshold = 0.45;
hill_steepness = 64.0;
np_terrain = NoiseParams(0, 1, v3f(600, 600, 600), 7244, 5, 0.6, 2.0); np_terrain = NoiseParams(0, 1, v3f(600, 600, 600), 7244, 5, 0.6, 2.0);
np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0); np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0);
@ -157,10 +158,10 @@ MapgenFlatParams::MapgenFlatParams()
void MapgenFlatParams::readParams(const Settings *settings) void MapgenFlatParams::readParams(const Settings *settings)
{ {
settings->getFlagStrNoEx("mgflat_spflags", spflags, flagdesc_mapgen_flat); settings->getFlagStrNoEx("mgflat_spflags", spflags, flagdesc_mapgen_flat);
settings->getS16NoEx("mgflat_ground_level", ground_level); settings->getS16NoEx("mgflat_ground_level", ground_level);
settings->getS16NoEx("mgflat_large_cave_depth", large_cave_depth); settings->getS16NoEx("mgflat_large_cave_depth", large_cave_depth);
settings->getFloatNoEx("mgflat_cave_width", cave_width);
settings->getFloatNoEx("mgflat_lake_threshold", lake_threshold); settings->getFloatNoEx("mgflat_lake_threshold", lake_threshold);
settings->getFloatNoEx("mgflat_lake_steepness", lake_steepness); settings->getFloatNoEx("mgflat_lake_steepness", lake_steepness);
settings->getFloatNoEx("mgflat_hill_threshold", hill_threshold); settings->getFloatNoEx("mgflat_hill_threshold", hill_threshold);
@ -175,10 +176,10 @@ void MapgenFlatParams::readParams(const Settings *settings)
void MapgenFlatParams::writeParams(Settings *settings) const void MapgenFlatParams::writeParams(Settings *settings) const
{ {
settings->setFlagStr("mgflat_spflags", spflags, flagdesc_mapgen_flat, U32_MAX); settings->setFlagStr("mgflat_spflags", spflags, flagdesc_mapgen_flat, U32_MAX);
settings->setS16("mgflat_ground_level", ground_level); settings->setS16("mgflat_ground_level", ground_level);
settings->setS16("mgflat_large_cave_depth", large_cave_depth); settings->setS16("mgflat_large_cave_depth", large_cave_depth);
settings->setFloat("mgflat_cave_width", cave_width);
settings->setFloat("mgflat_lake_threshold", lake_threshold); settings->setFloat("mgflat_lake_threshold", lake_threshold);
settings->setFloat("mgflat_lake_steepness", lake_steepness); settings->setFloat("mgflat_lake_steepness", lake_steepness);
settings->setFloat("mgflat_hill_threshold", hill_threshold); settings->setFloat("mgflat_hill_threshold", hill_threshold);
@ -592,7 +593,7 @@ void MapgenFlat::generateCaves(s16 max_stone_y)
float d1 = contour(noise_cave1->result[index3d]); float d1 = contour(noise_cave1->result[index3d]);
float d2 = contour(noise_cave2->result[index3d]); float d2 = contour(noise_cave2->result[index3d]);
if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) { if (d1 * d2 > cave_width && ndef->get(c).is_ground_content) {
// In tunnel and ground content, excavate // In tunnel and ground content, excavate
vm->m_data[vi] = MapNode(CONTENT_AIR); vm->m_data[vi] = MapNode(CONTENT_AIR);
is_tunnel = true; is_tunnel = true;

@ -34,14 +34,13 @@ extern FlagDesc flagdesc_mapgen_flat[];
struct MapgenFlatParams : public MapgenSpecificParams { struct MapgenFlatParams : public MapgenSpecificParams {
u32 spflags; u32 spflags;
s16 ground_level; s16 ground_level;
s16 large_cave_depth; s16 large_cave_depth;
float cave_width;
float lake_threshold; float lake_threshold;
float lake_steepness; float lake_steepness;
float hill_threshold; float hill_threshold;
float hill_steepness; float hill_steepness;
NoiseParams np_terrain; NoiseParams np_terrain;
NoiseParams np_filler_depth; NoiseParams np_filler_depth;
NoiseParams np_cave1; NoiseParams np_cave1;
@ -61,20 +60,20 @@ public:
int ystride; int ystride;
int zstride_1d; int zstride_1d;
u32 spflags;
v3s16 node_min; v3s16 node_min;
v3s16 node_max; v3s16 node_max;
v3s16 full_node_min; v3s16 full_node_min;
v3s16 full_node_max; v3s16 full_node_max;
u32 spflags;
s16 ground_level; s16 ground_level;
s16 large_cave_depth; s16 large_cave_depth;
float cave_width;
float lake_threshold; float lake_threshold;
float lake_steepness; float lake_steepness;
float hill_threshold; float hill_threshold;
float hill_steepness; float hill_steepness;
Noise *noise_terrain; Noise *noise_terrain;
Noise *noise_filler_depth; Noise *noise_filler_depth;
Noise *noise_cave1; Noise *noise_cave1;

@ -65,21 +65,18 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *
this->humidmap = NULL; this->humidmap = NULL;
MapgenFractalParams *sp = (MapgenFractalParams *)params->sparams; MapgenFractalParams *sp = (MapgenFractalParams *)params->sparams;
this->spflags = sp->spflags;
this->spflags = sp->spflags;
this->cave_width = sp->cave_width;
this->fractal = sp->fractal; this->fractal = sp->fractal;
this->iterations = sp->iterations; this->iterations = sp->iterations;
this->scale = sp->scale; this->scale = sp->scale;
this->offset = sp->offset; this->offset = sp->offset;
this->slice_w = sp->slice_w; this->slice_w = sp->slice_w;
this->julia_x = sp->julia_x;
this->julia_x = sp->julia_x; this->julia_y = sp->julia_y;
this->julia_y = sp->julia_y; this->julia_z = sp->julia_z;
this->julia_z = sp->julia_z; this->julia_w = sp->julia_w;
this->julia_w = sp->julia_w;
this->formula = fractal / 2 + fractal % 2;
this->julia = fractal % 2 == 0;
//// 2D terrain noise //// 2D terrain noise
noise_seabed = new Noise(&sp->np_seabed, seed, csize.X, csize.Z); noise_seabed = new Noise(&sp->np_seabed, seed, csize.X, csize.Z);
@ -96,6 +93,9 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *
noise_heat_blend = new Noise(&params->np_biome_heat_blend, seed, csize.X, csize.Z); noise_heat_blend = new Noise(&params->np_biome_heat_blend, seed, csize.X, csize.Z);
noise_humidity_blend = new Noise(&params->np_biome_humidity_blend, seed, csize.X, csize.Z); noise_humidity_blend = new Noise(&params->np_biome_humidity_blend, seed, csize.X, csize.Z);
this->formula = fractal / 2 + fractal % 2;
this->julia = fractal % 2 == 0;
//// Resolve nodes to be used //// Resolve nodes to be used
INodeDefManager *ndef = emerge->ndef; INodeDefManager *ndef = emerge->ndef;
@ -144,18 +144,17 @@ MapgenFractal::~MapgenFractal()
MapgenFractalParams::MapgenFractalParams() MapgenFractalParams::MapgenFractalParams()
{ {
spflags = 0; spflags = 0;
cave_width = 0.3;
fractal = 1; fractal = 1;
iterations = 11; iterations = 11;
scale = v3f(4096.0, 1024.0, 4096.0); scale = v3f(4096.0, 1024.0, 4096.0);
offset = v3f(1.79, 0.0, 0.0); offset = v3f(1.79, 0.0, 0.0);
slice_w = 0.0; slice_w = 0.0;
julia_x = 0.33;
julia_x = 0.33; julia_y = 0.33;
julia_y = 0.33; julia_z = 0.33;
julia_z = 0.33; julia_w = 0.33;
julia_w = 0.33;
np_seabed = NoiseParams(-14, 9, v3f(600, 600, 600), 41900, 5, 0.6, 2.0); np_seabed = NoiseParams(-14, 9, v3f(600, 600, 600), 41900, 5, 0.6, 2.0);
np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0); np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0);
@ -166,45 +165,43 @@ MapgenFractalParams::MapgenFractalParams()
void MapgenFractalParams::readParams(const Settings *settings) void MapgenFractalParams::readParams(const Settings *settings)
{ {
settings->getFlagStrNoEx("mgfractal_spflags", spflags, flagdesc_mapgen_fractal); settings->getFlagStrNoEx("mgfractal_spflags", spflags, flagdesc_mapgen_fractal);
settings->getFloatNoEx("mgfractal_cave_width", cave_width);
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->getU16NoEx("mgfractal_fractal", fractal); settings->getNoiseParams("mgfractal_np_seabed", np_seabed);
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); settings->getNoiseParams("mgfractal_np_filler_depth", np_filler_depth);
settings->getNoiseParams("mgfractal_np_cave1", np_cave1); settings->getNoiseParams("mgfractal_np_cave1", np_cave1);
settings->getNoiseParams("mgfractal_np_cave2", np_cave2); settings->getNoiseParams("mgfractal_np_cave2", np_cave2);
} }
void MapgenFractalParams::writeParams(Settings *settings) const void MapgenFractalParams::writeParams(Settings *settings) const
{ {
settings->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal, U32_MAX); settings->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal, U32_MAX);
settings->setFloat("mgfractal_cave_width", cave_width);
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->setU16("mgfractal_fractal", fractal); settings->setNoiseParams("mgfractal_np_seabed", np_seabed);
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); settings->setNoiseParams("mgfractal_np_filler_depth", np_filler_depth);
settings->setNoiseParams("mgfractal_np_cave1", np_cave1); settings->setNoiseParams("mgfractal_np_cave1", np_cave1);
settings->setNoiseParams("mgfractal_np_cave2", np_cave2); settings->setNoiseParams("mgfractal_np_cave2", np_cave2);
} }
@ -720,7 +717,7 @@ void MapgenFractal::generateCaves(s16 max_stone_y)
float d1 = contour(noise_cave1->result[index3d]); float d1 = contour(noise_cave1->result[index3d]);
float d2 = contour(noise_cave2->result[index3d]); float d2 = contour(noise_cave2->result[index3d]);
if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) { if (d1 * d2 > cave_width && ndef->get(c).is_ground_content) {
// In tunnel and ground content, excavate // In tunnel and ground content, excavate
vm->m_data[vi] = MapNode(CONTENT_AIR); vm->m_data[vi] = MapNode(CONTENT_AIR);
is_tunnel = true; is_tunnel = true;

@ -35,18 +35,16 @@ extern FlagDesc flagdesc_mapgen_fractal[];
struct MapgenFractalParams : public MapgenSpecificParams { struct MapgenFractalParams : public MapgenSpecificParams {
u32 spflags; u32 spflags;
float cave_width;
u16 fractal; u16 fractal;
u16 iterations; u16 iterations;
v3f scale; v3f scale;
v3f offset; v3f offset;
float slice_w; float slice_w;
float julia_x; float julia_x;
float julia_y; float julia_y;
float julia_z; float julia_z;
float julia_w; float julia_w;
NoiseParams np_seabed; NoiseParams np_seabed;
NoiseParams np_filler_depth; NoiseParams np_filler_depth;
NoiseParams np_cave1; NoiseParams np_cave1;
@ -75,18 +73,16 @@ public:
v3s16 full_node_max; v3s16 full_node_max;
u32 spflags; u32 spflags;
float cave_width;
u16 fractal; u16 fractal;
u16 iterations; u16 iterations;
v3f scale; v3f scale;
v3f offset; v3f offset;
float slice_w; float slice_w;
float julia_x; float julia_x;
float julia_y; float julia_y;
float julia_z; float julia_z;
float julia_w; float julia_w;
Noise *noise_seabed; Noise *noise_seabed;
Noise *noise_filler_depth; Noise *noise_filler_depth;
Noise *noise_cave1; Noise *noise_cave1;

@ -63,7 +63,9 @@ MapgenV5::MapgenV5(int mapgenid, MapgenParams *params, EmergeManager *emerge)
this->humidmap = NULL; this->humidmap = NULL;
MapgenV5Params *sp = (MapgenV5Params *)params->sparams; MapgenV5Params *sp = (MapgenV5Params *)params->sparams;
this->spflags = sp->spflags;
this->spflags = sp->spflags;
this->cave_width = sp->cave_width;
// Terrain noise // Terrain noise
noise_filler_depth = new Noise(&sp->np_filler_depth, seed, csize.X, csize.Z); noise_filler_depth = new Noise(&sp->np_filler_depth, seed, csize.X, csize.Z);
@ -133,7 +135,8 @@ MapgenV5::~MapgenV5()
MapgenV5Params::MapgenV5Params() MapgenV5Params::MapgenV5Params()
{ {
spflags = 0; spflags = 0;
cave_width = 0.125;
np_filler_depth = NoiseParams(0, 1, v3f(150, 150, 150), 261, 4, 0.7, 2.0); np_filler_depth = NoiseParams(0, 1, v3f(150, 150, 150), 261, 4, 0.7, 2.0);
np_factor = NoiseParams(0, 1, v3f(250, 250, 250), 920381, 3, 0.45, 2.0); np_factor = NoiseParams(0, 1, v3f(250, 250, 250), 920381, 3, 0.45, 2.0);
@ -150,7 +153,8 @@ MapgenV5Params::MapgenV5Params()
void MapgenV5Params::readParams(const Settings *settings) void MapgenV5Params::readParams(const Settings *settings)
{ {
settings->getFlagStrNoEx("mgv5_spflags", spflags, flagdesc_mapgen_v5); settings->getFlagStrNoEx("mgv5_spflags", spflags, flagdesc_mapgen_v5);
settings->getFloatNoEx("mgv5_cave_width", cave_width);
settings->getNoiseParams("mgv5_np_filler_depth", np_filler_depth); settings->getNoiseParams("mgv5_np_filler_depth", np_filler_depth);
settings->getNoiseParams("mgv5_np_factor", np_factor); settings->getNoiseParams("mgv5_np_factor", np_factor);
@ -163,7 +167,8 @@ void MapgenV5Params::readParams(const Settings *settings)
void MapgenV5Params::writeParams(Settings *settings) const void MapgenV5Params::writeParams(Settings *settings) const
{ {
settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5, U32_MAX); settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5, U32_MAX);
settings->setFloat("mgv5_cave_width", cave_width);
settings->setNoiseParams("mgv5_np_filler_depth", np_filler_depth); settings->setNoiseParams("mgv5_np_filler_depth", np_filler_depth);
settings->setNoiseParams("mgv5_np_factor", np_factor); settings->setNoiseParams("mgv5_np_factor", np_factor);
@ -598,7 +603,7 @@ void MapgenV5::generateCaves(int max_stone_y)
float d1 = contour(noise_cave1->result[index3d]); float d1 = contour(noise_cave1->result[index3d]);
float d2 = contour(noise_cave2->result[index3d]); float d2 = contour(noise_cave2->result[index3d]);
if (d1 * d2 > 0.125f && ndef->get(c).is_ground_content) { if (d1 * d2 > cave_width && ndef->get(c).is_ground_content) {
// In tunnel and ground content, excavate // In tunnel and ground content, excavate
vm->m_data[vi] = MapNode(CONTENT_AIR); vm->m_data[vi] = MapNode(CONTENT_AIR);
is_tunnel = true; is_tunnel = true;

@ -32,6 +32,7 @@ extern FlagDesc flagdesc_mapgen_v5[];
struct MapgenV5Params : public MapgenSpecificParams { struct MapgenV5Params : public MapgenSpecificParams {
u32 spflags; u32 spflags;
float cave_width;
NoiseParams np_filler_depth; NoiseParams np_filler_depth;
NoiseParams np_factor; NoiseParams np_factor;
NoiseParams np_height; NoiseParams np_height;
@ -54,13 +55,14 @@ public:
int ystride; int ystride;
int zstride_1d; int zstride_1d;
u32 spflags;
v3s16 node_min; v3s16 node_min;
v3s16 node_max; v3s16 node_max;
v3s16 full_node_min; v3s16 full_node_min;
v3s16 full_node_max; v3s16 full_node_max;
u32 spflags;
float cave_width;
Noise *noise_filler_depth; Noise *noise_filler_depth;
Noise *noise_factor; Noise *noise_factor;
Noise *noise_height; Noise *noise_height;

@ -71,7 +71,9 @@ MapgenV7::MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge)
this->ridge_heightmap = new s16[csize.X * csize.Z]; this->ridge_heightmap = new s16[csize.X * csize.Z];
MapgenV7Params *sp = (MapgenV7Params *)params->sparams; MapgenV7Params *sp = (MapgenV7Params *)params->sparams;
this->spflags = sp->spflags;
this->spflags = sp->spflags;
this->cave_width = sp->cave_width;
//// Terrain noise //// Terrain noise
noise_terrain_base = new Noise(&sp->np_terrain_base, seed, csize.X, csize.Z); noise_terrain_base = new Noise(&sp->np_terrain_base, seed, csize.X, csize.Z);
@ -152,7 +154,8 @@ MapgenV7::~MapgenV7()
MapgenV7Params::MapgenV7Params() MapgenV7Params::MapgenV7Params()
{ {
spflags = MGV7_MOUNTAINS | MGV7_RIDGES; spflags = MGV7_MOUNTAINS | MGV7_RIDGES;
cave_width = 0.3;
np_terrain_base = NoiseParams(4, 70, v3f(600, 600, 600), 82341, 5, 0.6, 2.0); np_terrain_base = NoiseParams(4, 70, v3f(600, 600, 600), 82341, 5, 0.6, 2.0);
np_terrain_alt = NoiseParams(4, 25, v3f(600, 600, 600), 5934, 5, 0.6, 2.0); np_terrain_alt = NoiseParams(4, 25, v3f(600, 600, 600), 5934, 5, 0.6, 2.0);
@ -170,7 +173,8 @@ MapgenV7Params::MapgenV7Params()
void MapgenV7Params::readParams(const Settings *settings) void MapgenV7Params::readParams(const Settings *settings)
{ {
settings->getFlagStrNoEx("mgv7_spflags", spflags, flagdesc_mapgen_v7); settings->getFlagStrNoEx("mgv7_spflags", spflags, flagdesc_mapgen_v7);
settings->getFloatNoEx("mgv7_cave_width", cave_width);
settings->getNoiseParams("mgv7_np_terrain_base", np_terrain_base); settings->getNoiseParams("mgv7_np_terrain_base", np_terrain_base);
settings->getNoiseParams("mgv7_np_terrain_alt", np_terrain_alt); settings->getNoiseParams("mgv7_np_terrain_alt", np_terrain_alt);
@ -188,7 +192,8 @@ void MapgenV7Params::readParams(const Settings *settings)
void MapgenV7Params::writeParams(Settings *settings) const void MapgenV7Params::writeParams(Settings *settings) const
{ {
settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, U32_MAX); settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, U32_MAX);
settings->setFloat("mgv7_cave_width", cave_width);
settings->setNoiseParams("mgv7_np_terrain_base", np_terrain_base); settings->setNoiseParams("mgv7_np_terrain_base", np_terrain_base);
settings->setNoiseParams("mgv7_np_terrain_alt", np_terrain_alt); settings->setNoiseParams("mgv7_np_terrain_alt", np_terrain_alt);
@ -735,7 +740,7 @@ void MapgenV7::generateCaves(s16 max_stone_y)
float d1 = contour(noise_cave1->result[index3d]); float d1 = contour(noise_cave1->result[index3d]);
float d2 = contour(noise_cave2->result[index3d]); float d2 = contour(noise_cave2->result[index3d]);
if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) { if (d1 * d2 > cave_width && ndef->get(c).is_ground_content) {
// In tunnel and ground content, excavate // In tunnel and ground content, excavate
vm->m_data[vi] = MapNode(CONTENT_AIR); vm->m_data[vi] = MapNode(CONTENT_AIR);
is_tunnel = true; is_tunnel = true;

@ -34,6 +34,7 @@ extern FlagDesc flagdesc_mapgen_v7[];
struct MapgenV7Params : public MapgenSpecificParams { struct MapgenV7Params : public MapgenSpecificParams {
u32 spflags; u32 spflags;
float cave_width;
NoiseParams np_terrain_base; NoiseParams np_terrain_base;
NoiseParams np_terrain_alt; NoiseParams np_terrain_alt;
NoiseParams np_terrain_persist; NoiseParams np_terrain_persist;
@ -61,7 +62,6 @@ public:
int ystride; int ystride;
int zstride_1u1d; int zstride_1u1d;
int zstride_1d; int zstride_1d;
u32 spflags;
v3s16 node_min; v3s16 node_min;
v3s16 node_max; v3s16 node_max;
@ -70,6 +70,8 @@ public:
s16 *ridge_heightmap; s16 *ridge_heightmap;
u32 spflags;
float cave_width;
Noise *noise_terrain_base; Noise *noise_terrain_base;
Noise *noise_terrain_alt; Noise *noise_terrain_alt;
Noise *noise_terrain_persist; Noise *noise_terrain_persist;

@ -86,25 +86,16 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenParams *params, EmergeManager *
g_settings->getU16("map_generation_limit")); g_settings->getU16("map_generation_limit"));
MapgenValleysParams *sp = (MapgenValleysParams *)params->sparams; MapgenValleysParams *sp = (MapgenValleysParams *)params->sparams;
this->spflags = sp->spflags;
this->humid_rivers = (spflags & MGVALLEYS_HUMID_RIVERS);
this->use_altitude_chill = (spflags & MGVALLEYS_ALT_CHILL);
this->spflags = sp->spflags;
this->altitude_chill = sp->altitude_chill; this->altitude_chill = sp->altitude_chill;
this->humidity_adjust = params->np_biome_humidity.offset - 50.f;
this->large_cave_depth = sp->large_cave_depth; this->large_cave_depth = sp->large_cave_depth;
this->lava_features_lim = rangelim(sp->lava_features, 0, 10); this->lava_features_lim = rangelim(sp->lava_features, 0, 10);
this->massive_cave_depth = sp->massive_cave_depth; this->massive_cave_depth = sp->massive_cave_depth;
this->river_depth_bed = sp->river_depth + 1.f; this->river_depth_bed = sp->river_depth + 1.f;
this->river_size_factor = sp->river_size / 100.f; this->river_size_factor = sp->river_size / 100.f;
this->water_features_lim = rangelim(sp->water_features, 0, 10); this->water_features_lim = rangelim(sp->water_features, 0, 10);
this->cave_width = sp->cave_width;
// a small chance of overflows if the settings are very high
this->cave_water_max_height = water_level + MYMAX(0, water_features_lim - 4) * 50;
this->lava_max_height = water_level + MYMAX(0, lava_features_lim - 4) * 50;
tcave_cache = new float[csize.Y + 2];
//// 2D Terrain noise //// 2D Terrain noise
noise_filler_depth = new Noise(&sp->np_filler_depth, seed, csize.X, csize.Z); noise_filler_depth = new Noise(&sp->np_filler_depth, seed, csize.X, csize.Z);
@ -128,6 +119,16 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenParams *params, EmergeManager *
noise_humidity_blend = new Noise(&params->np_biome_humidity_blend, seed, csize.X, csize.Z); noise_humidity_blend = new Noise(&params->np_biome_humidity_blend, seed, csize.X, csize.Z);
noise_humidity = new Noise(&params->np_biome_humidity, seed, csize.X, csize.Z); noise_humidity = new Noise(&params->np_biome_humidity, seed, csize.X, csize.Z);
this->humid_rivers = (spflags & MGVALLEYS_HUMID_RIVERS);
this->use_altitude_chill = (spflags & MGVALLEYS_ALT_CHILL);
this->humidity_adjust = params->np_biome_humidity.offset - 50.f;
// a small chance of overflows if the settings are very high
this->cave_water_max_height = water_level + MYMAX(0, water_features_lim - 4) * 50;
this->lava_max_height = water_level + MYMAX(0, lava_features_lim - 4) * 50;
tcave_cache = new float[csize.Y + 2];
//// Resolve nodes to be used //// Resolve nodes to be used
INodeDefManager *ndef = emerge->ndef; INodeDefManager *ndef = emerge->ndef;
@ -165,10 +166,6 @@ MapgenValleys::~MapgenValleys()
delete noise_cave1; delete noise_cave1;
delete noise_cave2; delete noise_cave2;
delete noise_filler_depth; delete noise_filler_depth;
delete noise_heat;
delete noise_heat_blend;
delete noise_humidity;
delete noise_humidity_blend;
delete noise_inter_valley_fill; delete noise_inter_valley_fill;
delete noise_inter_valley_slope; delete noise_inter_valley_slope;
delete noise_rivers; delete noise_rivers;
@ -177,6 +174,11 @@ MapgenValleys::~MapgenValleys()
delete noise_valley_depth; delete noise_valley_depth;
delete noise_valley_profile; delete noise_valley_profile;
delete noise_heat;
delete noise_heat_blend;
delete noise_humidity;
delete noise_humidity_blend;
delete[] biomemap; delete[] biomemap;
delete[] heightmap; delete[] heightmap;
delete[] tcave_cache; delete[] tcave_cache;
@ -185,8 +187,7 @@ MapgenValleys::~MapgenValleys()
MapgenValleysParams::MapgenValleysParams() MapgenValleysParams::MapgenValleysParams()
{ {
spflags = MGVALLEYS_HUMID_RIVERS | MGVALLEYS_ALT_CHILL; spflags = MGVALLEYS_HUMID_RIVERS | MGVALLEYS_ALT_CHILL;
altitude_chill = 90; // The altitude at which temperature drops by 20C. altitude_chill = 90; // The altitude at which temperature drops by 20C.
large_cave_depth = -33; large_cave_depth = -33;
lava_features = 0; // How often water will occur in caves. lava_features = 0; // How often water will occur in caves.
@ -194,6 +195,7 @@ MapgenValleysParams::MapgenValleysParams()
river_depth = 4; // How deep to carve river channels. river_depth = 4; // How deep to carve river channels.
river_size = 5; // How wide to make rivers. river_size = 5; // How wide to make rivers.
water_features = 0; // How often water will occur in caves. water_features = 0; // How often water will occur in caves.
cave_width = 0.3;
np_cave1 = NoiseParams(0, 12, v3f(96, 96, 96), 52534, 4, 0.5, 2.0); np_cave1 = NoiseParams(0, 12, v3f(96, 96, 96), 52534, 4, 0.5, 2.0);
np_cave2 = NoiseParams(0, 12, v3f(96, 96, 96), 10325, 4, 0.5, 2.0); np_cave2 = NoiseParams(0, 12, v3f(96, 96, 96), 10325, 4, 0.5, 2.0);
@ -205,56 +207,56 @@ MapgenValleysParams::MapgenValleysParams()
np_terrain_height = NoiseParams(-10.f, 50.f, v3f(1024, 1024, 1024), 5202, 6, 0.4f, 2.f); np_terrain_height = NoiseParams(-10.f, 50.f, v3f(1024, 1024, 1024), 5202, 6, 0.4f, 2.f);
np_valley_depth = NoiseParams(5.f, 4.f, v3f(512, 512, 512), -1914, 1, 1.f, 2.f); np_valley_depth = NoiseParams(5.f, 4.f, v3f(512, 512, 512), -1914, 1, 1.f, 2.f);
np_valley_profile = NoiseParams(0.6f, 0.5f, v3f(512, 512, 512), 777, 1, 1.f, 2.f); np_valley_profile = NoiseParams(0.6f, 0.5f, v3f(512, 512, 512), 777, 1, 1.f, 2.f);
} }
void MapgenValleysParams::readParams(const Settings *settings) void MapgenValleysParams::readParams(const Settings *settings)
{ {
settings->getFlagStrNoEx("mg_valleys_spflags", spflags, flagdesc_mapgen_valleys); 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->getU16NoEx("mgvalleys_lava_features", lava_features);
settings->getS16NoEx("mgvalleys_massive_cave_depth", massive_cave_depth);
settings->getU16NoEx("mgvalleys_river_depth", river_depth);
settings->getU16NoEx("mgvalleys_river_size", river_size);
settings->getU16NoEx("mgvalleys_water_features", water_features);
settings->getFloatNoEx("mgvalleys_cave_width", cave_width);
settings->getU16NoEx("mg_valleys_altitude_chill", altitude_chill); settings->getNoiseParams("mgvalleys_np_cave1", np_cave1);
settings->getS16NoEx("mg_valleys_large_cave_depth", large_cave_depth); settings->getNoiseParams("mgvalleys_np_cave2", np_cave2);
settings->getU16NoEx("mg_valleys_lava_features", lava_features); settings->getNoiseParams("mgvalleys_np_filler_depth", np_filler_depth);
settings->getS16NoEx("mg_valleys_massive_cave_depth", massive_cave_depth); settings->getNoiseParams("mgvalleys_np_inter_valley_fill", np_inter_valley_fill);
settings->getU16NoEx("mg_valleys_river_depth", river_depth); settings->getNoiseParams("mgvalleys_np_inter_valley_slope", np_inter_valley_slope);
settings->getU16NoEx("mg_valleys_river_size", river_size); settings->getNoiseParams("mgvalleys_np_rivers", np_rivers);
settings->getU16NoEx("mg_valleys_water_features", water_features); settings->getNoiseParams("mgvalleys_np_massive_caves", np_massive_caves);
settings->getNoiseParams("mgvalleys_np_terrain_height", np_terrain_height);
settings->getNoiseParams("mg_valleys_np_cave1", np_cave1); settings->getNoiseParams("mgvalleys_np_valley_depth", np_valley_depth);
settings->getNoiseParams("mg_valleys_np_cave2", np_cave2); settings->getNoiseParams("mgvalleys_np_valley_profile", np_valley_profile);
settings->getNoiseParams("mg_valleys_np_filler_depth", np_filler_depth);
settings->getNoiseParams("mg_valleys_np_inter_valley_fill", np_inter_valley_fill);
settings->getNoiseParams("mg_valleys_np_inter_valley_slope", np_inter_valley_slope);
settings->getNoiseParams("mg_valleys_np_rivers", np_rivers);
settings->getNoiseParams("mg_valleys_np_massive_caves", np_massive_caves);
settings->getNoiseParams("mg_valleys_np_terrain_height", np_terrain_height);
settings->getNoiseParams("mg_valleys_np_valley_depth", np_valley_depth);
settings->getNoiseParams("mg_valleys_np_valley_profile", np_valley_profile);
} }
void MapgenValleysParams::writeParams(Settings *settings) const void MapgenValleysParams::writeParams(Settings *settings) const
{ {
settings->setFlagStr("mg_valleys_spflags", spflags, flagdesc_mapgen_valleys, U32_MAX); 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->setU16("mgvalleys_lava_features", lava_features);
settings->setS16("mgvalleys_massive_cave_depth", massive_cave_depth);
settings->setU16("mgvalleys_river_depth", river_depth);
settings->setU16("mgvalleys_river_size", river_size);
settings->setU16("mgvalleys_water_features", water_features);
settings->setFloat("mgvalleys_cave_width", cave_width);
settings->setU16("mg_valleys_altitude_chill", altitude_chill); settings->setNoiseParams("mgvalleys_np_cave1", np_cave1);
settings->setS16("mg_valleys_large_cave_depth", large_cave_depth); settings->setNoiseParams("mgvalleys_np_cave2", np_cave2);
settings->setU16("mg_valleys_lava_features", lava_features); settings->setNoiseParams("mgvalleys_np_filler_depth", np_filler_depth);
settings->setS16("mg_valleys_massive_cave_depth", massive_cave_depth); settings->setNoiseParams("mgvalleys_np_inter_valley_fill", np_inter_valley_fill);
settings->setU16("mg_valleys_river_depth", river_depth); settings->setNoiseParams("mgvalleys_np_inter_valley_slope", np_inter_valley_slope);
settings->setU16("mg_valleys_river_size", river_size); settings->setNoiseParams("mgvalleys_np_rivers", np_rivers);
settings->setU16("mg_valleys_water_features", water_features); settings->setNoiseParams("mgvalleys_np_massive_caves", np_massive_caves);
settings->setNoiseParams("mgvalleys_np_terrain_height", np_terrain_height);
settings->setNoiseParams("mg_valleys_np_cave1", np_cave1); settings->setNoiseParams("mgvalleys_np_valley_depth", np_valley_depth);
settings->setNoiseParams("mg_valleys_np_cave2", np_cave2); settings->setNoiseParams("mgvalleys_np_valley_profile", np_valley_profile);
settings->setNoiseParams("mg_valleys_np_filler_depth", np_filler_depth);
settings->setNoiseParams("mg_valleys_np_inter_valley_fill", np_inter_valley_fill);
settings->setNoiseParams("mg_valleys_np_inter_valley_slope", np_inter_valley_slope);
settings->setNoiseParams("mg_valleys_np_rivers", np_rivers);
settings->setNoiseParams("mg_valleys_np_massive_caves", np_massive_caves);
settings->setNoiseParams("mg_valleys_np_terrain_height", np_terrain_height);
settings->setNoiseParams("mg_valleys_np_valley_depth", np_valley_depth);
settings->setNoiseParams("mg_valleys_np_valley_profile", np_valley_profile);
} }
@ -964,7 +966,7 @@ void MapgenValleys::generateCaves(s16 max_stone_y)
// when a tunnel undercuts a river. However, that's not for // when a tunnel undercuts a river. However, that's not for
// the mapgen to correct. Fix it in lua. // the mapgen to correct. Fix it in lua.
if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) { if (d1 * d2 > cave_width && ndef->get(c).is_ground_content) {
// in a tunnel // in a tunnel
vm->m_data[index_data] = n_air; vm->m_data[index_data] = n_air;
tunnel_air_above = true; tunnel_air_above = true;

@ -47,7 +47,6 @@ class BiomeManager;
struct MapgenValleysParams : public MapgenSpecificParams { struct MapgenValleysParams : public MapgenSpecificParams {
u32 spflags; u32 spflags;
s16 large_cave_depth; s16 large_cave_depth;
s16 massive_cave_depth; s16 massive_cave_depth;
u16 altitude_chill; u16 altitude_chill;
@ -55,11 +54,7 @@ struct MapgenValleysParams : public MapgenSpecificParams {
u16 river_depth; u16 river_depth;
u16 river_size; u16 river_size;
u16 water_features; u16 water_features;
float cave_width;
NoiseParams np_biome_heat;
NoiseParams np_biome_heat_blend;
NoiseParams np_biome_humidity;
NoiseParams np_biome_humidity_blend;
NoiseParams np_cave1; NoiseParams np_cave1;
NoiseParams np_cave2; NoiseParams np_cave2;
NoiseParams np_filler_depth; NoiseParams np_filler_depth;
@ -110,23 +105,29 @@ private:
float map_gen_limit; float map_gen_limit;
u32 spflags;
bool humid_rivers; bool humid_rivers;
bool use_altitude_chill; bool use_altitude_chill;
float humidity_adjust;
s16 cave_water_max_height;
s16 lava_max_height;
v3s16 node_min; v3s16 node_min;
v3s16 node_max; v3s16 node_max;
v3s16 full_node_min; v3s16 full_node_min;
v3s16 full_node_max; v3s16 full_node_max;
u32 spflags;
float altitude_chill;
s16 lava_features_lim;
s16 massive_cave_depth;
float river_depth_bed;
float river_size_factor;
float *tcave_cache;
s16 water_features_lim;
float cave_width;
Noise *noise_filler_depth; Noise *noise_filler_depth;
Noise *noise_cave1; Noise *noise_cave1;
Noise *noise_cave2; Noise *noise_cave2;
Noise *noise_heat;
Noise *noise_heat_blend;
Noise *noise_humidity;
Noise *noise_humidity_blend;
Noise *noise_inter_valley_fill; Noise *noise_inter_valley_fill;
Noise *noise_inter_valley_slope; Noise *noise_inter_valley_slope;
Noise *noise_rivers; Noise *noise_rivers;
@ -135,16 +136,10 @@ private:
Noise *noise_valley_depth; Noise *noise_valley_depth;
Noise *noise_valley_profile; Noise *noise_valley_profile;
float altitude_chill; Noise *noise_heat;
s16 cave_water_max_height; Noise *noise_heat_blend;
float humidity_adjust; Noise *noise_humidity;
s16 lava_features_lim; Noise *noise_humidity_blend;
s16 lava_max_height;
s16 massive_cave_depth;
float river_depth_bed;
float river_size_factor;
float *tcave_cache;
s16 water_features_lim;
content_t c_cobble; content_t c_cobble;
content_t c_desert_stone; content_t c_desert_stone;