Resolved #3686 - world wrapped 'continents' map now separates continents properly

This commit is contained in:
Yair Morgenstern
2021-03-13 23:02:57 +02:00
parent aab037b409
commit 20f5672337
2 changed files with 18 additions and 11 deletions

View File

@ -89,8 +89,16 @@ class MapLandmassGenerator(val randomness: MapGenerationRandomness) {
}
private fun getTwoContinentsTransform(tileInfo: TileInfo, tileMap: TileMap): Double {
// The idea here is to create a water area separating the two land areas.
// So what we do it create a line of water in the middle - where longitude is close to 0.
val randomScale = randomness.RNG.nextDouble()
val longitudeFactor = abs(tileInfo.longitude) / tileMap.maxLongitude
var longitudeFactor = abs(tileInfo.longitude) / tileMap.maxLongitude
// If this is a world wrap, we want it to be separated on both sides -
// so we make the actual strip of water thinner, but we put it both in the middle of the map and on the edges of the map
if (tileMap.mapParameters.worldWrap)
longitudeFactor = min(longitudeFactor,
(tileMap.maxLongitude - abs(tileInfo.longitude)) / tileMap.maxLongitude) * 1.5f
return min(0.2, -1.0 + (5.0 * longitudeFactor.pow(0.6f) + randomScale) / 3.0)
}

View File

@ -68,8 +68,7 @@ class RiverGenerator(val randomness: MapGenerationRandomness){
riverCoordinateTile.hasBottomRightRiver = true
else // moved from our 5 O'Clock down in the 5 O'Clock direction - this is the 8 O'Clock river of the tile to our 4 O'Clock!
map[newCoordinate.position].hasBottomLeftRiver = true
}
else { // riverCoordinate.bottomRightOrLeft==RiverCoordinate.BottomRightOrLeft.Left
} else { // riverCoordinate.bottomRightOrLeft==RiverCoordinate.BottomRightOrLeft.Left
if (getAdjacentTiles(newCoordinate, map).contains(riverCoordinateTile)) // moved from our 7 O'Clock to our 9 O'Clock
riverCoordinateTile.hasBottomLeftRiver = true
else // moved from our 7 O'Clock down in the 7 O'Clock direction