From 0a59605e0529f6e12bd5bdf07969643c2311e62a Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 3 Feb 2012 14:59:40 +0200 Subject: [PATCH] Tune mapgen --- src/mapgen.cpp | 60 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 74521d3a1..fd5851c98 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -70,13 +70,14 @@ static s16 find_ground_level_clever(VoxelManipulator &vmanip, v2s16 p2d, s16 y_nodes_min = vmanip.m_area.MinEdge.Y; u32 i = vmanip.m_area.index(v3s16(p2d.X, y_nodes_max, p2d.Y)); s16 y; + content_t c_tree = LEGN(ndef, "CONTENT_TREE"); + content_t c_leaves = LEGN(ndef, "CONTENT_LEAVES"); for(y=y_nodes_max; y>=y_nodes_min; y--) { MapNode &n = vmanip.m_data[i]; if(ndef->get(n).walkable - // TODO: Cache LEGN values - && n.getContent() != LEGN(ndef, "CONTENT_TREE") - && n.getContent() != LEGN(ndef, "CONTENT_LEAVES")) + && n.getContent() != c_tree + && n.getContent() != c_leaves) break; vmanip.m_area.add_y(em, i, -1); @@ -1200,9 +1201,9 @@ double base_rock_level_2d(u64 seed, v2s16 p) base = base2;*/ #if 1 // Higher ground level - double higher = (double)WATER_LEVEL + 20. + 10. * noise2d_perlin( - 0.5+(float)p.X/250., 0.5+(float)p.Y/250., - seed+85039, 4, 0.6); + double higher = (double)WATER_LEVEL + 20. + 16. * noise2d_perlin( + 0.5+(float)p.X/500., 0.5+(float)p.Y/500., + seed+85039, 5, 0.6); //higher = 30; // For debugging // Limit higher to at least base @@ -1214,11 +1215,19 @@ double base_rock_level_2d(u64 seed, v2s16 p) 0.5+(float)p.X/125., 0.5+(float)p.Y/125., seed-932, 5, 0.7); b = rangelim(b, 0.0, 1000.0); - b = pow(b, 8); + b = pow(b, 7); b *= 5; - b = rangelim(b, 3.0, 1000.0); + b = rangelim(b, 0.5, 1000.0); + // Values 1.5...100 give quite horrible looking slopes + if(b > 1.5 && b < 100.0){ + if(b < 10.0) + b = 1.5; + else + b = 100.0; + } //dstream<<"b="<seed, p2d) / 2.0; + if(mud_add_amount <= 0){ + mud_add_amount = 1 - mud_add_amount; + addnode = MapNode(c_gravel); + } + // Find ground level s16 surface_y = find_stone_level(vmanip, p2d, ndef); // Handle area not found @@ -1727,7 +1761,7 @@ void make_block(BlockMakeData *data) break; MapNode &n = vmanip.m_data[i]; - n = MapNode(c_dirt); + n = addnode; mudcount++; vmanip.m_area.add_y(em, i, 1);