mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-10 10:58:13 +07:00
Add Temperature Offset Slider (#7891)
* Add slider Align spawnIce latitude and offset code to applyHumidityAndTemperature * A bunch of debug code Make default Water Level -0.05 for Default * Remove debug println Fix Desert at 0.9-1.0 temp and <0.2 humidity * Disable reseed for debug comparison Reset Plains/Grassland for high temp. Adjust max humidity for safety of Grasslands Humidity debugger Better slider * Remove all debug code * Undo Desert temp setting
This commit is contained in:
parent
c39aca7a31
commit
55e6541ee0
@ -15,34 +15,34 @@
|
||||
"movementCost": 1,
|
||||
"RGB": [107,167,193],
|
||||
"uniques": ["[+2] to Fertility for Map Generation",
|
||||
"Considered [Desirable] when determining start locations <on water maps>",
|
||||
"Every [60] tiles with this terrain will receive a major deposit of a strategic resource."]
|
||||
"Considered [Desirable] when determining start locations <on water maps>",
|
||||
"Every [60] tiles with this terrain will receive a major deposit of a strategic resource."]
|
||||
},
|
||||
{
|
||||
"name": "Grassland",
|
||||
"type": "Land",
|
||||
"food": 2,
|
||||
"movementCost": 1,
|
||||
"RGB": [97,171,58],
|
||||
"uniques": ["Occurs at temperature between [-0.4] and [0.1] and humidity between [0.2] and [0.4]",
|
||||
"Occurs at temperature between [0.1] and [0.2] and humidity between [0.3] and [0.4]",
|
||||
"Occurs at temperature between [-0.5] and [0.5] and humidity between [0.6] and [0.8]",
|
||||
"Occurs at temperature between [-0.5] and [1] and humidity between [0.9] and [1]",
|
||||
"Occurs at temperature between [0.9] and [1] and humidity between [0.2] and [0.9]",
|
||||
"Occurs at temperature between [0.8] and [0.9] and humidity between [0.6] and [0.9]",
|
||||
"Occurs at temperature between [0.7] and [0.8] and humidity between [0.7] and [0.9]",
|
||||
"Occurs at temperature between [0.6] and [0.8] and humidity between [0.4] and [0.6]",
|
||||
"[+3] to Fertility for Map Generation",
|
||||
"A Region is formed with at least [30]% [Grassland] tiles, with priority [7]",
|
||||
"A Region can not contain more [Plains] tiles than [Grassland] tiles",
|
||||
"Considered [Desirable] when determining start locations",
|
||||
"Considered [Food] when determining start locations <in [Jungle] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Forest] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Hill] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Grassland] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Hybrid] Regions>",
|
||||
"Every [33] tiles with this terrain will receive a major deposit of a strategic resource."]
|
||||
},
|
||||
"RGB": [97,171,58],
|
||||
"uniques": ["Occurs at temperature between [-0.4] and [0.1] and humidity between [0.2] and [0.4]",
|
||||
"Occurs at temperature between [0.1] and [0.2] and humidity between [0.3] and [0.4]",
|
||||
"Occurs at temperature between [-0.5] and [0.5] and humidity between [0.6] and [0.8]",
|
||||
"Occurs at temperature between [-0.5] and [1] and humidity between [0.9] and [1]",
|
||||
"Occurs at temperature between [0.9] and [1] and humidity between [0.2] and [1]",
|
||||
"Occurs at temperature between [0.8] and [0.9] and humidity between [0.6] and [1]",
|
||||
"Occurs at temperature between [0.7] and [0.8] and humidity between [0.7] and [1]",
|
||||
"Occurs at temperature between [0.6] and [0.8] and humidity between [0.4] and [0.6]",
|
||||
"[+3] to Fertility for Map Generation",
|
||||
"A Region is formed with at least [30]% [Grassland] tiles, with priority [7]",
|
||||
"A Region can not contain more [Plains] tiles than [Grassland] tiles",
|
||||
"Considered [Desirable] when determining start locations",
|
||||
"Considered [Food] when determining start locations <in [Jungle] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Forest] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Hill] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Grassland] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Hybrid] Regions>",
|
||||
"Every [33] tiles with this terrain will receive a major deposit of a strategic resource."]
|
||||
},
|
||||
{
|
||||
"name": "Plains",
|
||||
"type": "Land",
|
||||
@ -51,26 +51,25 @@
|
||||
"movementCost": 1,
|
||||
"RGB": [168,185,102],
|
||||
"uniques": ["Occurs at temperature between [-0.4] and [-0.1] and humidity between [0] and [0.2]",
|
||||
"Occurs at temperature between [-0.4] and [0.4] and humidity between [0.4] and [0.6]",
|
||||
"Occurs at temperature between [0.4] and [0.5] and humidity between [0.5] and [0.6]",
|
||||
"Occurs at temperature between [-0.6] and [0.7] and humidity between [0.8] and [0.9]",
|
||||
"Occurs at temperature between [-0.6] and [-0.5] and humidity between [0.9] and [1]",
|
||||
"Occurs at temperature between [0.5] and [0.7] and humidity between [0.7] and [0.8]",
|
||||
"Occurs at temperature between [0.9] and [1] and humidity between [0] and [0.2]",
|
||||
"Occurs at temperature between [0.8] and [0.9] and humidity between [0.2] and [0.6]",
|
||||
"Occurs at temperature between [0.7] and [0.8] and humidity between [0.3] and [0.4]",
|
||||
"Occurs at temperature between [0.6] and [0.8] and humidity between [0.6] and [0.7]",
|
||||
"Occurs at temperature between [0.5] and [0.7] and humidity between [0.7] and [0.8]",
|
||||
"[+4] to Fertility for Map Generation",
|
||||
"A Region is formed with at least [30]% [Plains] tiles, with priority [6]",
|
||||
"A Region can not contain more [Grassland] tiles than [Plains] tiles",
|
||||
"Considered [Desirable] when determining start locations",
|
||||
"Considered [Food] when determining start locations <in [Tundra] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Desert] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Hill] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Plains] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Hybrid] Regions>",
|
||||
"Every [33] tiles with this terrain will receive a major deposit of a strategic resource."]
|
||||
"Occurs at temperature between [-0.4] and [0.4] and humidity between [0.4] and [0.6]",
|
||||
"Occurs at temperature between [0.4] and [0.5] and humidity between [0.5] and [0.6]",
|
||||
"Occurs at temperature between [-0.6] and [0.7] and humidity between [0.8] and [0.9]",
|
||||
"Occurs at temperature between [-0.6] and [-0.5] and humidity between [0.9] and [1]",
|
||||
"Occurs at temperature between [0.9] and [1] and humidity between [0] and [0.2]",
|
||||
"Occurs at temperature between [0.8] and [0.9] and humidity between [0.2] and [0.6]",
|
||||
"Occurs at temperature between [0.7] and [0.8] and humidity between [0.3] and [0.4]",
|
||||
"Occurs at temperature between [0.6] and [0.8] and humidity between [0.6] and [0.7]",
|
||||
"Occurs at temperature between [0.5] and [0.7] and humidity between [0.7] and [0.8]",
|
||||
"[+4] to Fertility for Map Generation",
|
||||
"A Region is formed with at least [30]% [Plains] tiles, with priority [6]",
|
||||
"A Region can not contain more [Grassland] tiles than [Plains] tiles",
|
||||
"Considered [Desirable] when determining start locations",
|
||||
"Considered [Food] when determining start locations <in [Tundra] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Desert] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Hill] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Plains] Regions>",
|
||||
"Considered [Food] when determining start locations <in [Hybrid] Regions>",
|
||||
"Every [33] tiles with this terrain will receive a major deposit of a strategic resource."]
|
||||
},
|
||||
{
|
||||
"name": "Tundra",
|
||||
@ -79,16 +78,16 @@
|
||||
"movementCost": 1,
|
||||
"RGB": [189,204,191],
|
||||
"uniques": ["Occurs at temperature between [-0.9] and [-0.6] and humidity between [0.8] and [1]",
|
||||
"Occurs at temperature between [-0.8] and [-0.5] and humidity between [0.6] and [0.8]",
|
||||
"Occurs at temperature between [-0.7] and [-0.4] and humidity between [0.4] and [0.6]",
|
||||
"Occurs at temperature between [-0.6] and [-0.4] and humidity between [0.2] and [0.4]",
|
||||
"Occurs at temperature between [-0.5] and [-0.4] and humidity between [0] and [0.2]",
|
||||
"[+2] to Fertility for Map Generation",
|
||||
"A Region is formed with at least [30]% [Tundra] tiles and [Snow] tiles, with priority [1]",
|
||||
"Considered [Food] when determining start locations <in [Tundra] Regions>",
|
||||
"Considered [Desirable] when determining start locations <in [Tundra] Regions>",
|
||||
"Becomes [Plains] when adjacent to [River]",
|
||||
"Every [16] tiles with this terrain will receive a major deposit of a strategic resource."]
|
||||
"Occurs at temperature between [-0.8] and [-0.5] and humidity between [0.6] and [0.8]",
|
||||
"Occurs at temperature between [-0.7] and [-0.4] and humidity between [0.4] and [0.6]",
|
||||
"Occurs at temperature between [-0.6] and [-0.4] and humidity between [0.2] and [0.4]",
|
||||
"Occurs at temperature between [-0.5] and [-0.4] and humidity between [0] and [0.2]",
|
||||
"[+2] to Fertility for Map Generation",
|
||||
"A Region is formed with at least [30]% [Tundra] tiles and [Snow] tiles, with priority [1]",
|
||||
"Considered [Food] when determining start locations <in [Tundra] Regions>",
|
||||
"Considered [Desirable] when determining start locations <in [Tundra] Regions>",
|
||||
"Becomes [Plains] when adjacent to [River]",
|
||||
"Every [16] tiles with this terrain will receive a major deposit of a strategic resource."]
|
||||
},
|
||||
{
|
||||
"name": "Desert",
|
||||
@ -96,15 +95,15 @@
|
||||
"movementCost": 1,
|
||||
"RGB": [ 230, 230, 113],
|
||||
"uniques": ["Occurs at temperature between [-0.1] and [0.9] and humidity between [0] and [0.2]",
|
||||
"Occurs at temperature between [0.1] and [0.8] and humidity between [0.2] and [0.3]",
|
||||
"Occurs at temperature between [0.2] and [0.7] and humidity between [0.3] and [0.4]",
|
||||
"Occurs at temperature between [0.4] and [0.6] and humidity between [0.4] and [0.5]",
|
||||
"Occurs at temperature between [0.5] and [0.6] and humidity between [0.5] and [0.7]",
|
||||
"[+1] to Fertility for Map Generation",
|
||||
"A Region is formed with at least [25]% [Desert] tiles, with priority [4]",
|
||||
"Becomes [Flood plains] when adjacent to [River]",
|
||||
"Considered [Undesirable] when determining start locations <in all except [Desert] Regions>",
|
||||
"Every [13] tiles with this terrain will receive a major deposit of a strategic resource."]
|
||||
"Occurs at temperature between [0.1] and [0.8] and humidity between [0.2] and [0.3]",
|
||||
"Occurs at temperature between [0.2] and [0.7] and humidity between [0.3] and [0.4]",
|
||||
"Occurs at temperature between [0.4] and [0.6] and humidity between [0.4] and [0.5]",
|
||||
"Occurs at temperature between [0.5] and [0.6] and humidity between [0.5] and [0.7]",
|
||||
"[+1] to Fertility for Map Generation",
|
||||
"A Region is formed with at least [25]% [Desert] tiles, with priority [4]",
|
||||
"Becomes [Flood plains] when adjacent to [River]",
|
||||
"Considered [Undesirable] when determining start locations <in all except [Desert] Regions>",
|
||||
"Every [13] tiles with this terrain will receive a major deposit of a strategic resource."]
|
||||
},
|
||||
{
|
||||
"name": "Lakes",
|
||||
@ -123,27 +122,28 @@
|
||||
"defenceBonus": 0.25,
|
||||
"RGB": [120, 120, 120],
|
||||
"uniques": ["Rough terrain",
|
||||
"Has an elevation of [4] for visibility calculations",
|
||||
"Occurs in chains at high elevations",
|
||||
"Units ending their turn on this terrain take [50] damage",
|
||||
"Always Fertility [-2] for Map Generation",
|
||||
"Considered [Undesirable] when determining start locations"]
|
||||
"Has an elevation of [4] for visibility calculations",
|
||||
"Occurs in chains at high elevations",
|
||||
"Units ending their turn on this terrain take [50] damage",
|
||||
"Always Fertility [-2] for Map Generation",
|
||||
"Considered [Undesirable] when determining start locations"]
|
||||
},
|
||||
{
|
||||
"name": "Snow",
|
||||
"type": "Land",
|
||||
"movementCost": 1,
|
||||
"RGB": [231, 242, 249],
|
||||
"uniques": ["Occurs at temperature between [-1] and [-0.9] and humidity between [0] and [1]",
|
||||
"Occurs at temperature between [-0.9] and [-0.8] and humidity between [0] and [0.8]",
|
||||
"Occurs at temperature between [-0.8] and [-0.7] and humidity between [0] and [0.6]",
|
||||
"Occurs at temperature between [-0.7] and [-0.6] and humidity between [0] and [0.4]",
|
||||
"Occurs at temperature between [-0.6] and [-0.5] and humidity between [0] and [0.2]",
|
||||
"Always Fertility [-1] for Map Generation",
|
||||
"Considered [Undesirable] when determining start locations",
|
||||
"Becomes [Tundra] when adjacent to [River]",
|
||||
"Every [17] tiles with this terrain will receive a major deposit of a strategic resource.",
|
||||
"Never receives any resources <in [Hill] tiles>"]
|
||||
"uniques": [
|
||||
"Occurs at temperature between [-1] and [-0.9] and humidity between [0] and [1]",
|
||||
"Occurs at temperature between [-0.9] and [-0.8] and humidity between [0] and [0.8]",
|
||||
"Occurs at temperature between [-0.8] and [-0.7] and humidity between [0] and [0.6]",
|
||||
"Occurs at temperature between [-0.7] and [-0.6] and humidity between [0] and [0.4]",
|
||||
"Occurs at temperature between [-0.6] and [-0.5] and humidity between [0] and [0.2]",
|
||||
"Always Fertility [-1] for Map Generation",
|
||||
"Considered [Undesirable] when determining start locations",
|
||||
"Becomes [Tundra] when adjacent to [River]",
|
||||
"Every [17] tiles with this terrain will receive a major deposit of a strategic resource.",
|
||||
"Never receives any resources <in [Hill] tiles>"]
|
||||
},
|
||||
|
||||
// Terrain features
|
||||
|
@ -28,9 +28,9 @@
|
||||
"Occurs at temperature between [0.1] and [0.2] and humidity between [0.3] and [0.4]",
|
||||
"Occurs at temperature between [-0.5] and [0.5] and humidity between [0.6] and [0.8]",
|
||||
"Occurs at temperature between [-0.5] and [1] and humidity between [0.9] and [1]",
|
||||
"Occurs at temperature between [0.9] and [1] and humidity between [0.2] and [0.9]",
|
||||
"Occurs at temperature between [0.8] and [0.9] and humidity between [0.6] and [0.9]",
|
||||
"Occurs at temperature between [0.7] and [0.8] and humidity between [0.7] and [0.9]",
|
||||
"Occurs at temperature between [0.9] and [1] and humidity between [0.2] and [1]",
|
||||
"Occurs at temperature between [0.8] and [0.9] and humidity between [0.6] and [1]",
|
||||
"Occurs at temperature between [0.7] and [0.8] and humidity between [0.7] and [1]",
|
||||
"Occurs at temperature between [0.6] and [0.8] and humidity between [0.4] and [0.6]",
|
||||
"[+3] to Fertility for Map Generation",
|
||||
"A Region is formed with at least [30]% [Grassland] tiles, with priority [7]",
|
||||
@ -55,7 +55,6 @@
|
||||
"Occurs at temperature between [0.4] and [0.5] and humidity between [0.5] and [0.6]",
|
||||
"Occurs at temperature between [-0.6] and [0.7] and humidity between [0.8] and [0.9]",
|
||||
"Occurs at temperature between [-0.6] and [-0.5] and humidity between [0.9] and [1]",
|
||||
"Occurs at temperature between [0.5] and [0.7] and humidity between [0.7] and [0.8]",
|
||||
"Occurs at temperature between [0.9] and [1] and humidity between [0] and [0.2]",
|
||||
"Occurs at temperature between [0.8] and [0.9] and humidity between [0.2] and [0.6]",
|
||||
"Occurs at temperature between [0.7] and [0.8] and humidity between [0.3] and [0.4]",
|
||||
|
@ -180,9 +180,7 @@ class MapParameters : IsPartOfGameInfoSerialization {
|
||||
var resourceRichness = 0.1f
|
||||
var waterThreshold = 0.0f
|
||||
|
||||
/** Shifts temperature (after random, latitude and temperatureExtremeness).
|
||||
* For seasonal main menu background only, not user-accessible, thus transient and not cloned. */
|
||||
@Transient
|
||||
/** Shifts temperature (after random, latitude and temperatureExtremeness).*/
|
||||
var temperatureShift = 0f
|
||||
|
||||
fun clone() = MapParameters().also {
|
||||
@ -201,6 +199,7 @@ class MapParameters : IsPartOfGameInfoSerialization {
|
||||
it.maxCoastExtension = maxCoastExtension
|
||||
it.elevationExponent = elevationExponent
|
||||
it.temperatureExtremeness = temperatureExtremeness
|
||||
it.temperatureShift = temperatureShift
|
||||
it.vegetationRichness = vegetationRichness
|
||||
it.rareFeaturesRichness = rareFeaturesRichness
|
||||
it.resourceRichness = resourceRichness
|
||||
@ -218,6 +217,7 @@ class MapParameters : IsPartOfGameInfoSerialization {
|
||||
maxCoastExtension = 2
|
||||
elevationExponent = 0.7f
|
||||
temperatureExtremeness = 0.6f
|
||||
temperatureShift = 0.0f
|
||||
vegetationRichness = 0.4f
|
||||
rareFeaturesRichness = 0.05f
|
||||
resourceRichness = 0.1f
|
||||
|
@ -484,7 +484,7 @@ class MapGenerator(val ruleset: Ruleset) {
|
||||
val scale = tileMap.mapParameters.tilesPerBiomeArea.toDouble()
|
||||
val temperatureExtremeness = tileMap.mapParameters.temperatureExtremeness
|
||||
val temperatureShift = tileMap.mapParameters.temperatureShift
|
||||
val humidityShift = if (temperatureShift > 0) -temperatureShift else 0f
|
||||
val humidityShift = if (temperatureShift > 0) -temperatureShift / 2 else 0f
|
||||
|
||||
// List is OK here as it's only sequentially scanned
|
||||
val limitsMap: List<TerrainOccursRange> =
|
||||
@ -608,6 +608,7 @@ class MapGenerator(val ruleset: Ruleset) {
|
||||
val latitudeTemperature = 1.0 - 2.0 * abs(tile.latitude) / tileMap.maxLatitude
|
||||
var temperature = ((latitudeTemperature + randomTemperature) / 2.0)
|
||||
temperature = abs(temperature).pow(1.0 - tileMap.mapParameters.temperatureExtremeness) * temperature.sign
|
||||
temperature = (temperature + tileMap.mapParameters.temperatureShift).coerceIn(-1.0..1.0)
|
||||
|
||||
val candidates = iceEquivalents
|
||||
.filter {
|
||||
@ -631,6 +632,8 @@ class MapGenerationRandomness {
|
||||
|
||||
/**
|
||||
* Generates a perlin noise channel combining multiple octaves
|
||||
* Default settings generate mostly within [-0.55, 0.55], but clustered around 0.0
|
||||
* About 28% are < -0.1 and 28% are > 0.1
|
||||
*
|
||||
* @param tile Source for x / x coordinates.
|
||||
* @param seed Misnomer: actually the z value the Perlin cloud is 'cut' on.
|
||||
|
@ -203,7 +203,7 @@ class MapLandmassGenerator(val ruleset: Ruleset, val randomness: MapGenerationRa
|
||||
waterThreshold = 0.545 + 1.75 * waterThreshold
|
||||
|
||||
for (tile in tileMap.values) {
|
||||
spawnLandOrWater(tile, randomness.RNG.nextDouble())
|
||||
spawnLandOrWater(tile, randomness.RNG.nextDouble()) // RNG is [0.0, 1.0]
|
||||
tile.setTransients()
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ private object MapGeneratorStepsHelpers {
|
||||
}
|
||||
val applyHumidityAndTemperature = fun(newParameters: MapParameters, actualParameters: MapParameters) {
|
||||
actualParameters.temperatureExtremeness = newParameters.temperatureExtremeness
|
||||
actualParameters.temperatureShift = newParameters.temperatureShift
|
||||
}
|
||||
val applyLakesAndCoast = fun(newParameters: MapParameters, actualParameters: MapParameters) {
|
||||
actualParameters.maxCoastExtension = newParameters.maxCoastExtension
|
||||
|
@ -276,12 +276,23 @@ class MapParametersTable(
|
||||
return slider
|
||||
}
|
||||
|
||||
fun addSlider(text: String, getValue:()->Float, min: Float, max: Float, step: Float, onChange: (value: Float)->Unit): UncivSlider {
|
||||
val slider = UncivSlider(min, max, step, onChange = onChange, initial = getValue())
|
||||
table.add(text.toLabel()).left()
|
||||
table.add(slider).fillX().row()
|
||||
advancedSliders[slider] = getValue
|
||||
return slider
|
||||
}
|
||||
|
||||
addSlider("Map Elevation", {mapParameters.elevationExponent}, 0.6f, 0.8f)
|
||||
{ mapParameters.elevationExponent = it }
|
||||
|
||||
addSlider("Temperature extremeness", {mapParameters.temperatureExtremeness}, 0.4f, 0.8f)
|
||||
{ mapParameters.temperatureExtremeness = it }
|
||||
|
||||
addSlider("Temperature shift", {mapParameters.temperatureShift}, -0.4f, 0.4f, 0.1f)
|
||||
{ mapParameters.temperatureShift = it }
|
||||
|
||||
addSlider("Resource richness", {mapParameters.resourceRichness},0f, 0.5f)
|
||||
{ mapParameters.resourceRichness = it }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user