Inner Sea map type (#5535)

* Inner Sea map type

* space in templates
This commit is contained in:
SimonCeder
2021-10-21 22:51:24 +02:00
committed by GitHub
parent cb4aef7b35
commit 9b798b3588
4 changed files with 17 additions and 4 deletions

View File

@ -320,6 +320,7 @@ Perlin =
Continents =
Four Corners =
Archipelago =
Inner Sea =
Number of City-States =
One City Challenge =
No Barbarians =

View File

@ -117,6 +117,7 @@ object MapType {
const val fourCorners = "Four Corners"
const val perlin = "Perlin"
const val archipelago = "Archipelago"
const val innerSea = "Inner Sea"
// Cellular automata
const val default = "Default"

View File

@ -20,7 +20,8 @@ class MapLandmassGenerator(val ruleset: Ruleset, val randomness: MapGenerationRa
}
when (tileMap.mapParameters.type) {
MapType.pangaea -> createPangea(tileMap)
MapType.pangaea -> createPangaea(tileMap)
MapType.innerSea -> createInnerSea(tileMap)
MapType.continents -> createTwoContinents(tileMap)
MapType.fourCorners -> createFourCorners(tileMap)
MapType.perlin -> createPerlin(tileMap)
@ -70,7 +71,7 @@ class MapLandmassGenerator(val ruleset: Ruleset, val randomness: MapGenerationRa
}
}
private fun createPangea(tileMap: TileMap) {
private fun createPangaea(tileMap: TileMap) {
val elevationSeed = randomness.RNG.nextInt().toDouble()
for (tile in tileMap.values) {
var elevation = randomness.getPerlinNoise(tile, elevationSeed)
@ -79,6 +80,15 @@ class MapLandmassGenerator(val ruleset: Ruleset, val randomness: MapGenerationRa
}
}
private fun createInnerSea(tileMap: TileMap) {
val elevationSeed = randomness.RNG.nextInt().toDouble()
for (tile in tileMap.values) {
var elevation = randomness.getPerlinNoise(tile, elevationSeed)
elevation -= getEllipticContinent(tile, tileMap, 0.6) * 0.3
spawnLandOrWater(tile, elevation, tileMap.mapParameters.waterThreshold.toDouble())
}
}
private fun createTwoContinents(tileMap: TileMap) {
val elevationSeed = randomness.RNG.nextInt().toDouble()
for (tile in tileMap.values) {
@ -101,9 +111,9 @@ class MapLandmassGenerator(val ruleset: Ruleset, val randomness: MapGenerationRa
* Create an elevation map that favors a central elliptic continent spanning over 85% - 95% of
* the map size.
*/
private fun getEllipticContinent(tileInfo: TileInfo, tileMap: TileMap): Double {
private fun getEllipticContinent(tileInfo: TileInfo, tileMap: TileMap, percentOfMap: Double = 0.85): Double {
val randomScale = randomness.RNG.nextDouble()
val ratio = 0.85 + 0.1 * randomness.RNG.nextDouble()
val ratio = percentOfMap + 0.1 * randomness.RNG.nextDouble()
val a = ratio * tileMap.maxLongitude
val b = ratio * tileMap.maxLatitude

View File

@ -76,6 +76,7 @@ class MapParametersTable(
MapType.fourCorners,
MapType.perlin,
MapType.archipelago,
MapType.innerSea,
if (isEmptyMapAllowed) MapType.empty else null
)