mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-23 12:31:24 +01:00
prepare to merge, add comments, remove fluff
This commit is contained in:
parent
f99edae5db
commit
7e02d40066
3 changed files with 25 additions and 20 deletions
5
main.js
5
main.js
|
|
@ -1635,7 +1635,6 @@ function addZones(number = 1) {
|
|||
cellsArray.push(q);
|
||||
if (cellsArray.length > power) break;
|
||||
|
||||
try {
|
||||
cells.c[q].forEach(e => {
|
||||
if (used[e]) return;
|
||||
if (cells.state[e] !== state.i) return;
|
||||
|
|
@ -1643,10 +1642,6 @@ function addZones(number = 1) {
|
|||
if (e % 4 !== 0 && !cells.c[e].some(c => cells.state[c] === neib)) return;
|
||||
queue.push(e);
|
||||
});
|
||||
} catch (er) {
|
||||
console.error('Error in rebel generation: ', q, cellsArray);
|
||||
throw er;
|
||||
}
|
||||
}
|
||||
|
||||
const rebels = rw({Rebels: 5, Insurgents: 2, Mutineers: 1, Rioters: 1, Separatists: 1, Secessionists: 1, Insurrection: 2, Rebellion: 1, Conspiracy: 2});
|
||||
|
|
|
|||
|
|
@ -35,13 +35,11 @@ window.Rivers = (function () {
|
|||
TIME && console.timeEnd("generateRivers");
|
||||
|
||||
function drainWater() {
|
||||
const pixel2 = distanceScale * distanceScale
|
||||
//const MIN_FLUX_TO_FORM_RIVER = 10 * distanceScale;
|
||||
const MIN_FLUX_TO_FORM_RIVER = 30;
|
||||
const cellsNumberModifier = (pointsInput.dataset.cells / 10000) ** 0.25;
|
||||
|
||||
const prec = grid.cells.prec;
|
||||
// const area = c => pack.cells.area[c] * pixel2;
|
||||
const area = pack.cells.area;
|
||||
const land = cells.i.filter(i => h[i] >= 20).sort((a, b) => h[b] - h[a]);
|
||||
const lakeOutCells = Lakes.setClimateData(h);
|
||||
|
|
|
|||
|
|
@ -1,17 +1,29 @@
|
|||
"use strict";
|
||||
/*
|
||||
Experimental submaping module
|
||||
Cell resampler module used by submapper and resampler (transform)
|
||||
main function: resample(options);
|
||||
*/
|
||||
|
||||
window.Submap = (function () {
|
||||
const isWater = (map, id) => map.grid.cells.h[map.pack.cells.g[id]] < 20? true: false;
|
||||
const inMap = (x,y) => x>0 && x<graphWidth && y>0 && y<graphHeight;
|
||||
|
||||
function resample(parentMap, options) {
|
||||
// generate new map based on an existing one (resampling parentMap)
|
||||
// parentMap: {seed, grid, pack} from original map
|
||||
// projection: map function from old to new coordinates or backwards
|
||||
// prj(x,y,direction:bool) -> [x',y']
|
||||
function resample(parentMap, options) { /*
|
||||
generate new map based on an existing one (resampling parentMap)
|
||||
parentMap: {seed, grid, pack} from original map
|
||||
options = {
|
||||
projection: f(Number,Number)->[Number, Number]
|
||||
function to calculate new coordinates
|
||||
inverse: g(Number,Number)->[Number, Number]
|
||||
inverse of f
|
||||
depressRivers: Bool carve out riverbeds?
|
||||
smoothHeightMap: Bool run smooth filter on heights
|
||||
addLakesInDepressions: call FMG original funtion on heightmap
|
||||
|
||||
lockMarkers: Bool Auto lock all copied markers
|
||||
lockBurgs: Bool Auto lock all copied burgs
|
||||
}
|
||||
*/
|
||||
|
||||
const projection = options.projection;
|
||||
const inverse = options.inverse;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue