Skip to content

Commit

Permalink
Add flags and lacunarity as new noise parameters
Browse files Browse the repository at this point in the history
Add 'absolute value' option to noise map functions
Extend persistence modulation to 3D noise
Extend 'eased' option to noise2d_perlin* functions
Some noise.cpp formatting fixups
  • Loading branch information
kwolekr committed Dec 8, 2014
1 parent 638f3a8 commit 2fd3d52
Show file tree
Hide file tree
Showing 16 changed files with 305 additions and 213 deletions.
2 changes: 1 addition & 1 deletion src/cavegen.cpp
Expand Up @@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapgen_v7.h"
#include "cavegen.h"

NoiseParams nparams_caveliquids(0, 1, v3f(150.0, 150.0, 150.0), 776, 3, 0.6);
NoiseParams nparams_caveliquids(0, 1, v3f(150.0, 150.0, 150.0), 776, 3, 0.6, 2.0);


///////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 3 additions & 3 deletions src/dungeongen.cpp
Expand Up @@ -31,9 +31,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,

//#define DGEN_USE_TORCHES

NoiseParams nparams_dungeon_rarity(0.0, 1.0, v3f(500.0, 500.0, 500.0), 0, 2, 0.8);
NoiseParams nparams_dungeon_wetness(0.0, 1.0, v3f(40.0, 40.0, 40.0), 32474, 4, 1.1);
NoiseParams nparams_dungeon_density(0.0, 1.0, v3f(2.5, 2.5, 2.5), 0, 2, 1.4);
NoiseParams nparams_dungeon_rarity(0.0, 1.0, v3f(500.0, 500.0, 500.0), 0, 2, 0.8, 2.0);
NoiseParams nparams_dungeon_wetness(0.0, 1.0, v3f(40.0, 40.0, 40.0), 32474, 4, 1.1, 2.0);
NoiseParams nparams_dungeon_density(0.0, 1.0, v3f(2.5, 2.5, 2.5), 0, 2, 1.4, 2.0);


///////////////////////////////////////////////////////////////////////////////
Expand Down
26 changes: 13 additions & 13 deletions src/mapgen_v5.cpp
Expand Up @@ -130,14 +130,14 @@ MapgenV5::~MapgenV5() {
MapgenV5Params::MapgenV5Params() {
spflags = MGV5_BLOBS;

np_filler_depth = NoiseParams(0, 1, v3f(150, 150, 150), 261, 4, 0.7);
np_factor = NoiseParams(0, 1, v3f(250, 250, 250), 920381, 3, 0.45);
np_height = NoiseParams(0, 10, v3f(250, 250, 250), 84174, 4, 0.5);
np_cave1 = NoiseParams(0, 6, v3f(50, 50, 50), 52534, 4, 0.5);
np_cave2 = NoiseParams(0, 6, v3f(50, 50, 50), 10325, 4, 0.5);
np_ground = NoiseParams(0, 40, v3f(80, 80, 80), 983240, 4, 0.55);
np_crumble = NoiseParams(0, 1, v3f(20, 20, 20), 34413, 3, 1.3);
np_wetness = NoiseParams(0, 1, v3f(40, 40, 40), 32474, 4, 1.1);
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_height = NoiseParams(0, 10, v3f(250, 250, 250), 84174, 4, 0.5, 2.0);
np_cave1 = NoiseParams(0, 6, v3f(50, 50, 50), 52534, 4, 0.5, 2.0, NOISE_FLAG_EASED);
np_cave2 = NoiseParams(0, 6, v3f(50, 50, 50), 10325, 4, 0.5, 2.0, NOISE_FLAG_EASED);
np_ground = NoiseParams(0, 40, v3f(80, 80, 80), 983240, 4, 0.55, 2.0, NOISE_FLAG_EASED);
np_crumble = NoiseParams(0, 1, v3f(20, 20, 20), 34413, 3, 1.3, 2.0, NOISE_FLAG_EASED);
np_wetness = NoiseParams(0, 1, v3f(40, 40, 40), 32474, 4, 1.1, 2.0);
}


Expand Down Expand Up @@ -301,16 +301,16 @@ void MapgenV5::calculateNoise() {
noise_height->perlinMap2D(x, z);
noise_height->transformNoiseMap();

noise_cave1->perlinMap3D(x, y, z, true);
noise_cave1->perlinMap3D(x, y, z);
noise_cave1->transformNoiseMap();
noise_cave2->perlinMap3D(x, y, z, true);
noise_cave2->perlinMap3D(x, y, z);
noise_cave2->transformNoiseMap();
noise_ground->perlinMap3D(x, y, z, true);
noise_ground->perlinMap3D(x, y, z);
noise_ground->transformNoiseMap();

if (spflags & MGV5_BLOBS) {
noise_crumble->perlinMap3D(x, y, z, true);
noise_wetness->perlinMap3D(x, y, z, false);
noise_crumble->perlinMap3D(x, y, z);
noise_wetness->perlinMap3D(x, y, z);
}

noise_heat->perlinMap2D(x, z);
Expand Down
22 changes: 11 additions & 11 deletions src/mapgen_v6.cpp
Expand Up @@ -122,17 +122,17 @@ MapgenV6Params::MapgenV6Params() {
freq_desert = 0.45;
freq_beach = 0.15;

np_terrain_base = NoiseParams(-4, 20.0, v3f(250.0, 250.0, 250.0), 82341, 5, 0.6);
np_terrain_higher = NoiseParams(20, 16.0, v3f(500.0, 500.0, 500.0), 85039, 5, 0.6);
np_steepness = NoiseParams(0.85,0.5, v3f(125.0, 125.0, 125.0), -932, 5, 0.7);
np_height_select = NoiseParams(0.5, 1.0, v3f(250.0, 250.0, 250.0), 4213, 5, 0.69);
np_mud = NoiseParams(4, 2.0, v3f(200.0, 200.0, 200.0), 91013, 3, 0.55);
np_beach = NoiseParams(0, 1.0, v3f(250.0, 250.0, 250.0), 59420, 3, 0.50);
np_biome = NoiseParams(0, 1.0, v3f(250.0, 250.0, 250.0), 9130, 3, 0.50);
np_cave = NoiseParams(6, 6.0, v3f(250.0, 250.0, 250.0), 34329, 3, 0.50);
np_humidity = NoiseParams(0.5, 0.5, v3f(500.0, 500.0, 500.0), 72384, 4, 0.66);
np_trees = NoiseParams(0, 1.0, v3f(125.0, 125.0, 125.0), 2, 4, 0.66);
np_apple_trees = NoiseParams(0, 1.0, v3f(100.0, 100.0, 100.0), 342902, 3, 0.45);
np_terrain_base = NoiseParams(-4, 20.0, v3f(250.0, 250.0, 250.0), 82341, 5, 0.6, 2.0);
np_terrain_higher = NoiseParams(20, 16.0, v3f(500.0, 500.0, 500.0), 85039, 5, 0.6, 2.0);
np_steepness = NoiseParams(0.85,0.5, v3f(125.0, 125.0, 125.0), -932, 5, 0.7, 2.0);
np_height_select = NoiseParams(0.5, 1.0, v3f(250.0, 250.0, 250.0), 4213, 5, 0.69, 2.0);
np_mud = NoiseParams(4, 2.0, v3f(200.0, 200.0, 200.0), 91013, 3, 0.55, 2.0);
np_beach = NoiseParams(0, 1.0, v3f(250.0, 250.0, 250.0), 59420, 3, 0.50, 2.0);
np_biome = NoiseParams(0, 1.0, v3f(250.0, 250.0, 250.0), 9130, 3, 0.50, 2.0);
np_cave = NoiseParams(6, 6.0, v3f(250.0, 250.0, 250.0), 34329, 3, 0.50, 2.0);
np_humidity = NoiseParams(0.5, 0.5, v3f(500.0, 500.0, 500.0), 72384, 4, 0.66, 2.0);
np_trees = NoiseParams(0, 1.0, v3f(125.0, 125.0, 125.0), 2, 4, 0.66, 2.0);
np_apple_trees = NoiseParams(0, 1.0, v3f(100.0, 100.0, 100.0), 342902, 3, 0.45, 2.0);
}


Expand Down
24 changes: 12 additions & 12 deletions src/mapgen_v7.cpp
Expand Up @@ -122,15 +122,15 @@ MapgenV7::~MapgenV7() {
MapgenV7Params::MapgenV7Params() {
spflags = MGV7_MOUNTAINS | MGV7_RIDGES;

np_terrain_base = NoiseParams(4, 70, v3f(300, 300, 300), 82341, 6, 0.7);
np_terrain_alt = NoiseParams(4, 25, v3f(600, 600, 600), 5934, 5, 0.6);
np_terrain_persist = NoiseParams(0.6, 0.1, v3f(500, 500, 500), 539, 3, 0.6);
np_height_select = NoiseParams(-0.5, 1, v3f(250, 250, 250), 4213, 5, 0.69);
np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 4, 0.7);
np_mount_height = NoiseParams(100, 30, v3f(500, 500, 500), 72449, 4, 0.6);
np_ridge_uwater = NoiseParams(0, 1, v3f(500, 500, 500), 85039, 4, 0.6);
np_mountain = NoiseParams(0, 1, v3f(250, 350, 250), 5333, 5, 0.68);
np_ridge = NoiseParams(0, 1, v3f(100, 100, 100), 6467, 4, 0.75);
np_terrain_base = NoiseParams(4, 70, v3f(300, 300, 300), 82341, 6, 0.7, 2.0);
np_terrain_alt = NoiseParams(4, 25, v3f(600, 600, 600), 5934, 5, 0.6, 2.0);
np_terrain_persist = NoiseParams(0.6, 0.1, v3f(500, 500, 500), 539, 3, 0.6, 2.0);
np_height_select = NoiseParams(-0.5, 1, v3f(250, 250, 250), 4213, 5, 0.69, 2.0);
np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 4, 0.7, 2.0);
np_mount_height = NoiseParams(100, 30, v3f(500, 500, 500), 72449, 4, 0.6, 2.0);
np_ridge_uwater = NoiseParams(0, 1, v3f(500, 500, 500), 85039, 4, 0.6, 2.0);
np_mountain = NoiseParams(0, 1, v3f(250, 350, 250), 5333, 5, 0.68, 2.0);
np_ridge = NoiseParams(0, 1, v3f(100, 100, 100), 6467, 4, 0.75, 2.0);
}


Expand Down Expand Up @@ -278,10 +278,10 @@ void MapgenV7::calculateNoise() {
for (int i = 0; i != csize.X * csize.Z; i++)
persistmap[i] = rangelim(persistmap[i], 0.4, 0.9);

noise_terrain_base->perlinMap2DModulated(x, z, persistmap);
noise_terrain_base->perlinMap2D(x, z, persistmap);
noise_terrain_base->transformNoiseMap();

noise_terrain_alt->perlinMap2DModulated(x, z, persistmap);
noise_terrain_alt->perlinMap2D(x, z, persistmap);
noise_terrain_alt->transformNoiseMap();

noise_filler_depth->perlinMap2D(x, z);
Expand Down Expand Up @@ -728,7 +728,7 @@ void MapgenV7::addTopNodes() {
#endif


NoiseParams nparams_v7_def_cave(6, 6.0, v3f(250.0, 250.0, 250.0), 34329, 3, 0.50);
NoiseParams nparams_v7_def_cave(6, 6.0, v3f(250.0, 250.0, 250.0), 34329, 3, 0.50, 2.0);

void MapgenV7::generateCaves(int max_stone_y) {
PseudoRandom ps(blockseed + 21343);
Expand Down
4 changes: 2 additions & 2 deletions src/mg_biome.cpp
Expand Up @@ -29,8 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,

const char *BiomeManager::ELEMENT_TITLE = "biome";

NoiseParams nparams_biome_def_heat(50, 50, v3f(500.0, 500.0, 500.0), 5349, 3, 0.70);
NoiseParams nparams_biome_def_humidity(50, 50, v3f(500.0, 500.0, 500.0), 842, 3, 0.55);
NoiseParams nparams_biome_def_heat(50, 50, v3f(500.0, 500.0, 500.0), 5349, 3, 0.70, 2.0);
NoiseParams nparams_biome_def_humidity(50, 50, v3f(500.0, 500.0, 500.0), 842, 3, 0.55, 2.0);


///////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 2fd3d52

Please sign in to comment.