mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
v1.5.32 - resolve conflicts
This commit is contained in:
parent
79584fffac
commit
67ec838160
7 changed files with 465 additions and 361 deletions
32
main.js
32
main.js
|
|
@ -545,7 +545,6 @@ function generate() {
|
|||
reGraph();
|
||||
drawCoastline();
|
||||
|
||||
elevateLakes();
|
||||
Rivers.generate();
|
||||
defineBiomes();
|
||||
|
||||
|
|
@ -626,7 +625,7 @@ function calculateVoronoi(graph, points) {
|
|||
TIME && console.timeEnd("calculateDelaunay");
|
||||
|
||||
TIME && console.time("calculateVoronoi");
|
||||
const voronoi = Voronoi(delaunay, allPoints, n);
|
||||
const voronoi = new Voronoi(delaunay, allPoints, n);
|
||||
graph.cells = voronoi.cells;
|
||||
graph.cells.i = n < 65535 ? Uint16Array.from(d3.range(n)) : Uint32Array.from(d3.range(n)); // array of indexes
|
||||
graph.vertices = voronoi.vertices;
|
||||
|
|
@ -1137,22 +1136,6 @@ function reMarkFeatures() {
|
|||
TIME && console.timeEnd("reMarkFeatures");
|
||||
}
|
||||
|
||||
// temporary elevate some lakes to resolve depressions and flux the water to form an open (exorheic) lake
|
||||
function elevateLakes() {
|
||||
if (templateInput.value === "Atoll") return; // no need for Atolls
|
||||
TIME && console.time('elevateLakes');
|
||||
const cells = pack.cells, features = pack.features;
|
||||
const maxCells = cells.i.length / 100; // size limit; let big lakes be closed (endorheic)
|
||||
cells.i.forEach(i => {
|
||||
if (cells.h[i] >= 20) return;
|
||||
if (features[cells.f[i]].group !== "freshwater" || features[cells.f[i]].cells > maxCells) return;
|
||||
cells.h[i] = 20;
|
||||
//debug.append("circle").attr("cx", cells.p[i][0]).attr("cy", cells.p[i][1]).attr("r", .5).attr("fill", "blue");
|
||||
});
|
||||
|
||||
TIME && console.timeEnd('elevateLakes');
|
||||
}
|
||||
|
||||
// assign biome id for each cell
|
||||
function defineBiomes() {
|
||||
TIME && console.time("defineBiomes");
|
||||
|
|
@ -1160,7 +1143,6 @@ function defineBiomes() {
|
|||
cells.biome = new Uint8Array(cells.i.length); // biomes array
|
||||
|
||||
for (const i of cells.i) {
|
||||
if (f[cells.f[i]].group === "freshwater") cells.h[i] = 19; // de-elevate lakes; here to save some resources
|
||||
const t = temp[cells.g[i]]; // cell temperature
|
||||
const h = cells.h[i]; // cell height
|
||||
const m = h < 20 ? 0 : calculateMoisture(i); // cell moisture
|
||||
|
|
@ -1718,11 +1700,7 @@ function addZones(number = 1) {
|
|||
function showStatistics() {
|
||||
const template = templateInput.value;
|
||||
const templateRandom = locked("template") ? "" : "(random)";
|
||||
|
||||
mapId = Date.now(); // unique map id is it's creation date number
|
||||
mapHistory.push({seed, width:graphWidth, height:graphHeight, template, created:mapId});
|
||||
console.log(`
|
||||
Seed: ${seed}
|
||||
const stats = ` Seed: ${seed}
|
||||
Canvas size: ${graphWidth}x${graphHeight}
|
||||
Template: ${template} ${templateRandom}
|
||||
Points: ${grid.points.length}
|
||||
|
|
@ -1733,7 +1711,11 @@ function showStatistics() {
|
|||
Burgs: ${pack.burgs.length-1}
|
||||
Religions: ${pack.religions.length-1}
|
||||
Culture set: ${culturesSet.selectedOptions[0].innerText}
|
||||
Cultures: ${pack.cultures.length-1}`);
|
||||
Cultures: ${pack.cultures.length-1}`;
|
||||
|
||||
mapId = Date.now(); // unique map id is it's creation date number
|
||||
mapHistory.push({seed, width:graphWidth, height:graphHeight, template, created:mapId});
|
||||
INFO && console.log(stats);
|
||||
}
|
||||
|
||||
const regenerateMap = debounce(function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue