From 5701f9e3898e5729e1602bb711af35603c67a964 Mon Sep 17 00:00:00 2001 From: Paramat Date: Thu, 5 Apr 2018 21:52:10 +0100 Subject: [PATCH] Mgcarpathian: Remove insignificant 'base' noise variation (#7209) Was only +-1 node over a scale of thousands of nodes. Replace with 'base_level' parameter value. --- builtin/settingtypes.txt | 6 +++--- src/mapgen/mapgen_carpathian.cpp | 18 ++++++------------ src/mapgen/mapgen_carpathian.h | 8 +++++--- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 4a2fa787e..99febe1ef 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -1509,6 +1509,9 @@ mgv7_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, # Flags starting with 'no' are used to explicitly disable them. mgcarpathian_spflags (Mapgen Carpathian specific flags) flags caverns caverns,nocaverns +# Defines the base ground level. +mgcarpathian_base_level (Base ground level) float 12.0 + # Controls width of tunnels, a smaller value creates wider tunnels. mgcarpathian_cave_width (Cave width) float 0.09 @@ -1535,9 +1538,6 @@ mgcarpathian_dungeon_ymax (Dungeon maximum Y) int 31000 [**Noises] -# 2D noise that defines the base ground level. -mgcarpathian_np_base (Base ground noise) noise_params_2d 12, 1, (2557, 2557, 2557), 6538, 4, 0.8, 0.5, eased - # Variation of biome filler depth. mgcarpathian_np_filler_depth (Filler depth noise) noise_params_2d 0, 1, (128, 128, 128), 261, 3, 0.7, 2.0, eased diff --git a/src/mapgen/mapgen_carpathian.cpp b/src/mapgen/mapgen_carpathian.cpp index 1e12eafc3..76c215d00 100644 --- a/src/mapgen/mapgen_carpathian.cpp +++ b/src/mapgen/mapgen_carpathian.cpp @@ -54,6 +54,8 @@ MapgenCarpathian::MapgenCarpathian( int mapgenid, MapgenCarpathianParams *params, EmergeManager *emerge) : MapgenBasic(mapgenid, params, emerge) { + base_level = params->base_level; + spflags = params->spflags; cave_width = params->cave_width; large_cave_depth = params->large_cave_depth; @@ -67,7 +69,6 @@ MapgenCarpathian::MapgenCarpathian( grad_wl = 1 - water_level; //// 2D Terrain noise - noise_base = new Noise(¶ms->np_base, seed, csize.X, csize.Z); noise_filler_depth = new Noise(¶ms->np_filler_depth, seed, csize.X, csize.Z); noise_height1 = new Noise(¶ms->np_height1, seed, csize.X, csize.Z); noise_height2 = new Noise(¶ms->np_height2, seed, csize.X, csize.Z); @@ -93,7 +94,6 @@ MapgenCarpathian::MapgenCarpathian( MapgenCarpathian::~MapgenCarpathian() { - delete noise_base; delete noise_filler_depth; delete noise_height1; delete noise_height2; @@ -110,7 +110,6 @@ MapgenCarpathian::~MapgenCarpathian() MapgenCarpathianParams::MapgenCarpathianParams(): - np_base (12, 1, v3f(2557, 2557, 2557), 6538, 4, 0.8, 0.5), np_filler_depth (0, 1, v3f(128, 128, 128), 261, 3, 0.7, 2.0), np_height1 (0, 5, v3f(251, 251, 251), 9613, 5, 0.5, 2.0), np_height2 (0, 5, v3f(383, 383, 383), 1949, 5, 0.5, 2.0), @@ -133,6 +132,7 @@ MapgenCarpathianParams::MapgenCarpathianParams(): void MapgenCarpathianParams::readParams(const Settings *settings) { settings->getFlagStrNoEx("mgcarpathian_spflags", spflags, flagdesc_mapgen_carpathian); + settings->getFloatNoEx("mgcarpathian_base_level", base_level); settings->getFloatNoEx("mgcarpathian_cave_width", cave_width); settings->getS16NoEx("mgcarpathian_large_cave_depth", large_cave_depth); settings->getS16NoEx("mgcarpathian_lava_depth", lava_depth); @@ -142,7 +142,6 @@ void MapgenCarpathianParams::readParams(const Settings *settings) settings->getS16NoEx("mgcarpathian_dungeon_ymin", dungeon_ymin); settings->getS16NoEx("mgcarpathian_dungeon_ymax", dungeon_ymax); - settings->getNoiseParams("mgcarpathian_np_base", np_base); settings->getNoiseParams("mgcarpathian_np_filler_depth", np_filler_depth); settings->getNoiseParams("mgcarpathian_np_height1", np_height1); settings->getNoiseParams("mgcarpathian_np_height2", np_height2); @@ -164,6 +163,7 @@ void MapgenCarpathianParams::readParams(const Settings *settings) void MapgenCarpathianParams::writeParams(Settings *settings) const { settings->setFlagStr("mgcarpathian_spflags", spflags, flagdesc_mapgen_carpathian, U32_MAX); + settings->setFloat("mgcarpathian_base_level", base_level); settings->setFloat("mgcarpathian_cave_width", cave_width); settings->setS16("mgcarpathian_large_cave_depth", large_cave_depth); settings->setS16("mgcarpathian_lava_depth", lava_depth); @@ -173,7 +173,6 @@ void MapgenCarpathianParams::writeParams(Settings *settings) const settings->setS16("mgcarpathian_dungeon_ymin", dungeon_ymin); settings->setS16("mgcarpathian_dungeon_ymax", dungeon_ymax); - settings->setNoiseParams("mgcarpathian_np_base", np_base); settings->setNoiseParams("mgcarpathian_np_filler_depth", np_filler_depth); settings->setNoiseParams("mgcarpathian_np_height1", np_height1); settings->setNoiseParams("mgcarpathian_np_height2", np_height2); @@ -313,7 +312,6 @@ int MapgenCarpathian::getSpawnLevelAtPoint(v2s16 p) float MapgenCarpathian::terrainLevelAtPoint(s16 x, s16 z) { - float ground = NoisePerlin2D(&noise_base->np, x, z, seed); float height1 = NoisePerlin2D(&noise_height1->np, x, z, seed); float height2 = NoisePerlin2D(&noise_height2->np, x, z, seed); float height3 = NoisePerlin2D(&noise_height3->np, x, z, seed); @@ -355,7 +353,7 @@ float MapgenCarpathian::terrainLevelAtPoint(s16 x, s16 z) // Final terrain level float mountains = hills + ridged_mountains + step_mountains; - float surface_level = ground + mountains + grad; + float surface_level = base_level + mountains + grad; if (y > surface_level && height < 0) height = y; @@ -375,7 +373,6 @@ int MapgenCarpathian::generateTerrain() MapNode mn_water(c_water_source); // Calculate noise for terrain generation - noise_base->perlinMap2D(node_min.X, node_min.Z); noise_height1->perlinMap2D(node_min.X, node_min.Z); noise_height2->perlinMap2D(node_min.X, node_min.Z); noise_height3->perlinMap2D(node_min.X, node_min.Z); @@ -395,9 +392,6 @@ int MapgenCarpathian::generateTerrain() for (s16 z = node_min.Z; z <= node_max.Z; z++) for (s16 x = node_min.X; x <= node_max.X; x++, index2d++) { - // Base terrain - float ground = noise_base->result[index2d]; - // Hill/Mountain height (hilliness) float height1 = noise_height1->result[index2d]; float height2 = noise_height2->result[index2d]; @@ -452,7 +446,7 @@ int MapgenCarpathian::generateTerrain() // Final terrain level float mountains = hills + ridged_mountains + step_mountains; - float surface_level = ground + mountains + grad; + float surface_level = base_level + mountains + grad; if (y < surface_level) { vm->m_data[vi] = mn_stone; // Stone diff --git a/src/mapgen/mapgen_carpathian.h b/src/mapgen/mapgen_carpathian.h index ac63eca4a..c32212c9a 100644 --- a/src/mapgen/mapgen_carpathian.h +++ b/src/mapgen/mapgen_carpathian.h @@ -33,6 +33,8 @@ extern FlagDesc flagdesc_mapgen_carpathian[]; struct MapgenCarpathianParams : public MapgenParams { + float base_level = 12.0f; + u32 spflags = MGCARPATHIAN_CAVERNS; float cave_width = 0.09f; s16 large_cave_depth = -33; @@ -43,7 +45,6 @@ struct MapgenCarpathianParams : public MapgenParams s16 dungeon_ymin = -31000; s16 dungeon_ymax = 31000; - NoiseParams np_base; NoiseParams np_filler_depth; NoiseParams np_height1; NoiseParams np_height2; @@ -83,12 +84,13 @@ public: int getSpawnLevelAtPoint(v2s16 p); private: - s16 large_cave_depth; + float base_level; s32 grad_wl; + + s16 large_cave_depth; s16 dungeon_ymin; s16 dungeon_ymax; - Noise *noise_base; Noise *noise_height1; Noise *noise_height2; Noise *noise_height3;