Skip to content

Commit 791347b

Browse files
committed
feat: generate less water ice, v1.108.3
1 parent 12b8b94 commit 791347b

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8088,7 +8088,7 @@
80888088
<script src="config/precreated-heightmaps.js"></script>
80898089
<script src="modules/heightmap-generator.js?v=1.99.00"></script>
80908090
<script src="modules/features.js?v=1.104.0"></script>
8091-
<script src="modules/ocean-layers.js?v=1.108.1"></script>
8091+
<script src="modules/ocean-layers.js?v=1.108.3"></script>
80928092
<script src="modules/river-generator.js?v=1.106.7"></script>
80938093
<script src="modules/lakes.js?v=1.99.00"></script>
80948094
<script src="modules/biomes.js?v=1.99.00"></script>

modules/ui/layers.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -424,35 +424,33 @@ function drawIce() {
424424
const {temp, h} = cells;
425425
Math.random = aleaPRNG(seed);
426426

427-
const ICEBERG_MAX_TEMP = 1;
428-
const ICE_SHIELD_MAX_TEMP = -8;
427+
const ICEBERG_MAX_TEMP = 0;
428+
const GLACIER_MAX_TEMP = -8;
429+
const minMaxTemp = d3.min(temp);
429430

430-
// very cold: draw ice shields
431+
// cold land: draw glaciers
431432
{
432433
const type = "iceShield";
433-
const getType = cellId => (temp[cellId] <= ICE_SHIELD_MAX_TEMP ? type : null);
434+
const getType = cellId => (h[cellId] >= 20 && temp[cellId] <= GLACIER_MAX_TEMP ? type : null);
434435
const isolines = getIsolines(grid, getType, {polygons: true});
435436
isolines[type]?.polygons?.forEach(points => {
436437
const clipped = clipPoly(points);
437438
ice.append("polygon").attr("points", clipped).attr("type", type);
438439
});
439440
}
440441

441-
// mildly cold: draw icebergs
442+
// cold water: draw icebergs
442443
for (const cellId of grid.cells.i) {
443444
const t = temp[cellId];
444-
if (t > ICEBERG_MAX_TEMP) continue; // too warm: no icebergs
445-
if (t <= ICE_SHIELD_MAX_TEMP) continue; // already drawn as ice shield
446445
if (h[cellId] >= 20) continue; // no icebergs on land
446+
if (t > ICEBERG_MAX_TEMP) continue; // too warm: no icebergs
447447
if (features[cells.f[cellId]].type === "lake") continue; // no icebers on lakes
448+
if (P(0.8)) continue; // skip most of eligible cells
448449

449-
const tNormalized = normalize(t, -8, 2);
450-
const randomFactor = t > -5 ? 0.4 + rand() * 1.2 : 1;
451-
if (P(tNormalized ** 0.5 * randomFactor)) continue; // cold: skip some cells
452-
453-
let defaultSize = 1 - tNormalized; // iceberg size: 0 = zero size, 1 = full size
454-
if (cells.t[cellId] === -1) defaultSize /= 1.3; // coasline: smaller icebergs
455-
const size = minmax(rn(defaultSize * randomFactor, 2), 0.08, 1);
450+
const randomFactor = 0.8 + rand() * 0.4; // random size factor
451+
let baseSize = (1 - normalize(t, minMaxTemp, 1)) * 0.8; // size: 0 = zero size, 1 = full size
452+
if (cells.t[cellId] === -1) baseSize /= 1.3; // coasline: smaller icebergs
453+
const size = minmax(rn(baseSize * randomFactor, 2), 0.1, 1);
456454

457455
const [cx, cy] = grid.points[cellId];
458456
const points = getGridPolygon(cellId).map(([x, y]) => [rn(lerp(cx, x, size), 2), rn(lerp(cy, y, size), 2)]);

styles/default.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@
248248
},
249249
"#ice": {
250250
"opacity": 0.9,
251-
"fill": "#e8f0f6",
251+
"fill": "#f1f8fe",
252252
"stroke": "#e8f0f6",
253-
"stroke-width": 1,
254-
"filter": "url(#dropShadow05)"
253+
"stroke-width": 0.5,
254+
"filter": "url(#dropShadow01)"
255255
},
256256
"#emblems": {
257257
"opacity": 0.9,

versioning.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
1414
*/
1515

16-
const VERSION = "1.108.2";
16+
const VERSION = "1.108.3";
1717
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
1818

1919
{

0 commit comments

Comments
 (0)