mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
partially refactor BurgAndStates
This commit is contained in:
parent
a3043f932f
commit
456485c5e8
1 changed files with 10 additions and 4 deletions
14
main.js
14
main.js
|
|
@ -649,7 +649,13 @@ function generate() {
|
||||||
rankCells();
|
rankCells();
|
||||||
Cultures.generate();
|
Cultures.generate();
|
||||||
Cultures.expand();
|
Cultures.expand();
|
||||||
|
|
||||||
|
// temp
|
||||||
|
pack.cells.road = new Uint16Array(pack.cells.i.length);
|
||||||
|
pack.cells.crossroad = new Uint16Array(pack.cells.i.length);
|
||||||
|
|
||||||
BurgsAndStates.generate();
|
BurgsAndStates.generate();
|
||||||
|
|
||||||
Religions.generate();
|
Religions.generate();
|
||||||
BurgsAndStates.defineStateForms();
|
BurgsAndStates.defineStateForms();
|
||||||
|
|
||||||
|
|
@ -1429,15 +1435,15 @@ function getBiomeId(moisture, temperature, height) {
|
||||||
function rankCells() {
|
function rankCells() {
|
||||||
TIME && console.time('rankCells');
|
TIME && console.time('rankCells');
|
||||||
const {cells, features} = pack;
|
const {cells, features} = pack;
|
||||||
cells.s = new Int16Array(cells.i.length); // cell suitability array
|
cells.s = new Int16Array(cells.i.length); // cell suitability score
|
||||||
cells.pop = new Float32Array(cells.i.length); // cell population array
|
cells.pop = new Float32Array(cells.i.length); // cell population
|
||||||
|
|
||||||
const flMean = d3.median(cells.fl.filter((f) => f)) || 0;
|
const flMean = d3.median(cells.fl.filter((f) => f)) || 0;
|
||||||
const flMax = d3.max(cells.fl) + d3.max(cells.conf); // to normalize flux
|
const flMax = d3.max(cells.fl) + d3.max(cells.conf); // to normalize flux
|
||||||
const areaMean = d3.mean(cells.area); // to adjust population by cell area
|
const areaMean = d3.mean(cells.area); // to adjust population by cell area
|
||||||
const getResValue = (i) => (cells.resource[i] ? Resources.get(cells.resource[i])?.value : 0);
|
const getResValue = (i) => (cells.resource[i] ? Resources.get(cells.resource[i])?.value : 0); // get bonus resource scope
|
||||||
const resBonuses = [];
|
const resBonuses = [];
|
||||||
const POP_BALANCER = 1.5; // contant to ballance population to desired number not changing ranking
|
const POP_BALANCER = 1.5; // to ballance population to desired number
|
||||||
|
|
||||||
for (const i of cells.i) {
|
for (const i of cells.i) {
|
||||||
if (cells.b[i]) continue; // avoid adding burgs on map border
|
if (cells.b[i]) continue; // avoid adding burgs on map border
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue