Skip to content

Commit

Permalink
Fine-tuned island size to generate valid maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Timm Hoffmeister committed Feb 20, 2021
1 parent 55ee25c commit 0ff9d73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions libs/s25main/mapGenerator/RandomMap.cpp
Expand Up @@ -82,11 +82,11 @@ namespace rttr { namespace mapGenerator {
if(combinedSize <= 64 * 64)
return 200;
else if(combinedSize <= 128 * 128)
return 800;
return 400;
else if(combinedSize <= 256 * 256)
return 1000;
return 600;
else if(combinedSize <= 512 * 512)
return 1100;
return 900;
else
return 1200;
}
Expand Down Expand Up @@ -231,12 +231,8 @@ namespace rttr { namespace mapGenerator {
});
SmoothHeightMap(map_.z, map_.height);

// 20% of map is center island (100% - 80% water)
const double sea = 0.80;

// 20% of center island is mountain (5% of 20% land)
const double mountain = 0.05;

const double sea = 0.80; // 20% of map is center island (100% - 80% water)
const double mountain = 0.05; // 20% of center island is mountain (5% of 20% land)
const auto seaLevel = LimitFor(map_.z, sea, map_.height.minimum);

ResetSeaLevel(map_, rnd_, seaLevel);
Expand Down
2 changes: 1 addition & 1 deletion tests/s25Main/mapGenerator/testRandomMap.cpp
Expand Up @@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE(GenerateRandomMap_returns_valid_water_map)
loadGameData(worldDesc);
MapSettings settings;

settings.size = getRandomMapSize(84, 100); // Need enough space for player islands
settings.size = getRandomMapSize(78, 90); // Need enough space for player islands
settings.numPlayers = rttr::test::randomValue(2u, MAX_PLAYERS);
settings.style = MapStyle::Water;

Expand Down

0 comments on commit 0ff9d73

Please sign in to comment.