mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +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
@ -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.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 [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.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.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 [0.9]",
|
"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 [0.9]",
|
"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]",
|
"Occurs at temperature between [0.6] and [0.8] and humidity between [0.4] and [0.6]",
|
||||||
"[+3] to Fertility for Map Generation",
|
"[+3] to Fertility for Map Generation",
|
||||||
"A Region is formed with at least [30]% [Grassland] tiles, with priority [7]",
|
"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.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.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.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.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.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.7] and [0.8] and humidity between [0.3] and [0.4]",
|
||||||
@ -134,7 +133,8 @@
|
|||||||
"type": "Land",
|
"type": "Land",
|
||||||
"movementCost": 1,
|
"movementCost": 1,
|
||||||
"RGB": [231, 242, 249],
|
"RGB": [231, 242, 249],
|
||||||
"uniques": ["Occurs at temperature between [-1] and [-0.9] and humidity between [0] and [1]",
|
"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.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.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.7] and [-0.6] and humidity between [0] and [0.4]",
|
||||||
|
@ -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.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 [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.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.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 [0.9]",
|
"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 [0.9]",
|
"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]",
|
"Occurs at temperature between [0.6] and [0.8] and humidity between [0.4] and [0.6]",
|
||||||
"[+3] to Fertility for Map Generation",
|
"[+3] to Fertility for Map Generation",
|
||||||
"A Region is formed with at least [30]% [Grassland] tiles, with priority [7]",
|
"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.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.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.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.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.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.7] and [0.8] and humidity between [0.3] and [0.4]",
|
||||||
|
@ -180,9 +180,7 @@ class MapParameters : IsPartOfGameInfoSerialization {
|
|||||||
var resourceRichness = 0.1f
|
var resourceRichness = 0.1f
|
||||||
var waterThreshold = 0.0f
|
var waterThreshold = 0.0f
|
||||||
|
|
||||||
/** Shifts temperature (after random, latitude and temperatureExtremeness).
|
/** Shifts temperature (after random, latitude and temperatureExtremeness).*/
|
||||||
* For seasonal main menu background only, not user-accessible, thus transient and not cloned. */
|
|
||||||
@Transient
|
|
||||||
var temperatureShift = 0f
|
var temperatureShift = 0f
|
||||||
|
|
||||||
fun clone() = MapParameters().also {
|
fun clone() = MapParameters().also {
|
||||||
@ -201,6 +199,7 @@ class MapParameters : IsPartOfGameInfoSerialization {
|
|||||||
it.maxCoastExtension = maxCoastExtension
|
it.maxCoastExtension = maxCoastExtension
|
||||||
it.elevationExponent = elevationExponent
|
it.elevationExponent = elevationExponent
|
||||||
it.temperatureExtremeness = temperatureExtremeness
|
it.temperatureExtremeness = temperatureExtremeness
|
||||||
|
it.temperatureShift = temperatureShift
|
||||||
it.vegetationRichness = vegetationRichness
|
it.vegetationRichness = vegetationRichness
|
||||||
it.rareFeaturesRichness = rareFeaturesRichness
|
it.rareFeaturesRichness = rareFeaturesRichness
|
||||||
it.resourceRichness = resourceRichness
|
it.resourceRichness = resourceRichness
|
||||||
@ -218,6 +217,7 @@ class MapParameters : IsPartOfGameInfoSerialization {
|
|||||||
maxCoastExtension = 2
|
maxCoastExtension = 2
|
||||||
elevationExponent = 0.7f
|
elevationExponent = 0.7f
|
||||||
temperatureExtremeness = 0.6f
|
temperatureExtremeness = 0.6f
|
||||||
|
temperatureShift = 0.0f
|
||||||
vegetationRichness = 0.4f
|
vegetationRichness = 0.4f
|
||||||
rareFeaturesRichness = 0.05f
|
rareFeaturesRichness = 0.05f
|
||||||
resourceRichness = 0.1f
|
resourceRichness = 0.1f
|
||||||
|
@ -484,7 +484,7 @@ class MapGenerator(val ruleset: Ruleset) {
|
|||||||
val scale = tileMap.mapParameters.tilesPerBiomeArea.toDouble()
|
val scale = tileMap.mapParameters.tilesPerBiomeArea.toDouble()
|
||||||
val temperatureExtremeness = tileMap.mapParameters.temperatureExtremeness
|
val temperatureExtremeness = tileMap.mapParameters.temperatureExtremeness
|
||||||
val temperatureShift = tileMap.mapParameters.temperatureShift
|
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
|
// List is OK here as it's only sequentially scanned
|
||||||
val limitsMap: List<TerrainOccursRange> =
|
val limitsMap: List<TerrainOccursRange> =
|
||||||
@ -608,6 +608,7 @@ class MapGenerator(val ruleset: Ruleset) {
|
|||||||
val latitudeTemperature = 1.0 - 2.0 * abs(tile.latitude) / tileMap.maxLatitude
|
val latitudeTemperature = 1.0 - 2.0 * abs(tile.latitude) / tileMap.maxLatitude
|
||||||
var temperature = ((latitudeTemperature + randomTemperature) / 2.0)
|
var temperature = ((latitudeTemperature + randomTemperature) / 2.0)
|
||||||
temperature = abs(temperature).pow(1.0 - tileMap.mapParameters.temperatureExtremeness) * temperature.sign
|
temperature = abs(temperature).pow(1.0 - tileMap.mapParameters.temperatureExtremeness) * temperature.sign
|
||||||
|
temperature = (temperature + tileMap.mapParameters.temperatureShift).coerceIn(-1.0..1.0)
|
||||||
|
|
||||||
val candidates = iceEquivalents
|
val candidates = iceEquivalents
|
||||||
.filter {
|
.filter {
|
||||||
@ -631,6 +632,8 @@ class MapGenerationRandomness {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a perlin noise channel combining multiple octaves
|
* 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 tile Source for x / x coordinates.
|
||||||
* @param seed Misnomer: actually the z value the Perlin cloud is 'cut' on.
|
* @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
|
waterThreshold = 0.545 + 1.75 * waterThreshold
|
||||||
|
|
||||||
for (tile in tileMap.values) {
|
for (tile in tileMap.values) {
|
||||||
spawnLandOrWater(tile, randomness.RNG.nextDouble())
|
spawnLandOrWater(tile, randomness.RNG.nextDouble()) // RNG is [0.0, 1.0]
|
||||||
tile.setTransients()
|
tile.setTransients()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ private object MapGeneratorStepsHelpers {
|
|||||||
}
|
}
|
||||||
val applyHumidityAndTemperature = fun(newParameters: MapParameters, actualParameters: MapParameters) {
|
val applyHumidityAndTemperature = fun(newParameters: MapParameters, actualParameters: MapParameters) {
|
||||||
actualParameters.temperatureExtremeness = newParameters.temperatureExtremeness
|
actualParameters.temperatureExtremeness = newParameters.temperatureExtremeness
|
||||||
|
actualParameters.temperatureShift = newParameters.temperatureShift
|
||||||
}
|
}
|
||||||
val applyLakesAndCoast = fun(newParameters: MapParameters, actualParameters: MapParameters) {
|
val applyLakesAndCoast = fun(newParameters: MapParameters, actualParameters: MapParameters) {
|
||||||
actualParameters.maxCoastExtension = newParameters.maxCoastExtension
|
actualParameters.maxCoastExtension = newParameters.maxCoastExtension
|
||||||
|
@ -276,12 +276,23 @@ class MapParametersTable(
|
|||||||
return slider
|
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)
|
addSlider("Map Elevation", {mapParameters.elevationExponent}, 0.6f, 0.8f)
|
||||||
{ mapParameters.elevationExponent = it }
|
{ mapParameters.elevationExponent = it }
|
||||||
|
|
||||||
addSlider("Temperature extremeness", {mapParameters.temperatureExtremeness}, 0.4f, 0.8f)
|
addSlider("Temperature extremeness", {mapParameters.temperatureExtremeness}, 0.4f, 0.8f)
|
||||||
{ mapParameters.temperatureExtremeness = it }
|
{ 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)
|
addSlider("Resource richness", {mapParameters.resourceRichness},0f, 0.5f)
|
||||||
{ mapParameters.resourceRichness = it }
|
{ mapParameters.resourceRichness = it }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user