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_mountain = NoiseParams(-0.6, 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);
np_cave1 = NoiseParams(0, 12, v3f(100, 100, 100), 52534, 4, 0.5, 2.0);
np_cave2 = NoiseParams(0, 12, v3f(100, 100, 100), 10325, 4, 0.5, 2.0);
s16 y = baseTerrainLevelAtPoint(p.X, p.Y);
// Ridge/river terrain calculation
- float width = 0.3;
+ float width = 0.2;
float uwatern = NoisePerlin2D(&noise_ridge_uwater->np, p.X, p.Y, seed) * 2;
// actually computing the depth of the ridge is much more expensive;
// if inside a river, simply guess
- if (uwatern >= -width && uwatern <= width)
+ if (fabs(uwatern) <= width)
return water_level - 10;
// Mountain terrain calculation
int y = node_min.Y;
int z = node_min.Z;
- noise_height_select->perlinMap2D(x, z);
noise_terrain_persist->perlinMap2D(x, z);
float *persistmap = noise_terrain_persist->result;
- for (int i = 0; i != csize.X * csize.Z; i++)
- persistmap[i] = rangelim(persistmap[i], 0.4, 0.9);
noise_terrain_base->perlinMap2D(x, z, persistmap);
noise_terrain_alt->perlinMap2D(x, z, persistmap);
- noise_filler_depth->perlinMap2D(x, z);
+ noise_height_select->perlinMap2D(x, z);
- if (spflags & MGV7_MOUNTAINS) {
- noise_mountain->perlinMap3D(x, y, z);
- noise_mount_height->perlinMap2D(x, z);
+ if (flags & MG_CAVES) {
+ noise_cave1->perlinMap3D(x, y, z);
+ noise_cave2->perlinMap3D(x, y, z);
}
- if (spflags & MGV7_RIDGES) {
+ if ((spflags & MGV7_RIDGES) && node_max.Y >= water_level) {
noise_ridge->perlinMap3D(x, y, z);
noise_ridge_uwater->perlinMap2D(x, z);
}
- if (flags & MG_CAVES) {
- noise_cave1->perlinMap3D(x, y, z);
- noise_cave2->perlinMap3D(x, y, z);
+ if ((spflags & MGV7_MOUNTAINS) && node_max.Y >= 0) {
+ noise_mountain->perlinMap3D(x, y, z);
+ noise_mount_height->perlinMap2D(x, z);
}
- noise_heat->perlinMap2D(x, z);
- noise_humidity->perlinMap2D(x, z);
-
+ if (node_max.Y >= water_level) {
+ noise_filler_depth->perlinMap2D(x, z);
+ noise_heat->perlinMap2D(x, z);
+ noise_humidity->perlinMap2D(x, z);
+ }
//printf("calculateNoise: %dus\n", t.stop());
}
hselect = rangelim(hselect, 0.0, 1.0);
float persist = NoisePerlin2D(&noise_terrain_persist->np, x, z, seed);
- persist = rangelim(persist, 0.4, 0.9);
noise_terrain_base->np.persist = persist;
float height_base = NoisePerlin2D(&noise_terrain_base->np, x, z, seed);
bool MapgenV7::getMountainTerrainAtPoint(int x, int y, int z)
{
float mnt_h_n = NoisePerlin2D(&noise_mount_height->np, x, z, seed);
- float height_modifier = -((float)y / mnt_h_n);
float mnt_n = NoisePerlin3D(&noise_mountain->np, x, y, z, seed);
-
- return mnt_n + height_modifier >= 0.6;
+ return mnt_n * mnt_h_n >= (float)y;
}
bool MapgenV7::getMountainTerrainFromMap(int idx_xyz, int idx_xz, int y)
{
float mounthn = noise_mount_height->result[idx_xz];
- float height_modifier = -((float)y / mounthn);
- return (noise_mountain->result[idx_xyz] + height_modifier >= 0.6);
+ float mountn = noise_mountain->result[idx_xyz];
+ return mountn * mounthn >= (float)y;
}
int MapgenV7::generateMountainTerrain(int ymax)
{
- if (node_max.Y <= water_level)
+ if (node_max.Y < 0)
return ymax;
MapNode n_stone(c_stone);
void MapgenV7::generateRidgeTerrain()
{
+ if (node_max.Y < water_level)
+ return;
+
MapNode n_water(c_water_source);
MapNode n_air(CONTENT_AIR);
u32 index = 0;
+ float width = 0.2; // TODO: figure out acceptable perlin noise values
for (s16 z = node_min.Z; z <= node_max.Z; z++)
for (s16 y = node_min.Y; y <= node_max.Y; y++) {
if (heightmap[j] < water_level - 16)
continue;
- float width = 0.2; // TODO: figure out acceptable perlin noise values
float uwatern = noise_ridge_uwater->result[j] * 2;
if (fabs(uwatern) > width)
continue;
- float widthn = (noise_terrain_persist->result[j] - 0.6) / 0.1;
- widthn = rangelim(widthn, -0.05, 0.5);
-
- float height_mod = (float)(y + 17) / 2.5;
- float width_mod = (width - fabs(uwatern));
- float nridge = noise_ridge->result[index] * (float)y / 7.0;
-
- if (y < water_level)
- nridge = -fabs(nridge) * 3.0 * widthn * 0.3;
+ float altitude = y - water_level;
+ float height_mod = (altitude + 17) / 2.5;
+ float width_mod = width - fabs(uwatern);
+ float nridge = noise_ridge->result[index] * MYMAX(altitude, 0) / 7.0;
if (nridge + width_mod * height_mod < 0.6)
continue;
void MapgenV7::dustTopNodes()
{
+ if (node_max.Y < water_level)
+ return;
+
v3s16 em = vm->m_area.getExtent();
u32 index = 0;
- if (water_level > node_max.Y)
- return;
-
for (s16 z = node_min.Z; z <= node_max.Z; z++)
for (s16 x = node_min.X; x <= node_max.X; x++, index++) {
Biome *biome = (Biome *)bmgr->get(biomemap[index]);
}
PseudoRandom ps(blockseed + 21343);
- u32 bruises_count = (ps.range(1, 6) == 1) ? ps.range(1, 2) : 0;
+ u32 bruises_count = (ps.range(1, 5) == 1) ? ps.range(1, 2) : 0;
for (u32 i = 0; i < bruises_count; i++) {
CaveV7 cave(this, &ps, true);
cave.makeCave(node_min, node_max, max_stone_y);