tweaked mapgen

pull/1/head
Perttu Ahola 2011-02-28 21:12:01 +02:00
parent c137946a3f
commit f923c1fb66
1 changed files with 64 additions and 11 deletions

View File

@ -2005,7 +2005,7 @@ double contour_flat_top(double v, double r)
double base_rock_level_2d(u64 seed, v2f p) double base_rock_level_2d(u64 seed, v2f p)
{ {
// The ground level (return value) // The ground level (return value)
double h = WATER_LEVEL; double h = WATER_LEVEL-1.5;
// Raises from 0 when parameter is -1...1 // Raises from 0 when parameter is -1...1
/*double m2 = contour_flat_top(-0.8 + 2.0 * noise2d_perlin( /*double m2 = contour_flat_top(-0.8 + 2.0 * noise2d_perlin(
@ -2028,12 +2028,65 @@ double base_rock_level_2d(u64 seed, v2f p)
h += 30 * tm2;*/ h += 30 * tm2;*/
#if 1 #if 1
// Huge mountains {
double m3 = 150.0 - 500.0 * noise2d_perlin_abs( // Large mountains
0.324+(float)p.X/2000., 0.423+(float)p.Y/2000., double m3 = 100.0 - 600.0 * noise2d_perlin_abs(
(seed>>32)+985251, 9, 0.55); 0.324+(float)p.X/2000., 0.423+(float)p.Y/2000.,
if(m3 > h) (seed>>32)+985251, 9, 0.55);
h = m3; if(m3 > h)
h = m3;
}
#endif
#if 1
{
// Pretty neat looking mountains
double m4 = 100.0 - 400.0 * noise2d_perlin_abs(
0.324+(float)p.X/2000., 0.423+(float)p.Y/2000.,
(seed>>32)+65012102, 8, 0.6);
if(m4 > h)
h = m4;
}
#endif
#if 0
{
// More neat looking mountain ranges
double d = 100;
double a1 = d*2 - d*5 * noise2d_perlin_abs(
0.5+(float)p.X/500., 0.5+(float)p.Y/500.,
seed+850342, 6, 0.55);
/*if(a1 > d)
a1 = d + sqrt(a1-d);*/
a1 = (1.0 - exp(-a1/d))*d;
/*if(a1 > h)
h = a1;*/
if(a1 > 0)
h += a1;
}
#endif
#if 1
{
// Very steep mountain ranges
double d = 150;
double a1 = d*2 - d*7.5 * noise2d_perlin_abs(
0.5+(float)p.X/500., 0.5+(float)p.Y/500.,
seed+850342, 6, 0.6);
/*if(a1 > d)
a1 = d + sqrt(a1-d);*/
a1 = (1.0 - exp(-a1/d))*d;
/*if(a1 > h)
h = a1;*/
if(a1 > 0)
h += a1;
/*double a = noise2d_perlin_abs(
0.94+(float)p.X/2000., 0.26+(float)p.Y/2000.,
(seed>>32)+65012102, 8, 0.50);
double m4 = 100.0 - 400.0 * a;
if(m4 > h)
h = m4;*/
}
#endif #endif
#if 1 #if 1
@ -2053,7 +2106,7 @@ double base_rock_level_2d(u64 seed, v2f p)
#endif #endif
#if 1 #if 1
double base = -5. + 25. * noise2d_perlin( double base = -2. + 25. * noise2d_perlin(
0.5+(float)p.X/500., 0.5+(float)p.Y/500., 0.5+(float)p.X/500., 0.5+(float)p.Y/500.,
(seed>>32)+653876, 7, 0.6); (seed>>32)+653876, 7, 0.6);
#else #else
@ -4151,7 +4204,7 @@ MapBlock * ServerMap::generateBlock(
v3f p_map_f = p_nodes_f + checklist[i]*MAP_BLOCKSIZE; v3f p_map_f = p_nodes_f + checklist[i]*MAP_BLOCKSIZE;
double depth_guess; double depth_guess;
bool is_ground = is_base_ground(m_seed, p_map_f, &depth_guess); /*bool is_ground =*/ is_base_ground(m_seed, p_map_f, &depth_guess);
// Estimate the surface height // Estimate the surface height
float surface_y_f = p_map_f.Y + depth_guess; float surface_y_f = p_map_f.Y + depth_guess;
@ -4456,7 +4509,7 @@ MapBlock * ServerMap::generateBlock(
//dstream<<"generateBlock(): Getting local attributes"<<std::endl; //dstream<<"generateBlock(): Getting local attributes"<<std::endl;
float caves_amount = 0.5; //float caves_amount = 0.5;
#if 0 #if 0
{ {
@ -4474,11 +4527,11 @@ MapBlock * ServerMap::generateBlock(
//dstream<<"generateBlock(): Done"<<std::endl; //dstream<<"generateBlock(): Done"<<std::endl;
#if 0
// Set to true if has caves. // Set to true if has caves.
// Set when some non-air is changed to air when making caves. // Set when some non-air is changed to air when making caves.
bool has_dungeons = false; bool has_dungeons = false;
#if 0
/* /*
Generate dungeons Generate dungeons
*/ */