feat: generate less water ice, v1.108.3

This commit is contained in:
Azgaar 2025-02-15 17:45:16 +01:00
parent 12b8b941e3
commit 791347b1ee
4 changed files with 17 additions and 19 deletions

View file

@ -8088,7 +8088,7 @@
<script src="config/precreated-heightmaps.js"></script>
<script src="modules/heightmap-generator.js?v=1.99.00"></script>
<script src="modules/features.js?v=1.104.0"></script>
<script src="modules/ocean-layers.js?v=1.108.1"></script>
<script src="modules/ocean-layers.js?v=1.108.3"></script>
<script src="modules/river-generator.js?v=1.106.7"></script>
<script src="modules/lakes.js?v=1.99.00"></script>
<script src="modules/biomes.js?v=1.99.00"></script>

View file

@ -424,13 +424,14 @@ function drawIce() {
const {temp, h} = cells;
Math.random = aleaPRNG(seed);
const ICEBERG_MAX_TEMP = 1;
const ICE_SHIELD_MAX_TEMP = -8;
const ICEBERG_MAX_TEMP = 0;
const GLACIER_MAX_TEMP = -8;
const minMaxTemp = d3.min(temp);
// very cold: draw ice shields
// cold land: draw glaciers
{
const type = "iceShield";
const getType = cellId => (temp[cellId] <= ICE_SHIELD_MAX_TEMP ? type : null);
const getType = cellId => (h[cellId] >= 20 && temp[cellId] <= GLACIER_MAX_TEMP ? type : null);
const isolines = getIsolines(grid, getType, {polygons: true});
isolines[type]?.polygons?.forEach(points => {
const clipped = clipPoly(points);
@ -438,21 +439,18 @@ function drawIce() {
});
}
// mildly cold: draw icebergs
// cold water: draw icebergs
for (const cellId of grid.cells.i) {
const t = temp[cellId];
if (t > ICEBERG_MAX_TEMP) continue; // too warm: no icebergs
if (t <= ICE_SHIELD_MAX_TEMP) continue; // already drawn as ice shield
if (h[cellId] >= 20) continue; // no icebergs on land
if (t > ICEBERG_MAX_TEMP) continue; // too warm: no icebergs
if (features[cells.f[cellId]].type === "lake") continue; // no icebers on lakes
if (P(0.8)) continue; // skip most of eligible cells
const tNormalized = normalize(t, -8, 2);
const randomFactor = t > -5 ? 0.4 + rand() * 1.2 : 1;
if (P(tNormalized ** 0.5 * randomFactor)) continue; // cold: skip some cells
let defaultSize = 1 - tNormalized; // iceberg size: 0 = zero size, 1 = full size
if (cells.t[cellId] === -1) defaultSize /= 1.3; // coasline: smaller icebergs
const size = minmax(rn(defaultSize * randomFactor, 2), 0.08, 1);
const randomFactor = 0.8 + rand() * 0.4; // random size factor
let baseSize = (1 - normalize(t, minMaxTemp, 1)) * 0.8; // size: 0 = zero size, 1 = full size
if (cells.t[cellId] === -1) baseSize /= 1.3; // coasline: smaller icebergs
const size = minmax(rn(baseSize * randomFactor, 2), 0.1, 1);
const [cx, cy] = grid.points[cellId];
const points = getGridPolygon(cellId).map(([x, y]) => [rn(lerp(cx, x, size), 2), rn(lerp(cy, y, size), 2)]);

View file

@ -248,10 +248,10 @@
},
"#ice": {
"opacity": 0.9,
"fill": "#e8f0f6",
"fill": "#f1f8fe",
"stroke": "#e8f0f6",
"stroke-width": 1,
"filter": "url(#dropShadow05)"
"stroke-width": 0.5,
"filter": "url(#dropShadow01)"
},
"#emblems": {
"opacity": 0.9,

View file

@ -13,7 +13,7 @@
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
*/
const VERSION = "1.108.2";
const VERSION = "1.108.3";
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
{