mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
no permafrost biome in water
This commit is contained in:
parent
0de5b7c6cd
commit
f5cbb05f71
1 changed files with 12 additions and 12 deletions
24
main.js
24
main.js
|
|
@ -1370,22 +1370,21 @@ function reMarkFeatures() {
|
||||||
// assign biome id for each cell
|
// assign biome id for each cell
|
||||||
function defineBiomes() {
|
function defineBiomes() {
|
||||||
TIME && console.time("defineBiomes");
|
TIME && console.time("defineBiomes");
|
||||||
const cells = pack.cells,
|
const {cells} = pack;
|
||||||
f = pack.features,
|
const {temp, prec} = grid.cells;
|
||||||
temp = grid.cells.temp,
|
|
||||||
prec = grid.cells.prec;
|
|
||||||
cells.biome = new Uint8Array(cells.i.length); // biomes array
|
cells.biome = new Uint8Array(cells.i.length); // biomes array
|
||||||
|
|
||||||
for (const i of cells.i) {
|
for (const i of cells.i) {
|
||||||
const t = temp[cells.g[i]]; // cell temperature
|
const temperature = temp[cells.g[i]];
|
||||||
const h = cells.h[i]; // cell height
|
const height = cells.h[i];
|
||||||
const m = h < 20 ? 0 : calculateMoisture(i); // cell moisture
|
const moisture = height < 20 ? 0 : calculateMoisture(i);
|
||||||
cells.biome[i] = getBiomeId(m, t, h);
|
cells.biome[i] = getBiomeId(moisture, temperature, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateMoisture(i) {
|
function calculateMoisture(i) {
|
||||||
let moist = prec[cells.g[i]];
|
let moist = prec[cells.g[i]];
|
||||||
if (cells.r[i]) moist += Math.max(cells.fl[i] / 20, 2);
|
if (cells.r[i]) moist += Math.max(cells.fl[i] / 20, 2);
|
||||||
|
|
||||||
const n = cells.c[i]
|
const n = cells.c[i]
|
||||||
.filter(isLand)
|
.filter(isLand)
|
||||||
.map(c => prec[cells.g[c]])
|
.map(c => prec[cells.g[c]])
|
||||||
|
|
@ -1398,12 +1397,13 @@ function defineBiomes() {
|
||||||
|
|
||||||
// assign biome id to a cell
|
// assign biome id to a cell
|
||||||
function getBiomeId(moisture, temperature, height) {
|
function getBiomeId(moisture, temperature, height) {
|
||||||
if (temperature < -5) return 11; // permafrost biome, including sea ice
|
|
||||||
if (height < 20) return 0; // marine biome: liquid water cells
|
if (height < 20) return 0; // marine biome: liquid water cells
|
||||||
|
if (temperature < -5) return 11; // permafrost biome
|
||||||
if (moisture > 40 && temperature > -2 && (height < 25 || (moisture > 24 && height > 24))) return 12; // wetland biome
|
if (moisture > 40 && temperature > -2 && (height < 25 || (moisture > 24 && height > 24))) return 12; // wetland biome
|
||||||
const m = Math.min((moisture / 5) | 0, 4); // moisture band from 0 to 4
|
|
||||||
const t = Math.min(Math.max(20 - temperature, 0), 25); // temparature band from 0 to 25
|
const moistureBand = Math.min((moisture / 5) | 0, 4); // [0-4]
|
||||||
return biomesData.biomesMartix[m][t];
|
const temperatureBand = Math.min(Math.max(20 - temperature, 0), 25); // [0-25]
|
||||||
|
return biomesData.biomesMartix[moistureBand][temperatureBand];
|
||||||
}
|
}
|
||||||
|
|
||||||
// assess cells suitability to calculate population and rand cells for culture center and burgs placement
|
// assess cells suitability to calculate population and rand cells for culture center and burgs placement
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue