mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
Added cell info to elevation profile and corrected some spelling
This commit is contained in:
parent
36870a3881
commit
044ea1d345
9 changed files with 31 additions and 12 deletions
|
|
@ -3023,7 +3023,7 @@
|
||||||
<div data-tip="Neutral means states relations are neither positive nor negative">Neutral</div>
|
<div data-tip="Neutral means states relations are neither positive nor negative">Neutral</div>
|
||||||
<div data-tip="Suspicion means state has a cautious distrust of another state">Suspicion</div>
|
<div data-tip="Suspicion means state has a cautious distrust of another state">Suspicion</div>
|
||||||
<div data-tip="Enemies are states at war with each other">Enemy</div>
|
<div data-tip="Enemies are states at war with each other">Enemy</div>
|
||||||
<div data-tip="Relations are unknown if states do not have enought information about each other">Unknown</div>
|
<div data-tip="Relations are unknown if states do not have enough information about each other">Unknown</div>
|
||||||
<div data-tip="Rivalry is a state of competing for dominance in the region">Rival</div>
|
<div data-tip="Rivalry is a state of competing for dominance in the region">Rival</div>
|
||||||
<div data-tip="Vassal is a state having obligation to its suzerain">Vassal</div>
|
<div data-tip="Vassal is a state having obligation to its suzerain">Vassal</div>
|
||||||
<div data-tip="Suzerain is a state having some control over its vassals">Suzerain</div>
|
<div data-tip="Suzerain is a state having some control over its vassals">Suzerain</div>
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,7 @@ const sourceDataForReference = {
|
||||||
NeedToAdd!: "Neutral means states relations are neither positive nor negative",
|
NeedToAdd!: "Neutral means states relations are neither positive nor negative",
|
||||||
NeedToAdd!: "Suspicion means shate has a cautious distrust of another state",
|
NeedToAdd!: "Suspicion means shate has a cautious distrust of another state",
|
||||||
NeedToAdd!: "Enemies are states at war with each other",
|
NeedToAdd!: "Enemies are states at war with each other",
|
||||||
NeedToAdd!: "Relations are unknown if states do not have enought information about each other",
|
NeedToAdd!: "Relations are unknown if states do not have enough information about each other",
|
||||||
NeedToAdd!: "Rivalry is a state of competing for dominance in the region",
|
NeedToAdd!: "Rivalry is a state of competing for dominance in the region",
|
||||||
NeedToAdd!: "Vassal is a state having obligation to its suzerain",
|
NeedToAdd!: "Vassal is a state having obligation to its suzerain",
|
||||||
NeedToAdd!: "Suzerain is a state having some control over its vassals",
|
NeedToAdd!: "Suzerain is a state having some control over its vassals",
|
||||||
|
|
|
||||||
2
main.js
2
main.js
|
|
@ -785,7 +785,7 @@ function generatePrecipitation() {
|
||||||
let westerly = [], easterly = [], southerly = 0, northerly = 0;
|
let westerly = [], easterly = [], southerly = 0, northerly = 0;
|
||||||
|
|
||||||
{// latitude bands
|
{// latitude bands
|
||||||
// x4 = 0-5 latitude: wet throught the year (rising zone)
|
// x4 = 0-5 latitude: wet through the year (rising zone)
|
||||||
// x2 = 5-20 latitude: wet summer (rising zone), dry winter (sinking zone)
|
// x2 = 5-20 latitude: wet summer (rising zone), dry winter (sinking zone)
|
||||||
// x1 = 20-30 latitude: dry all year (sinking zone)
|
// x1 = 20-30 latitude: dry all year (sinking zone)
|
||||||
// x2 = 30-50 latitude: wet winter (rising zone), dry summer (sinking zone)
|
// x2 = 30-50 latitude: wet winter (rising zone), dry summer (sinking zone)
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
if (sorted.length < count * 10) {
|
if (sorted.length < count * 10) {
|
||||||
count = Math.floor(sorted.length / 10);
|
count = Math.floor(sorted.length / 10);
|
||||||
if (!count) {console.warn(`There is no populated cells. Cannot generate states`); return burgs;}
|
if (!count) {console.warn(`There is no populated cells. Cannot generate states`); return burgs;}
|
||||||
else {console.warn(`Not enought populated cells (${sorted.length}). Will generate only ${count} states`);}
|
else {console.warn(`Not enough populated cells (${sorted.length}). Will generate only ${count} states`);}
|
||||||
}
|
}
|
||||||
|
|
||||||
let burgsTree = d3.quadtree();
|
let burgsTree = d3.quadtree();
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
console.warn(`Not enought populated cells (${populated.length}). Will generate only ${count} cultures`);
|
console.warn(`Not enough populated cells (${populated.length}). Will generate only ${count} cultures`);
|
||||||
alertMessage.innerHTML = `
|
alertMessage.innerHTML = `
|
||||||
There are only ${populated.length} populated cells and it's insufficient livable area.<br>
|
There are only ${populated.length} populated cells and it's insufficient livable area.<br>
|
||||||
Only ${count} out of ${culturesInput.value} requested cultures will be generated.<br>
|
Only ${count} out of ${culturesInput.value} requested cultures will be generated.<br>
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
//const min = cells.c[i][d3.scan(cells.c[i], (a, b) => h[a] - h[b])]; // downhill cell
|
//const min = cells.c[i][d3.scan(cells.c[i], (a, b) => h[a] - h[b])]; // downhill cell
|
||||||
let min = cells.c[i][d3.scan(cells.c[i], (a, b) => h[a] - h[b])]; // downhill cell
|
let min = cells.c[i][d3.scan(cells.c[i], (a, b) => h[a] - h[b])]; // downhill cell
|
||||||
|
|
||||||
// allow only one river can flow thought a lake
|
// allow only one river can flow through a lake
|
||||||
const cf = features[cells.f[i]]; // current cell feature
|
const cf = features[cells.f[i]]; // current cell feature
|
||||||
if (cf.river && cf.river !== cells.r[i]) {
|
if (cf.river && cf.river !== cells.r[i]) {
|
||||||
cells.fl[i] = 0;
|
cells.fl[i] = 0;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
console.time("generateMainRoads");
|
console.time("generateMainRoads");
|
||||||
const cells = pack.cells, burgs = pack.burgs.filter(b => b.i && !b.removed);
|
const cells = pack.cells, burgs = pack.burgs.filter(b => b.i && !b.removed);
|
||||||
const capitals = burgs.filter(b => b.capital);
|
const capitals = burgs.filter(b => b.capital);
|
||||||
if (capitals.length < 2) return []; // not enought capitals to build main roads
|
if (capitals.length < 2) return []; // not enough capitals to build main roads
|
||||||
const paths = []; // array to store path segments
|
const paths = []; // array to store path segments
|
||||||
|
|
||||||
for (const b of capitals) {
|
for (const b of capitals) {
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
const getTrails = function() {
|
const getTrails = function() {
|
||||||
console.time("generateTrails");
|
console.time("generateTrails");
|
||||||
const cells = pack.cells, burgs = pack.burgs.filter(b => b.i && !b.removed);
|
const cells = pack.cells, burgs = pack.burgs.filter(b => b.i && !b.removed);
|
||||||
if (burgs.length < 2) return []; // not enought burgs to build trails
|
if (burgs.length < 2) return []; // not enough burgs to build trails
|
||||||
|
|
||||||
let paths = []; // array to store path segments
|
let paths = []; // array to store path segments
|
||||||
for (const f of pack.features.filter(f => f.land)) {
|
for (const f of pack.features.filter(f => f.land)) {
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,26 @@ function showElevationProfile(data, routeLen, isRiver) {
|
||||||
const x = chartData.points[k][0];
|
const x = chartData.points[k][0];
|
||||||
const y = yOffset + chartHeight;
|
const y = yOffset + chartHeight;
|
||||||
const c = biomesData.color[chartData.biome[k]];
|
const c = biomesData.color[chartData.biome[k]];
|
||||||
const dataTip = biomesData.name[chartData.biome[k]]+" (" + chartData.height[k] + " " + hu + ", cell " + chartData.cell[k] + ")";
|
|
||||||
|
const cell = chartData.cell[k];
|
||||||
|
const culture = pack.cells.culture[cell];
|
||||||
|
const religion = pack.cells.religion[cell];
|
||||||
|
const province = pack.cells.province[cell];
|
||||||
|
const state = pack.cells.state[cell];
|
||||||
|
let pop = pack.cells.pop[cell];
|
||||||
|
if (chartData.burg[k]) {
|
||||||
|
pop += pack.burgs[chartData.burg[k]].population * urbanization.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
const populationDesc = rn(pop * populationRate.value);
|
||||||
|
|
||||||
|
const provinceDesc = province ? ", " + pack.provinces[province].name : "";
|
||||||
|
const dataTip = biomesData.name[chartData.biome[k]] +
|
||||||
|
provinceDesc +
|
||||||
|
", " + pack.states[state].name +
|
||||||
|
", " + pack.religions[religion].name +
|
||||||
|
", " + pack.cultures[culture].name +
|
||||||
|
" (height: " + chartData.height[k] + " " + hu + ", population " + populationDesc + ", cell " + chartData.cell[k] + ")";
|
||||||
|
|
||||||
g.append("rect").attr("stroke", c).attr("fill", c).attr("x", x).attr("y", y).attr("width", xscale(1)).attr("height", 15).attr("data-tip", dataTip);
|
g.append("rect").attr("stroke", c).attr("fill", c).attr("x", x).attr("y", y).attr("width", xscale(1)).attr("height", 15).attr("data-tip", dataTip);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ function regenerateStates() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (burgs.length < +regionsInput.value) {
|
if (burgs.length < +regionsInput.value) {
|
||||||
tip(`Not enought burgs to generate ${regionsInput.value} states. Will generate only ${burgs.length} states`, false, "warn");
|
tip(`Not enough burgs to generate ${regionsInput.value} states. Will generate only ${burgs.length} states`, false, "warn");
|
||||||
}
|
}
|
||||||
|
|
||||||
// burg local ids sorted by a bit randomized population:
|
// burg local ids sorted by a bit randomized population:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue