forked from Mirrorlandia_minetest/minetest
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.
|
# 3D noise defining terrain.
|
||||||
mgv5_np_ground (Ground noise) noise_params_3d 0, 40, (80, 80, 80), 983240, 4, 0.55, 2.0, eased
|
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]
|
[*Mapgen V6]
|
||||||
|
|
||||||
# Map generation attributes specific to 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.
|
# 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
|
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]
|
[*Mapgen Carpathian]
|
||||||
|
|
||||||
# Map generation attributes specific to 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.
|
# 3D noise defining giant caverns.
|
||||||
mgcarpathian_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0
|
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]
|
[*Mapgen Flat]
|
||||||
|
|
||||||
# Map generation attributes specific to 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.
|
# 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
|
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]
|
[*Mapgen Fractal]
|
||||||
|
|
||||||
# Controls width of tunnels, a smaller value creates wider tunnels.
|
# 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.
|
# 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
|
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]
|
[*Mapgen Valleys]
|
||||||
|
|
||||||
# Map generation attributes specific to 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.
|
# 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
|
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]
|
[*Advanced]
|
||||||
|
|
||||||
# Size of mapchunks generated by mapgen, stated in mapblocks (16 nodes).
|
# 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
|
//#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.rooms_max = 16;
|
||||||
dp.notifytype = GENNOTIFY_DUNGEON;
|
dp.notifytype = GENNOTIFY_DUNGEON;
|
||||||
|
|
||||||
dp.np_density = nparams_dungeon_density;
|
dp.np_alt_wall =
|
||||||
dp.np_alt_wall = nparams_dungeon_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);
|
assert(vm);
|
||||||
|
|
||||||
//TimeTaker t("gen dungeons");
|
//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");
|
static const bool preserve_ignore = !g_settings->getBool("projecting_dungeons");
|
||||||
|
|
||||||
this->vm = vm;
|
this->vm = vm;
|
||||||
@ -122,7 +119,7 @@ void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add them
|
// 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);
|
makeDungeon(v3s16(1, 1, 1) * MAP_BLOCKSIZE);
|
||||||
|
|
||||||
// Optionally convert some structure to alternative structure
|
// Optionally convert some structure to alternative structure
|
||||||
|
@ -58,7 +58,6 @@ struct DungeonParams {
|
|||||||
u16 rooms_max;
|
u16 rooms_max;
|
||||||
GenNotifyType notifytype;
|
GenNotifyType notifytype;
|
||||||
|
|
||||||
NoiseParams np_density;
|
|
||||||
NoiseParams np_alt_wall;
|
NoiseParams np_alt_wall;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -83,7 +82,7 @@ public:
|
|||||||
GenerateNotifier *gennotify, DungeonParams *dparams);
|
GenerateNotifier *gennotify, DungeonParams *dparams);
|
||||||
|
|
||||||
void generate(MMVManip *vm, u32 bseed,
|
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 makeDungeon(v3s16 start_padding);
|
||||||
void makeRoom(v3s16 roomsize, v3s16 roomplace);
|
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.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
#include "mapgen.h"
|
#include "mapgen.h"
|
||||||
#include "voxel.h"
|
#include "voxel.h"
|
||||||
#include "noise.h"
|
#include "noise.h"
|
||||||
@ -889,6 +890,11 @@ void MapgenBasic::generateDungeons(s16 max_stone_y)
|
|||||||
if (max_stone_y < node_min.Y)
|
if (max_stone_y < node_min.Y)
|
||||||
return;
|
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
|
// Get biome at mapchunk midpoint
|
||||||
v3s16 chunk_mid = node_min + (node_max - node_min) / v3s16(2, 2, 2);
|
v3s16 chunk_mid = node_min + (node_max - node_min) / v3s16(2, 2, 2);
|
||||||
Biome *biome = (Biome *)biomegen->getBiomeAtPoint(chunk_mid);
|
Biome *biome = (Biome *)biomegen->getBiomeAtPoint(chunk_mid);
|
||||||
@ -902,8 +908,8 @@ void MapgenBasic::generateDungeons(s16 max_stone_y)
|
|||||||
dp.rooms_min = 2;
|
dp.rooms_min = 2;
|
||||||
dp.rooms_max = 16;
|
dp.rooms_max = 16;
|
||||||
|
|
||||||
dp.np_density = nparams_dungeon_density;
|
dp.np_alt_wall =
|
||||||
dp.np_alt_wall = nparams_dungeon_alt_wall;
|
NoiseParams(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, 1.1, 2.0);
|
||||||
|
|
||||||
// Biome-defined dungeon nodes
|
// Biome-defined dungeon nodes
|
||||||
if (biome->c_dungeon != CONTENT_IGNORE) {
|
if (biome->c_dungeon != CONTENT_IGNORE) {
|
||||||
@ -980,7 +986,7 @@ void MapgenBasic::generateDungeons(s16 max_stone_y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DungeonGen dgen(ndef, &gennotify, &dp);
|
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_cave1;
|
||||||
NoiseParams np_cave2;
|
NoiseParams np_cave2;
|
||||||
NoiseParams np_cavern;
|
NoiseParams np_cavern;
|
||||||
|
NoiseParams np_dungeons;
|
||||||
float cave_width;
|
float cave_width;
|
||||||
float cavern_limit;
|
float cavern_limit;
|
||||||
float cavern_taper;
|
float cavern_taper;
|
||||||
|
@ -88,6 +88,7 @@ MapgenCarpathian::MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager
|
|||||||
MapgenBasic::np_cave1 = params->np_cave1;
|
MapgenBasic::np_cave1 = params->np_cave1;
|
||||||
MapgenBasic::np_cave2 = params->np_cave2;
|
MapgenBasic::np_cave2 = params->np_cave2;
|
||||||
MapgenBasic::np_cavern = params->np_cavern;
|
MapgenBasic::np_cavern = params->np_cavern;
|
||||||
|
MapgenBasic::np_dungeons = params->np_dungeons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,7 +124,8 @@ MapgenCarpathianParams::MapgenCarpathianParams():
|
|||||||
np_mnt_var (0, 1, v3f(499, 499, 499), 2490, 5, 0.55, 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_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_cavern (0, 1, v3f(384, 128, 384), 723, 5, 0.63, 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_cave1", np_cave1);
|
||||||
settings->getNoiseParams("mgcarpathian_np_cave2", np_cave2);
|
settings->getNoiseParams("mgcarpathian_np_cave2", np_cave2);
|
||||||
settings->getNoiseParams("mgcarpathian_np_cavern", np_cavern);
|
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_cave1", np_cave1);
|
||||||
settings->setNoiseParams("mgcarpathian_np_cave2", np_cave2);
|
settings->setNoiseParams("mgcarpathian_np_cave2", np_cave2);
|
||||||
settings->setNoiseParams("mgcarpathian_np_cavern", np_cavern);
|
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_cave1;
|
||||||
NoiseParams np_cave2;
|
NoiseParams np_cave2;
|
||||||
NoiseParams np_cavern;
|
NoiseParams np_cavern;
|
||||||
|
NoiseParams np_dungeons;
|
||||||
|
|
||||||
MapgenCarpathianParams();
|
MapgenCarpathianParams();
|
||||||
~MapgenCarpathianParams() = default;
|
~MapgenCarpathianParams() = default;
|
||||||
|
@ -71,6 +71,7 @@ MapgenFlat::MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge)
|
|||||||
// 3D noise
|
// 3D noise
|
||||||
MapgenBasic::np_cave1 = params->np_cave1;
|
MapgenBasic::np_cave1 = params->np_cave1;
|
||||||
MapgenBasic::np_cave2 = params->np_cave2;
|
MapgenBasic::np_cave2 = params->np_cave2;
|
||||||
|
MapgenBasic::np_dungeons = params->np_dungeons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +88,8 @@ MapgenFlatParams::MapgenFlatParams():
|
|||||||
np_terrain (0, 1, v3f(600, 600, 600), 7244, 5, 0.6, 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_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_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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,6 +112,7 @@ void MapgenFlatParams::readParams(const Settings *settings)
|
|||||||
settings->getNoiseParams("mgflat_np_filler_depth", np_filler_depth);
|
settings->getNoiseParams("mgflat_np_filler_depth", np_filler_depth);
|
||||||
settings->getNoiseParams("mgflat_np_cave1", np_cave1);
|
settings->getNoiseParams("mgflat_np_cave1", np_cave1);
|
||||||
settings->getNoiseParams("mgflat_np_cave2", np_cave2);
|
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_filler_depth", np_filler_depth);
|
||||||
settings->setNoiseParams("mgflat_np_cave1", np_cave1);
|
settings->setNoiseParams("mgflat_np_cave1", np_cave1);
|
||||||
settings->setNoiseParams("mgflat_np_cave2", np_cave2);
|
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_filler_depth;
|
||||||
NoiseParams np_cave1;
|
NoiseParams np_cave1;
|
||||||
NoiseParams np_cave2;
|
NoiseParams np_cave2;
|
||||||
|
NoiseParams np_dungeons;
|
||||||
|
|
||||||
MapgenFlatParams();
|
MapgenFlatParams();
|
||||||
~MapgenFlatParams() = default;
|
~MapgenFlatParams() = default;
|
||||||
|
@ -72,6 +72,7 @@ MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge)
|
|||||||
|
|
||||||
MapgenBasic::np_cave1 = params->np_cave1;
|
MapgenBasic::np_cave1 = params->np_cave1;
|
||||||
MapgenBasic::np_cave2 = params->np_cave2;
|
MapgenBasic::np_cave2 = params->np_cave2;
|
||||||
|
MapgenBasic::np_dungeons = params->np_dungeons;
|
||||||
|
|
||||||
formula = fractal / 2 + fractal % 2;
|
formula = fractal / 2 + fractal % 2;
|
||||||
julia = fractal % 2 == 0;
|
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_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_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_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_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);
|
||||||
|
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_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);
|
||||||
|
settings->setNoiseParams("mgfractal_np_dungeons", np_dungeons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ struct MapgenFractalParams : public MapgenParams
|
|||||||
NoiseParams np_filler_depth;
|
NoiseParams np_filler_depth;
|
||||||
NoiseParams np_cave1;
|
NoiseParams np_cave1;
|
||||||
NoiseParams np_cave2;
|
NoiseParams np_cave2;
|
||||||
|
NoiseParams np_dungeons;
|
||||||
|
|
||||||
MapgenFractalParams();
|
MapgenFractalParams();
|
||||||
~MapgenFractalParams() = default;
|
~MapgenFractalParams() = default;
|
||||||
|
@ -70,6 +70,7 @@ MapgenV5::MapgenV5(MapgenV5Params *params, EmergeManager *emerge)
|
|||||||
MapgenBasic::np_cave1 = params->np_cave1;
|
MapgenBasic::np_cave1 = params->np_cave1;
|
||||||
MapgenBasic::np_cave2 = params->np_cave2;
|
MapgenBasic::np_cave2 = params->np_cave2;
|
||||||
MapgenBasic::np_cavern = params->np_cavern;
|
MapgenBasic::np_cavern = params->np_cavern;
|
||||||
|
MapgenBasic::np_dungeons = params->np_dungeons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +90,8 @@ MapgenV5Params::MapgenV5Params():
|
|||||||
np_ground (0, 40, v3f(80, 80, 80), 983240, 4, 0.55, 2.0, NOISE_FLAG_EASED),
|
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_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_cavern (0, 1, v3f(384, 128, 384), 723, 5, 0.63, 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_cave1", np_cave1);
|
||||||
settings->getNoiseParams("mgv5_np_cave2", np_cave2);
|
settings->getNoiseParams("mgv5_np_cave2", np_cave2);
|
||||||
settings->getNoiseParams("mgv5_np_cavern", np_cavern);
|
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_cave1", np_cave1);
|
||||||
settings->setNoiseParams("mgv5_np_cave2", np_cave2);
|
settings->setNoiseParams("mgv5_np_cave2", np_cave2);
|
||||||
settings->setNoiseParams("mgv5_np_cavern", np_cavern);
|
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_cave1;
|
||||||
NoiseParams np_cave2;
|
NoiseParams np_cave2;
|
||||||
NoiseParams np_cavern;
|
NoiseParams np_cavern;
|
||||||
|
NoiseParams np_dungeons;
|
||||||
|
|
||||||
MapgenV5Params();
|
MapgenV5Params();
|
||||||
~MapgenV5Params() = default;
|
~MapgenV5Params() = default;
|
||||||
|
@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
#include "mapgen.h"
|
#include "mapgen.h"
|
||||||
#include "voxel.h"
|
#include "voxel.h"
|
||||||
#include "noise.h"
|
#include "noise.h"
|
||||||
@ -59,7 +60,7 @@ MapgenV6::MapgenV6(MapgenV6Params *params, EmergeManager *emerge)
|
|||||||
: Mapgen(MAPGEN_V6, params, emerge)
|
: Mapgen(MAPGEN_V6, params, emerge)
|
||||||
{
|
{
|
||||||
m_emerge = emerge;
|
m_emerge = emerge;
|
||||||
ystride = csize.X; //////fix this
|
ystride = csize.X;
|
||||||
|
|
||||||
heightmap = new s16[csize.X * csize.Z];
|
heightmap = new s16[csize.X * csize.Z];
|
||||||
|
|
||||||
@ -74,6 +75,8 @@ MapgenV6::MapgenV6(MapgenV6Params *params, EmergeManager *emerge)
|
|||||||
np_trees = ¶ms->np_trees;
|
np_trees = ¶ms->np_trees;
|
||||||
np_apple_trees = ¶ms->np_apple_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
|
//// Create noise objects
|
||||||
noise_terrain_base = new Noise(¶ms->np_terrain_base, seed, csize.X, csize.Y);
|
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);
|
noise_terrain_higher = new Noise(¶ms->np_terrain_higher, seed, csize.X, csize.Y);
|
||||||
@ -561,6 +564,10 @@ void MapgenV6::makeChunk(BlockMakeData *data)
|
|||||||
// Add dungeons
|
// Add dungeons
|
||||||
if ((flags & MG_DUNGEONS) && stone_surface_max_y >= node_min.Y &&
|
if ((flags & MG_DUNGEONS) && stone_surface_max_y >= node_min.Y &&
|
||||||
full_node_min.Y >= dungeon_ymin && full_node_max.Y <= dungeon_ymax) {
|
full_node_min.Y >= dungeon_ymin && full_node_max.Y <= dungeon_ymax) {
|
||||||
|
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 >= 1) {
|
||||||
DungeonParams dp;
|
DungeonParams dp;
|
||||||
|
|
||||||
dp.seed = seed;
|
dp.seed = seed;
|
||||||
@ -570,8 +577,6 @@ void MapgenV6::makeChunk(BlockMakeData *data)
|
|||||||
dp.rooms_min = 2;
|
dp.rooms_min = 2;
|
||||||
dp.rooms_max = 16;
|
dp.rooms_max = 16;
|
||||||
|
|
||||||
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
|
dp.np_alt_wall
|
||||||
= NoiseParams(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, 1.1, 2.0);
|
= NoiseParams(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, 1.1, 2.0);
|
||||||
|
|
||||||
@ -602,7 +607,8 @@ void MapgenV6::makeChunk(BlockMakeData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DungeonGen dgen(ndef, &gennotify, &dp);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add top and bottom side of water to transforming_liquid queue
|
// Add top and bottom side of water to transforming_liquid queue
|
||||||
|
@ -108,6 +108,8 @@ public:
|
|||||||
NoiseParams *np_trees;
|
NoiseParams *np_trees;
|
||||||
NoiseParams *np_apple_trees;
|
NoiseParams *np_apple_trees;
|
||||||
|
|
||||||
|
NoiseParams np_dungeons;
|
||||||
|
|
||||||
float freq_desert;
|
float freq_desert;
|
||||||
float freq_beach;
|
float freq_beach;
|
||||||
s16 dungeon_ymin;
|
s16 dungeon_ymin;
|
||||||
|
@ -116,6 +116,7 @@ MapgenV7::MapgenV7(MapgenV7Params *params, EmergeManager *emerge)
|
|||||||
MapgenBasic::np_cave1 = params->np_cave1;
|
MapgenBasic::np_cave1 = params->np_cave1;
|
||||||
MapgenBasic::np_cave2 = params->np_cave2;
|
MapgenBasic::np_cave2 = params->np_cave2;
|
||||||
MapgenBasic::np_cavern = params->np_cavern;
|
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_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_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_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_cavern", np_cavern);
|
||||||
settings->getNoiseParams("mgv7_np_cave1", np_cave1);
|
settings->getNoiseParams("mgv7_np_cave1", np_cave1);
|
||||||
settings->getNoiseParams("mgv7_np_cave2", np_cave2);
|
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_cavern", np_cavern);
|
||||||
settings->setNoiseParams("mgv7_np_cave1", np_cave1);
|
settings->setNoiseParams("mgv7_np_cave1", np_cave1);
|
||||||
settings->setNoiseParams("mgv7_np_cave2", np_cave2);
|
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_cavern;
|
||||||
NoiseParams np_cave1;
|
NoiseParams np_cave1;
|
||||||
NoiseParams np_cave2;
|
NoiseParams np_cave2;
|
||||||
|
NoiseParams np_dungeons;
|
||||||
|
|
||||||
MapgenV7Params();
|
MapgenV7Params();
|
||||||
~MapgenV7Params() = default;
|
~MapgenV7Params() = default;
|
||||||
|
@ -90,6 +90,7 @@ MapgenValleys::MapgenValleys(MapgenValleysParams *params, EmergeManager *emerge)
|
|||||||
MapgenBasic::np_cave1 = params->np_cave1;
|
MapgenBasic::np_cave1 = params->np_cave1;
|
||||||
MapgenBasic::np_cave2 = params->np_cave2;
|
MapgenBasic::np_cave2 = params->np_cave2;
|
||||||
MapgenBasic::np_cavern = params->np_cavern;
|
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_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_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_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_cave1", np_cave1);
|
||||||
settings->getNoiseParams("mgvalleys_np_cave2", np_cave2);
|
settings->getNoiseParams("mgvalleys_np_cave2", np_cave2);
|
||||||
settings->getNoiseParams("mgvalleys_np_cavern", np_cavern);
|
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_cave1", np_cave1);
|
||||||
settings->setNoiseParams("mgvalleys_np_cave2", np_cave2);
|
settings->setNoiseParams("mgvalleys_np_cave2", np_cave2);
|
||||||
settings->setNoiseParams("mgvalleys_np_cavern", np_cavern);
|
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_cave1;
|
||||||
NoiseParams np_cave2;
|
NoiseParams np_cave2;
|
||||||
NoiseParams np_cavern;
|
NoiseParams np_cavern;
|
||||||
|
NoiseParams np_dungeons;
|
||||||
|
|
||||||
MapgenValleysParams();
|
MapgenValleysParams();
|
||||||
~MapgenValleysParams() = default;
|
~MapgenValleysParams() = default;
|
||||||
|
Loading…
Reference in New Issue
Block a user