mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
feat: generate less water ice, v1.108.3
This commit is contained in:
parent
12b8b941e3
commit
791347b1ee
4 changed files with 17 additions and 19 deletions
|
|
@ -8088,7 +8088,7 @@
|
||||||
<script src="config/precreated-heightmaps.js"></script>
|
<script src="config/precreated-heightmaps.js"></script>
|
||||||
<script src="modules/heightmap-generator.js?v=1.99.00"></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/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/river-generator.js?v=1.106.7"></script>
|
||||||
<script src="modules/lakes.js?v=1.99.00"></script>
|
<script src="modules/lakes.js?v=1.99.00"></script>
|
||||||
<script src="modules/biomes.js?v=1.99.00"></script>
|
<script src="modules/biomes.js?v=1.99.00"></script>
|
||||||
|
|
|
||||||
|
|
@ -424,13 +424,14 @@ function drawIce() {
|
||||||
const {temp, h} = cells;
|
const {temp, h} = cells;
|
||||||
Math.random = aleaPRNG(seed);
|
Math.random = aleaPRNG(seed);
|
||||||
|
|
||||||
const ICEBERG_MAX_TEMP = 1;
|
const ICEBERG_MAX_TEMP = 0;
|
||||||
const ICE_SHIELD_MAX_TEMP = -8;
|
const GLACIER_MAX_TEMP = -8;
|
||||||
|
const minMaxTemp = d3.min(temp);
|
||||||
|
|
||||||
// very cold: draw ice shields
|
// cold land: draw glaciers
|
||||||
{
|
{
|
||||||
const type = "iceShield";
|
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});
|
const isolines = getIsolines(grid, getType, {polygons: true});
|
||||||
isolines[type]?.polygons?.forEach(points => {
|
isolines[type]?.polygons?.forEach(points => {
|
||||||
const clipped = clipPoly(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) {
|
for (const cellId of grid.cells.i) {
|
||||||
const t = temp[cellId];
|
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 (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 (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 = 0.8 + rand() * 0.4; // random size factor
|
||||||
const randomFactor = t > -5 ? 0.4 + rand() * 1.2 : 1;
|
let baseSize = (1 - normalize(t, minMaxTemp, 1)) * 0.8; // size: 0 = zero size, 1 = full size
|
||||||
if (P(tNormalized ** 0.5 * randomFactor)) continue; // cold: skip some cells
|
if (cells.t[cellId] === -1) baseSize /= 1.3; // coasline: smaller icebergs
|
||||||
|
const size = minmax(rn(baseSize * randomFactor, 2), 0.1, 1);
|
||||||
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 [cx, cy] = grid.points[cellId];
|
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)]);
|
const points = getGridPolygon(cellId).map(([x, y]) => [rn(lerp(cx, x, size), 2), rn(lerp(cy, y, size), 2)]);
|
||||||
|
|
|
||||||
|
|
@ -248,10 +248,10 @@
|
||||||
},
|
},
|
||||||
"#ice": {
|
"#ice": {
|
||||||
"opacity": 0.9,
|
"opacity": 0.9,
|
||||||
"fill": "#e8f0f6",
|
"fill": "#f1f8fe",
|
||||||
"stroke": "#e8f0f6",
|
"stroke": "#e8f0f6",
|
||||||
"stroke-width": 1,
|
"stroke-width": 0.5,
|
||||||
"filter": "url(#dropShadow05)"
|
"filter": "url(#dropShadow01)"
|
||||||
},
|
},
|
||||||
"#emblems": {
|
"#emblems": {
|
||||||
"opacity": 0.9,
|
"opacity": 0.9,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
|
* 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");
|
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue