From: Perttu Ahola Date: Mon, 28 Feb 2011 12:51:57 +0000 (+0200) Subject: tweaked mapgen X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=231386d50192a798fd30d49ae758da254f4a9db1;p=zefram%2Fminetest%2Fminetest_engine.git tweaked mapgen --- diff --git a/data/grass.png b/data/grass.png index 47d7b11f..bfe80aec 100644 Binary files a/data/grass.png and b/data/grass.png differ diff --git a/data/mud.png b/data/mud.png index 8a72bea9..975065c4 100644 Binary files a/data/mud.png and b/data/mud.png differ diff --git a/src/main.cpp b/src/main.cpp index 2c9e9cf7..01dd93ff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -253,7 +253,8 @@ Doing now (most important at the top): * not done === Next -* Somehow generate trees +* Generate trees better + - Add a "trees_added" flag to sector, or something === Fixmes * Check the fixmes in the list above @@ -275,7 +276,6 @@ Doing now (most important at the top): * Switch to using a safe way for the self and env pointers * Make some global environment hooks, like node placed and general on_step() -* Map should make the appropriate MapEditEvents * Add a global Lua spawn handler and such * Get rid of MapBlockObjects * Other players could be sent to clients as LuaCAOs @@ -1306,7 +1306,9 @@ void updateMapPlotTexture(v2f centerpos, video::IVideoDriver* driver, c.set(255, 160, 160, 160); else if(h < WATER_LEVEL - 0.5) // Water c.set(255, 50, 50, 255); - else if(h < WATER_LEVEL + 2) // Sand + else if(h < WATER_LEVEL + 2 + && get_have_sand(client->getMapSeed(), pf)) + // Sand c.set(255, 237, 201, 175); #if 1 else if(h < WATER_LEVEL + 10) // Green diff --git a/src/map.cpp b/src/map.cpp index bca56a6f..6ba0f0d1 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1875,9 +1875,9 @@ void make_tree(VoxelManipulator &vmanip, v3s16 p0) MapNode treenode(CONTENT_TREE); MapNode leavesnode(CONTENT_LEAVES); - vmanip.emerge(VoxelArea(p0-v3s16(2,0,2),p0+v3s16(2,6,2))); + vmanip.emerge(VoxelArea(p0-v3s16(2,0,2),p0+v3s16(2,7+2,2))); - s16 trunk_h = myrand_range(3, 6); + s16 trunk_h = myrand_range(4, 7); v3s16 p1 = p0; for(s16 ii=0; ii -0.15); +} + // -1->0, 0->1, 1->0 double contour(double v) { @@ -2014,46 +2022,52 @@ double base_rock_level_2d(u64 seed, v2f p) //h += 30 * m2; }*/ - // Huge mountains - double m3 = 150.0 - 800.0 * noise2d_perlin_abs( - 0.5+(float)p.X/2000., 0.5+(float)p.Y/2000., - (seed>>32)+985251, 9, 0.5); - if(m3 > h) - h = m3; - /*double tm2 = contour_flat_top(-1.0 + 3.0 * noise2d_perlin( 0.0+(float)p.X/300., 0.0+(float)p.Y/300., (seed>>32)+78593, 5, 0.55), 0.15); h += 30 * tm2;*/ #if 1 + // Huge mountains + double m3 = 150.0 - 500.0 * noise2d_perlin_abs( + 0.324+(float)p.X/2000., 0.423+(float)p.Y/2000., + (seed>>32)+985251, 9, 0.55); + if(m3 > h) + h = m3; +#endif + +#if 1 + // Some kind of hill chains or something { - double a1 = 30 - 100. * noise2d_perlin_abs( - 0.5+(float)p.X/250., 0.5+(float)p.Y/250., - seed+850342, 5, 0.63); + double a1 = 30 - 130. * noise2d_perlin_abs( + 0.5+(float)p.X/500., 0.5+(float)p.Y/500., + seed+850342, 6, 0.63); double d = 15; if(a1 > d) a1 = d + sqrt(a1-d); - if(a1 > h) - h = a1; + /*if(a1 > h) + h = a1;*/ + if(a1 > 0) + h += a1; } #endif #if 1 - double base = 35. * noise2d_perlin( + double base = -5. + 25. * noise2d_perlin( 0.5+(float)p.X/500., 0.5+(float)p.Y/500., - (seed>>32)+653876, 7, 0.55); + (seed>>32)+653876, 7, 0.6); #else double base = 0; #endif #if 1 - double higher = 50. * noise2d_perlin( + double higher = 40. * noise2d_perlin( 0.5+(float)p.X/250., 0.5+(float)p.Y/250., - seed+39292, 6, 0.63); + seed+39292, 7, 0.55); /*double higher = 50. * noise2d_perlin_abs( 0.5+(float)p.X/250., 0.5+(float)p.Y/250., seed+85039, 5, 0.63);*/ + //higher = 25; if(higher > base) { @@ -2062,24 +2076,43 @@ double base_rock_level_2d(u64 seed, v2f p) 0.5+(float)p.X/250., 0.5+(float)p.Y/250., seed-932, 7, 0.7); b = rangelim(b, 0.0, 1000.0); +#if 1 b = pow(b, 5); - b *= 7; + b *= 16; b = rangelim(b, 3.0, 1000.0); //dstream<<"b="<= surface_y_max + d_up && block_low_y_f > WATER_LEVEL + d_up) @@ -4152,14 +4197,14 @@ MapBlock * ServerMap::generateBlock( block_type = BT_SURFACE; } - if(block_type == BT_GROUND || block_type == BT_SKY) + if(/*block_type == BT_GROUND ||*/ block_type == BT_SKY) { lowest_ground_y = surface_y_min; highest_ground_y = surface_y_max; } } - if(block_type == BT_SURFACE) + if(block_type == BT_SURFACE || block_type == BT_GROUND) { /* Generate ground precisely @@ -4204,9 +4249,11 @@ MapBlock * ServerMap::generateBlock( Calculate material */ + v3f real_pos_f = intToFloat(real_pos, 1); + v2f real_pos_f_2d(real_pos_f.X, real_pos_f.Z); double depth_guess; bool is_ground = is_base_ground(m_seed, - intToFloat(real_pos, 1), &depth_guess); + real_pos_f, &depth_guess); // Estimate the surface height float surface_y_f = (float)real_y + depth_guess; @@ -4243,9 +4290,13 @@ MapBlock * ServerMap::generateBlock( // If it's surface_depth under ground, it's stone if((float)real_y <= surface_y_f - surface_depth - 0.75) { - n.d = CONTENT_STONE; + if(is_underground_mud(m_seed, real_pos_f)) + n.d = CONTENT_MUD; + else + n.d = CONTENT_STONE; } - else if(surface_y_f <= WATER_LEVEL + 2.0) + else if(surface_y_f <= WATER_LEVEL + 2.1 + && get_have_sand(m_seed, real_pos_f_2d)) { n.d = CONTENT_SAND; } @@ -4357,7 +4408,7 @@ MapBlock * ServerMap::generateBlock( MapNode n_fill; if(block_type == BT_GROUND) { - n_fill.d = CONTENT_STONE; + //n_fill.d = CONTENT_STONE; } else if(block_type == BT_SKY) { @@ -4838,13 +4889,14 @@ continue_generating: /* Add trees */ +#if 1 if(some_part_underground && !completely_underground) { MapVoxelManipulator vm(this); double a = tree_amount_2d(m_seed, v2s16(p_nodes.X+8, p_nodes.Z+8)); u16 tree_count = (u16)(a*MAP_BLOCKSIZE*MAP_BLOCKSIZE); - for(u16 i=0; i