mirror of
https://github.com/minetest/minetest.git
synced 2024-08-18 20:44:16 +02:00
Dungeons: Settable density noise, move number calculation to mapgens (#8473)
Add user-settable noise parameters for dungeon density to each mapgen, except V6 which hardcodes this noise parameter. Move the calculation of number of dungeons generated in a mapchunk out of dungeongen.cpp and into mapgen code, to allow mapgens to generate any desired number of dungeons in a mapchunk, instead of being forced to have number of dungeons determined by a density noise. This is more flexible and allows mapgens to use dungeon generation to create custom structures, such as occasional mega-dungeons.
This commit is contained in:
parent
a1459a9eac
commit
7379aa74cf
@ -1417,6 +1417,9 @@ mgv5_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.6
|
||||
# 3D noise defining terrain.
|
||||
mgv5_np_ground (Ground noise) noise_params_3d 0, 40, (80, 80, 80), 983240, 4, 0.55, 2.0, eased
|
||||
|
||||
# 3D noise that determines number of dungeons per mapchunk.
|
||||
mgv5_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
|
||||
|
||||
[*Mapgen V6]
|
||||
|
||||
# Map generation attributes specific to Mapgen v6.
|
||||
@ -1569,6 +1572,9 @@ mgv7_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5,
|
||||
# Second of two 3D noises that together define tunnels.
|
||||
mgv7_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
|
||||
|
||||
# 3D noise that determines number of dungeons per mapchunk.
|
||||
mgv7_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
|
||||
|
||||
[*Mapgen Carpathian]
|
||||
|
||||
# Map generation attributes specific to Mapgen Carpathian.
|
||||
@ -1648,6 +1654,9 @@ mgcarpathian_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325,
|
||||
# 3D noise defining giant caverns.
|
||||
mgcarpathian_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0
|
||||
|
||||
# 3D noise that determines number of dungeons per mapchunk.
|
||||
mgcarpathian_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
|
||||
|
||||
[*Mapgen Flat]
|
||||
|
||||
# Map generation attributes specific to Mapgen flat.
|
||||
@ -1702,6 +1711,9 @@ mgflat_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5
|
||||
# Second of two 3D noises that together define tunnels.
|
||||
mgflat_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
|
||||
|
||||
# 3D noise that determines number of dungeons per mapchunk.
|
||||
mgflat_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
|
||||
|
||||
[*Mapgen Fractal]
|
||||
|
||||
# Controls width of tunnels, a smaller value creates wider tunnels.
|
||||
@ -1811,6 +1823,9 @@ mgfractal_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3,
|
||||
# Second of two 3D noises that together define tunnels.
|
||||
mgfractal_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
|
||||
|
||||
# 3D noise that determines number of dungeons per mapchunk.
|
||||
mgfractal_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
|
||||
|
||||
[*Mapgen Valleys]
|
||||
|
||||
# Map generation attributes specific to Mapgen Valleys.
|
||||
@ -1888,6 +1903,9 @@ mgvalleys_np_valley_profile (Valley profile) noise_params_2d 0.6, 0.5, (512, 512
|
||||
# Slope and fill work together to modify the heights.
|
||||
mgvalleys_np_inter_valley_slope (Valley slope) noise_params_2d 0.5, 0.5, (128, 128, 128), 746, 1, 1.0, 2.0, eased
|
||||
|
||||
# 3D noise that determines number of dungeons per mapchunk.
|
||||
mgvalleys_np_dungeons (Dungeon noise) noise_params_3d 0.9, 0.5, (500, 500, 500), 0, 2, 0.8, 2.0
|
||||
|
||||
[*Advanced]
|
||||
|
||||
# Size of mapchunks generated by mapgen, stated in mapblocks (16 nodes).
|
||||
|
@ -31,9 +31,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
//#define DGEN_USE_TORCHES
|
||||
|
||||
NoiseParams nparams_dungeon_density(0.9, 0.5, v3f(500.0, 500.0, 500.0), 0, 2, 0.8, 2.0);
|
||||
NoiseParams nparams_dungeon_alt_wall(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, 1.1, 2.0);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -73,22 +70,22 @@ DungeonGen::DungeonGen(const NodeDefManager *ndef,
|
||||
dp.rooms_max = 16;
|
||||
dp.notifytype = GENNOTIFY_DUNGEON;
|
||||
|
||||
dp.np_density = nparams_dungeon_density;
|
||||
dp.np_alt_wall = nparams_dungeon_alt_wall;
|
||||
dp.np_alt_wall =
|
||||
NoiseParams(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, 1.1, 2.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
|
||||
void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax,
|
||||
u16 num_dungeons)
|
||||
{
|
||||
if (num_dungeons == 0)
|
||||
return;
|
||||
|
||||
assert(vm);
|
||||
|
||||
//TimeTaker t("gen dungeons");
|
||||
|
||||
float nval_density = NoisePerlin3D(&dp.np_density, nmin.X, nmin.Y, nmin.Z, dp.seed);
|
||||
if (nval_density < 1.0f)
|
||||
return;
|
||||
|
||||
static const bool preserve_ignore = !g_settings->getBool("projecting_dungeons");
|
||||
|
||||
this->vm = vm;
|
||||
@ -122,7 +119,7 @@ void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
|
||||
}
|
||||
|
||||
// Add them
|
||||
for (u32 i = 0; i < std::floor(nval_density); i++)
|
||||
for (u32 i = 0; i < num_dungeons; i++)
|
||||
makeDungeon(v3s16(1, 1, 1) * MAP_BLOCKSIZE);
|
||||
|
||||
// Optionally convert some structure to alternative structure
|
||||
|
@ -58,7 +58,6 @@ struct DungeonParams {
|
||||
u16 rooms_max;
|
||||
GenNotifyType notifytype;
|
||||
|
||||
NoiseParams np_density;
|
||||
NoiseParams np_alt_wall;
|
||||
};
|
||||
|
||||
@ -83,7 +82,7 @@ public:
|
||||
GenerateNotifier *gennotify, DungeonParams *dparams);
|
||||
|
||||
void generate(MMVManip *vm, u32 bseed,
|
||||
v3s16 full_node_min, v3s16 full_node_max);
|
||||
v3s16 full_node_min, v3s16 full_node_max, u16 num_dungeons);
|
||||
|
||||
void makeDungeon(v3s16 start_padding);
|
||||
void makeRoom(v3s16 roomsize, v3s16 roomplace);
|
||||
|
@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include "mapgen.h"
|
||||
#include "voxel.h"
|
||||
#include "noise.h"
|
||||
@ -889,6 +890,11 @@ void MapgenBasic::generateDungeons(s16 max_stone_y)
|
||||
if (max_stone_y < node_min.Y)
|
||||
return;
|
||||
|
||||
u16 num_dungeons = std::fmax(std::floor(
|
||||
NoisePerlin3D(&np_dungeons, node_min.X, node_min.Y, node_min.Z, seed)), 0.0f);
|
||||
if (num_dungeons == 0)
|
||||
return;
|
||||
|
||||
// Get biome at mapchunk midpoint
|
||||
v3s16 chunk_mid = node_min + (node_max - node_min) / v3s16(2, 2, 2);
|
||||
Biome *biome = (Biome *)biomegen->getBiomeAtPoint(chunk_mid);
|
||||
@ -902,8 +908,8 @@ void MapgenBasic::generateDungeons(s16 max_stone_y)
|
||||
dp.rooms_min = 2;
|
||||
dp.rooms_max = 16;
|
||||
|
||||
dp.np_density = nparams_dungeon_density;
|
||||
dp.np_alt_wall = nparams_dungeon_alt_wall;
|
||||
dp.np_alt_wall =
|
||||
NoiseParams(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, 1.1, 2.0);
|
||||
|
||||
// Biome-defined dungeon nodes
|
||||
if (biome->c_dungeon != CONTENT_IGNORE) {
|
||||
@ -980,7 +986,7 @@ void MapgenBasic::generateDungeons(s16 max_stone_y)
|
||||
}
|
||||
|
||||
DungeonGen dgen(ndef, &gennotify, &dp);
|
||||
dgen.generate(vm, blockseed, full_node_min, full_node_max);
|
||||
dgen.generate(vm, blockseed, full_node_min, full_node_max, num_dungeons);
|
||||
}
|
||||
|
||||
|
||||
|
@ -283,6 +283,7 @@ protected:
|
||||
NoiseParams np_cave1;
|
||||
NoiseParams np_cave2;
|
||||
NoiseParams np_cavern;
|
||||
NoiseParams np_dungeons;
|
||||
float cave_width;
|
||||
float cavern_limit;
|
||||
float cavern_taper;
|
||||
|
@ -88,6 +88,7 @@ MapgenCarpathian::MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
MapgenBasic::np_cavern = params->np_cavern;
|
||||
MapgenBasic::np_dungeons = params->np_dungeons;
|
||||
}
|
||||
|
||||
|
||||
@ -109,21 +110,22 @@ MapgenCarpathian::~MapgenCarpathian()
|
||||
|
||||
|
||||
MapgenCarpathianParams::MapgenCarpathianParams():
|
||||
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),
|
||||
np_height3 (0, 5, v3f(509, 509, 509), 3211, 5, 0.5, 2.0),
|
||||
np_height4 (0, 5, v3f(631, 631, 631), 1583, 5, 0.5, 2.0),
|
||||
np_hills_terrain (1, 1, v3f(1301, 1301, 1301), 1692, 5, 0.5, 2.0),
|
||||
np_ridge_terrain (1, 1, v3f(1889, 1889, 1889), 3568, 5, 0.5, 2.0),
|
||||
np_step_terrain (1, 1, v3f(1889, 1889, 1889), 4157, 5, 0.5, 2.0),
|
||||
np_hills (0, 3, v3f(257, 257, 257), 6604, 6, 0.5, 2.0),
|
||||
np_ridge_mnt (0, 12, v3f(743, 743, 743), 5520, 6, 0.7, 2.0),
|
||||
np_step_mnt (0, 8, v3f(509, 509, 509), 2590, 6, 0.6, 2.0),
|
||||
np_mnt_var (0, 1, v3f(499, 499, 499), 2490, 5, 0.55, 2.0),
|
||||
np_cave1 (0, 12, v3f(61, 61, 61), 52534, 3, 0.5, 2.0),
|
||||
np_cave2 (0, 12, v3f(67, 67, 67), 10325, 3, 0.5, 2.0),
|
||||
np_cavern (0, 1, v3f(384, 128, 384), 723, 5, 0.63, 2.0)
|
||||
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),
|
||||
np_height3 (0, 5, v3f(509, 509, 509), 3211, 5, 0.5, 2.0),
|
||||
np_height4 (0, 5, v3f(631, 631, 631), 1583, 5, 0.5, 2.0),
|
||||
np_hills_terrain (1, 1, v3f(1301, 1301, 1301), 1692, 5, 0.5, 2.0),
|
||||
np_ridge_terrain (1, 1, v3f(1889, 1889, 1889), 3568, 5, 0.5, 2.0),
|
||||
np_step_terrain (1, 1, v3f(1889, 1889, 1889), 4157, 5, 0.5, 2.0),
|
||||
np_hills (0, 3, v3f(257, 257, 257), 6604, 6, 0.5, 2.0),
|
||||
np_ridge_mnt (0, 12, v3f(743, 743, 743), 5520, 6, 0.7, 2.0),
|
||||
np_step_mnt (0, 8, v3f(509, 509, 509), 2590, 6, 0.6, 2.0),
|
||||
np_mnt_var (0, 1, v3f(499, 499, 499), 2490, 5, 0.55, 2.0),
|
||||
np_cave1 (0, 12, v3f(61, 61, 61), 52534, 3, 0.5, 2.0),
|
||||
np_cave2 (0, 12, v3f(67, 67, 67), 10325, 3, 0.5, 2.0),
|
||||
np_cavern (0, 1, v3f(384, 128, 384), 723, 5, 0.63, 2.0),
|
||||
np_dungeons (0.9, 0.5, v3f(500, 500, 500), 0, 2, 0.8, 2.0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -156,6 +158,7 @@ void MapgenCarpathianParams::readParams(const Settings *settings)
|
||||
settings->getNoiseParams("mgcarpathian_np_cave1", np_cave1);
|
||||
settings->getNoiseParams("mgcarpathian_np_cave2", np_cave2);
|
||||
settings->getNoiseParams("mgcarpathian_np_cavern", np_cavern);
|
||||
settings->getNoiseParams("mgcarpathian_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
@ -187,6 +190,7 @@ void MapgenCarpathianParams::writeParams(Settings *settings) const
|
||||
settings->setNoiseParams("mgcarpathian_np_cave1", np_cave1);
|
||||
settings->setNoiseParams("mgcarpathian_np_cave2", np_cave2);
|
||||
settings->setNoiseParams("mgcarpathian_np_cavern", np_cavern);
|
||||
settings->setNoiseParams("mgcarpathian_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,6 +60,7 @@ struct MapgenCarpathianParams : public MapgenParams
|
||||
NoiseParams np_cave1;
|
||||
NoiseParams np_cave2;
|
||||
NoiseParams np_cavern;
|
||||
NoiseParams np_dungeons;
|
||||
|
||||
MapgenCarpathianParams();
|
||||
~MapgenCarpathianParams() = default;
|
||||
|
@ -69,8 +69,9 @@ MapgenFlat::MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge)
|
||||
if ((spflags & MGFLAT_LAKES) || (spflags & MGFLAT_HILLS))
|
||||
noise_terrain = new Noise(¶ms->np_terrain, seed, csize.X, csize.Z);
|
||||
// 3D noise
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
MapgenBasic::np_dungeons = params->np_dungeons;
|
||||
}
|
||||
|
||||
|
||||
@ -84,10 +85,11 @@ MapgenFlat::~MapgenFlat()
|
||||
|
||||
|
||||
MapgenFlatParams::MapgenFlatParams():
|
||||
np_terrain (0, 1, v3f(600, 600, 600), 7244, 5, 0.6, 2.0),
|
||||
np_filler_depth (0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0),
|
||||
np_cave1 (0, 12, v3f(61, 61, 61), 52534, 3, 0.5, 2.0),
|
||||
np_cave2 (0, 12, v3f(67, 67, 67), 10325, 3, 0.5, 2.0)
|
||||
np_terrain (0, 1, v3f(600, 600, 600), 7244, 5, 0.6, 2.0),
|
||||
np_filler_depth (0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0),
|
||||
np_cave1 (0, 12, v3f(61, 61, 61), 52534, 3, 0.5, 2.0),
|
||||
np_cave2 (0, 12, v3f(67, 67, 67), 10325, 3, 0.5, 2.0),
|
||||
np_dungeons (0.9, 0.5, v3f(500, 500, 500), 0, 2, 0.8, 2.0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -110,6 +112,7 @@ void MapgenFlatParams::readParams(const Settings *settings)
|
||||
settings->getNoiseParams("mgflat_np_filler_depth", np_filler_depth);
|
||||
settings->getNoiseParams("mgflat_np_cave1", np_cave1);
|
||||
settings->getNoiseParams("mgflat_np_cave2", np_cave2);
|
||||
settings->getNoiseParams("mgflat_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
@ -131,6 +134,7 @@ void MapgenFlatParams::writeParams(Settings *settings) const
|
||||
settings->setNoiseParams("mgflat_np_filler_depth", np_filler_depth);
|
||||
settings->setNoiseParams("mgflat_np_cave1", np_cave1);
|
||||
settings->setNoiseParams("mgflat_np_cave2", np_cave2);
|
||||
settings->setNoiseParams("mgflat_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,6 +48,7 @@ struct MapgenFlatParams : public MapgenParams
|
||||
NoiseParams np_filler_depth;
|
||||
NoiseParams np_cave1;
|
||||
NoiseParams np_cave2;
|
||||
NoiseParams np_dungeons;
|
||||
|
||||
MapgenFlatParams();
|
||||
~MapgenFlatParams() = default;
|
||||
|
@ -70,8 +70,9 @@ MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge)
|
||||
noise_seabed = new Noise(¶ms->np_seabed, seed, csize.X, csize.Z);
|
||||
noise_filler_depth = new Noise(¶ms->np_filler_depth, seed, csize.X, csize.Z);
|
||||
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
MapgenBasic::np_dungeons = params->np_dungeons;
|
||||
|
||||
formula = fractal / 2 + fractal % 2;
|
||||
julia = fractal % 2 == 0;
|
||||
@ -89,7 +90,8 @@ MapgenFractalParams::MapgenFractalParams():
|
||||
np_seabed (-14, 9, v3f(600, 600, 600), 41900, 5, 0.6, 2.0),
|
||||
np_filler_depth (0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0),
|
||||
np_cave1 (0, 12, v3f(61, 61, 61), 52534, 3, 0.5, 2.0),
|
||||
np_cave2 (0, 12, v3f(67, 67, 67), 10325, 3, 0.5, 2.0)
|
||||
np_cave2 (0, 12, v3f(67, 67, 67), 10325, 3, 0.5, 2.0),
|
||||
np_dungeons (0.9, 0.5, v3f(500, 500, 500), 0, 2, 0.8, 2.0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -116,6 +118,7 @@ void MapgenFractalParams::readParams(const Settings *settings)
|
||||
settings->getNoiseParams("mgfractal_np_filler_depth", np_filler_depth);
|
||||
settings->getNoiseParams("mgfractal_np_cave1", np_cave1);
|
||||
settings->getNoiseParams("mgfractal_np_cave2", np_cave2);
|
||||
settings->getNoiseParams("mgfractal_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
@ -141,6 +144,7 @@ void MapgenFractalParams::writeParams(Settings *settings) const
|
||||
settings->setNoiseParams("mgfractal_np_filler_depth", np_filler_depth);
|
||||
settings->setNoiseParams("mgfractal_np_cave1", np_cave1);
|
||||
settings->setNoiseParams("mgfractal_np_cave2", np_cave2);
|
||||
settings->setNoiseParams("mgfractal_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,6 +51,7 @@ struct MapgenFractalParams : public MapgenParams
|
||||
NoiseParams np_filler_depth;
|
||||
NoiseParams np_cave1;
|
||||
NoiseParams np_cave2;
|
||||
NoiseParams np_dungeons;
|
||||
|
||||
MapgenFractalParams();
|
||||
~MapgenFractalParams() = default;
|
||||
|
@ -67,9 +67,10 @@ MapgenV5::MapgenV5(MapgenV5Params *params, EmergeManager *emerge)
|
||||
// 1-up 1-down overgeneration
|
||||
noise_ground = new Noise(¶ms->np_ground, seed, csize.X, csize.Y + 2, csize.Z);
|
||||
// 1 down overgeneration
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
MapgenBasic::np_cavern = params->np_cavern;
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
MapgenBasic::np_cavern = params->np_cavern;
|
||||
MapgenBasic::np_dungeons = params->np_dungeons;
|
||||
}
|
||||
|
||||
|
||||
@ -83,13 +84,14 @@ MapgenV5::~MapgenV5()
|
||||
|
||||
|
||||
MapgenV5Params::MapgenV5Params():
|
||||
np_filler_depth (0, 1, v3f(150, 150, 150), 261, 4, 0.7, 2.0),
|
||||
np_factor (0, 1, v3f(250, 250, 250), 920381, 3, 0.45, 2.0),
|
||||
np_height (0, 10, v3f(250, 250, 250), 84174, 4, 0.5, 2.0),
|
||||
np_ground (0, 40, v3f(80, 80, 80), 983240, 4, 0.55, 2.0, NOISE_FLAG_EASED),
|
||||
np_cave1 (0, 12, v3f(61, 61, 61), 52534, 3, 0.5, 2.0),
|
||||
np_cave2 (0, 12, v3f(67, 67, 67), 10325, 3, 0.5, 2.0),
|
||||
np_cavern (0, 1, v3f(384, 128, 384), 723, 5, 0.63, 2.0)
|
||||
np_filler_depth (0, 1, v3f(150, 150, 150), 261, 4, 0.7, 2.0),
|
||||
np_factor (0, 1, v3f(250, 250, 250), 920381, 3, 0.45, 2.0),
|
||||
np_height (0, 10, v3f(250, 250, 250), 84174, 4, 0.5, 2.0),
|
||||
np_ground (0, 40, v3f(80, 80, 80), 983240, 4, 0.55, 2.0, NOISE_FLAG_EASED),
|
||||
np_cave1 (0, 12, v3f(61, 61, 61), 52534, 3, 0.5, 2.0),
|
||||
np_cave2 (0, 12, v3f(67, 67, 67), 10325, 3, 0.5, 2.0),
|
||||
np_cavern (0, 1, v3f(384, 128, 384), 723, 5, 0.63, 2.0),
|
||||
np_dungeons (0.9, 0.5, v3f(500, 500, 500), 0, 2, 0.8, 2.0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -113,6 +115,7 @@ void MapgenV5Params::readParams(const Settings *settings)
|
||||
settings->getNoiseParams("mgv5_np_cave1", np_cave1);
|
||||
settings->getNoiseParams("mgv5_np_cave2", np_cave2);
|
||||
settings->getNoiseParams("mgv5_np_cavern", np_cavern);
|
||||
settings->getNoiseParams("mgv5_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
@ -135,6 +138,7 @@ void MapgenV5Params::writeParams(Settings *settings) const
|
||||
settings->setNoiseParams("mgv5_np_cave1", np_cave1);
|
||||
settings->setNoiseParams("mgv5_np_cave2", np_cave2);
|
||||
settings->setNoiseParams("mgv5_np_cavern", np_cavern);
|
||||
settings->setNoiseParams("mgv5_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,6 +48,7 @@ struct MapgenV5Params : public MapgenParams
|
||||
NoiseParams np_cave1;
|
||||
NoiseParams np_cave2;
|
||||
NoiseParams np_cavern;
|
||||
NoiseParams np_dungeons;
|
||||
|
||||
MapgenV5Params();
|
||||
~MapgenV5Params() = default;
|
||||
|
@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
*/
|
||||
|
||||
|
||||
#include <cmath>
|
||||
#include "mapgen.h"
|
||||
#include "voxel.h"
|
||||
#include "noise.h"
|
||||
@ -59,7 +60,7 @@ MapgenV6::MapgenV6(MapgenV6Params *params, EmergeManager *emerge)
|
||||
: Mapgen(MAPGEN_V6, params, emerge)
|
||||
{
|
||||
m_emerge = emerge;
|
||||
ystride = csize.X; //////fix this
|
||||
ystride = csize.X;
|
||||
|
||||
heightmap = new s16[csize.X * csize.Z];
|
||||
|
||||
@ -74,6 +75,8 @@ MapgenV6::MapgenV6(MapgenV6Params *params, EmergeManager *emerge)
|
||||
np_trees = ¶ms->np_trees;
|
||||
np_apple_trees = ¶ms->np_apple_trees;
|
||||
|
||||
np_dungeons = NoiseParams(0.9, 0.5, v3f(500.0, 500.0, 500.0), 0, 2, 0.8, 2.0);
|
||||
|
||||
//// Create noise objects
|
||||
noise_terrain_base = new Noise(¶ms->np_terrain_base, seed, csize.X, csize.Y);
|
||||
noise_terrain_higher = new Noise(¶ms->np_terrain_higher, seed, csize.X, csize.Y);
|
||||
@ -561,48 +564,51 @@ void MapgenV6::makeChunk(BlockMakeData *data)
|
||||
// Add dungeons
|
||||
if ((flags & MG_DUNGEONS) && stone_surface_max_y >= node_min.Y &&
|
||||
full_node_min.Y >= dungeon_ymin && full_node_max.Y <= dungeon_ymax) {
|
||||
DungeonParams dp;
|
||||
u16 num_dungeons = std::fmax(std::floor(
|
||||
NoisePerlin3D(&np_dungeons, node_min.X, node_min.Y, node_min.Z, seed)), 0.0f);
|
||||
|
||||
dp.seed = seed;
|
||||
dp.only_in_ground = true;
|
||||
dp.corridor_len_min = 1;
|
||||
dp.corridor_len_max = 13;
|
||||
dp.rooms_min = 2;
|
||||
dp.rooms_max = 16;
|
||||
if (num_dungeons >= 1) {
|
||||
DungeonParams dp;
|
||||
|
||||
dp.np_density
|
||||
= NoiseParams(0.9, 0.5, v3f(500.0, 500.0, 500.0), 0, 2, 0.8, 2.0);
|
||||
dp.np_alt_wall
|
||||
= NoiseParams(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, 1.1, 2.0);
|
||||
dp.seed = seed;
|
||||
dp.only_in_ground = true;
|
||||
dp.corridor_len_min = 1;
|
||||
dp.corridor_len_max = 13;
|
||||
dp.rooms_min = 2;
|
||||
dp.rooms_max = 16;
|
||||
|
||||
if (getBiome(0, v2s16(node_min.X, node_min.Z)) == BT_DESERT) {
|
||||
dp.c_wall = c_desert_stone;
|
||||
dp.c_alt_wall = CONTENT_IGNORE;
|
||||
dp.c_stair = c_stair_desert_stone;
|
||||
dp.np_alt_wall
|
||||
= NoiseParams(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, 1.1, 2.0);
|
||||
|
||||
dp.diagonal_dirs = true;
|
||||
dp.holesize = v3s16(2, 3, 2);
|
||||
dp.room_size_min = v3s16(6, 9, 6);
|
||||
dp.room_size_max = v3s16(10, 11, 10);
|
||||
dp.room_size_large_min = v3s16(10, 13, 10);
|
||||
dp.room_size_large_max = v3s16(18, 21, 18);
|
||||
dp.notifytype = GENNOTIFY_TEMPLE;
|
||||
} else {
|
||||
dp.c_wall = c_cobble;
|
||||
dp.c_alt_wall = c_mossycobble;
|
||||
dp.c_stair = c_stair_cobble;
|
||||
if (getBiome(0, v2s16(node_min.X, node_min.Z)) == BT_DESERT) {
|
||||
dp.c_wall = c_desert_stone;
|
||||
dp.c_alt_wall = CONTENT_IGNORE;
|
||||
dp.c_stair = c_stair_desert_stone;
|
||||
|
||||
dp.diagonal_dirs = false;
|
||||
dp.holesize = v3s16(1, 2, 1);
|
||||
dp.room_size_min = v3s16(4, 4, 4);
|
||||
dp.room_size_max = v3s16(8, 6, 8);
|
||||
dp.room_size_large_min = v3s16(8, 8, 8);
|
||||
dp.room_size_large_max = v3s16(16, 16, 16);
|
||||
dp.notifytype = GENNOTIFY_DUNGEON;
|
||||
dp.diagonal_dirs = true;
|
||||
dp.holesize = v3s16(2, 3, 2);
|
||||
dp.room_size_min = v3s16(6, 9, 6);
|
||||
dp.room_size_max = v3s16(10, 11, 10);
|
||||
dp.room_size_large_min = v3s16(10, 13, 10);
|
||||
dp.room_size_large_max = v3s16(18, 21, 18);
|
||||
dp.notifytype = GENNOTIFY_TEMPLE;
|
||||
} else {
|
||||
dp.c_wall = c_cobble;
|
||||
dp.c_alt_wall = c_mossycobble;
|
||||
dp.c_stair = c_stair_cobble;
|
||||
|
||||
dp.diagonal_dirs = false;
|
||||
dp.holesize = v3s16(1, 2, 1);
|
||||
dp.room_size_min = v3s16(4, 4, 4);
|
||||
dp.room_size_max = v3s16(8, 6, 8);
|
||||
dp.room_size_large_min = v3s16(8, 8, 8);
|
||||
dp.room_size_large_max = v3s16(16, 16, 16);
|
||||
dp.notifytype = GENNOTIFY_DUNGEON;
|
||||
}
|
||||
|
||||
DungeonGen dgen(ndef, &gennotify, &dp);
|
||||
dgen.generate(vm, blockseed, full_node_min, full_node_max, num_dungeons);
|
||||
}
|
||||
|
||||
DungeonGen dgen(ndef, &gennotify, &dp);
|
||||
dgen.generate(vm, blockseed, full_node_min, full_node_max);
|
||||
}
|
||||
|
||||
// Add top and bottom side of water to transforming_liquid queue
|
||||
|
@ -108,6 +108,8 @@ public:
|
||||
NoiseParams *np_trees;
|
||||
NoiseParams *np_apple_trees;
|
||||
|
||||
NoiseParams np_dungeons;
|
||||
|
||||
float freq_desert;
|
||||
float freq_beach;
|
||||
s16 dungeon_ymin;
|
||||
|
@ -113,9 +113,10 @@ MapgenV7::MapgenV7(MapgenV7Params *params, EmergeManager *emerge)
|
||||
new Noise(¶ms->np_mountain, seed, csize.X, csize.Y + 2, csize.Z);
|
||||
|
||||
// 3D noise, 1 down overgeneration
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
MapgenBasic::np_cavern = params->np_cavern;
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
MapgenBasic::np_cavern = params->np_cavern;
|
||||
MapgenBasic::np_dungeons = params->np_dungeons;
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +160,8 @@ MapgenV7Params::MapgenV7Params():
|
||||
np_ridge (0.0, 1.0, v3f(100, 100, 100), 6467, 4, 0.75, 2.0),
|
||||
np_cavern (0.0, 1.0, v3f(384, 128, 384), 723, 5, 0.63, 2.0),
|
||||
np_cave1 (0.0, 12.0, v3f(61, 61, 61), 52534, 3, 0.5, 2.0),
|
||||
np_cave2 (0.0, 12.0, v3f(67, 67, 67), 10325, 3, 0.5, 2.0)
|
||||
np_cave2 (0.0, 12.0, v3f(67, 67, 67), 10325, 3, 0.5, 2.0),
|
||||
np_dungeons (0.9, 0.5, v3f(500, 500, 500), 0, 2, 0.8, 2.0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -196,6 +198,7 @@ void MapgenV7Params::readParams(const Settings *settings)
|
||||
settings->getNoiseParams("mgv7_np_cavern", np_cavern);
|
||||
settings->getNoiseParams("mgv7_np_cave1", np_cave1);
|
||||
settings->getNoiseParams("mgv7_np_cave2", np_cave2);
|
||||
settings->getNoiseParams("mgv7_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
@ -231,6 +234,7 @@ void MapgenV7Params::writeParams(Settings *settings) const
|
||||
settings->setNoiseParams("mgv7_np_cavern", np_cavern);
|
||||
settings->setNoiseParams("mgv7_np_cave1", np_cave1);
|
||||
settings->setNoiseParams("mgv7_np_cave2", np_cave2);
|
||||
settings->setNoiseParams("mgv7_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,6 +66,7 @@ struct MapgenV7Params : public MapgenParams {
|
||||
NoiseParams np_cavern;
|
||||
NoiseParams np_cave1;
|
||||
NoiseParams np_cave2;
|
||||
NoiseParams np_dungeons;
|
||||
|
||||
MapgenV7Params();
|
||||
~MapgenV7Params() = default;
|
||||
|
@ -87,9 +87,10 @@ MapgenValleys::MapgenValleys(MapgenValleysParams *params, EmergeManager *emerge)
|
||||
noise_inter_valley_fill = new Noise(¶ms->np_inter_valley_fill,
|
||||
seed, csize.X, csize.Y + 2, csize.Z);
|
||||
// 1-down overgeneraion
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
MapgenBasic::np_cavern = params->np_cavern;
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
MapgenBasic::np_cavern = params->np_cavern;
|
||||
MapgenBasic::np_dungeons = params->np_dungeons;
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +116,8 @@ MapgenValleysParams::MapgenValleysParams():
|
||||
np_valley_profile (0.6, 0.50, v3f(512, 512, 512), 777, 1, 1.0, 2.0),
|
||||
np_cave1 (0.0, 12.0, v3f(61, 61, 61), 52534, 3, 0.5, 2.0),
|
||||
np_cave2 (0.0, 12.0, v3f(67, 67, 67), 10325, 3, 0.5, 2.0),
|
||||
np_cavern (0.0, 1.0, v3f(768, 256, 768), 59033, 6, 0.63, 2.0)
|
||||
np_cavern (0.0, 1.0, v3f(768, 256, 768), 59033, 6, 0.63, 2.0),
|
||||
np_dungeons (0.9, 0.5, v3f(500, 500, 500), 0, 2, 0.8, 2.0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -146,6 +148,7 @@ void MapgenValleysParams::readParams(const Settings *settings)
|
||||
settings->getNoiseParams("mgvalleys_np_cave1", np_cave1);
|
||||
settings->getNoiseParams("mgvalleys_np_cave2", np_cave2);
|
||||
settings->getNoiseParams("mgvalleys_np_cavern", np_cavern);
|
||||
settings->getNoiseParams("mgvalleys_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
@ -175,6 +178,7 @@ void MapgenValleysParams::writeParams(Settings *settings) const
|
||||
settings->setNoiseParams("mgvalleys_np_cave1", np_cave1);
|
||||
settings->setNoiseParams("mgvalleys_np_cave2", np_cave2);
|
||||
settings->setNoiseParams("mgvalleys_np_cavern", np_cavern);
|
||||
settings->setNoiseParams("mgvalleys_np_dungeons", np_dungeons);
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,6 +67,7 @@ struct MapgenValleysParams : public MapgenParams {
|
||||
NoiseParams np_cave1;
|
||||
NoiseParams np_cave2;
|
||||
NoiseParams np_cavern;
|
||||
NoiseParams np_dungeons;
|
||||
|
||||
MapgenValleysParams();
|
||||
~MapgenValleysParams() = default;
|
||||
|
Loading…
Reference in New Issue
Block a user