This commit is contained in:
howlingsails 2021-12-04 18:13:59 -08:00
parent 4935d506b6
commit 2014c63e22
17 changed files with 21717 additions and 1563 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
._.DS_Store Normal file

Binary file not shown.

4
.gitignore vendored
View file

@ -1,2 +1,4 @@
.bat
.vscode
.vscode
.idea
_maps

View file

@ -1098,10 +1098,10 @@
</td>
<td>Growth rate</td>
<td>
<input id="neutralInput" data-stored="neutral" type="range" min=.1 max=2 step=.1 value=1>
<input id="neutralInput" data-stored="neutral" type="range" min=.01 max=2 step=.01 value=1>
</td>
<td>
<input id="neutralOutput" data-stored="neutral" type="number" min=.1 max=2 step=.1 value=1>
<input id="neutralOutput" data-stored="neutral" type="number" min=.01 max=2 step=.01 value=1>
</td>
</tr>

BIN
libs/.DS_Store vendored Normal file

Binary file not shown.

BIN
libs/._.DS_Store Normal file

Binary file not shown.

BIN
libs/._d3-7.1.1.tgz Normal file

Binary file not shown.

BIN
libs/._d3.js Normal file

Binary file not shown.

BIN
libs/d3-7.1.1.tgz Normal file

Binary file not shown.

20126
libs/d3.js vendored Normal file

File diff suppressed because it is too large Load diff

2792
main.js

File diff suppressed because it is too large Load diff

2
map.sh Normal file
View file

@ -0,0 +1,2 @@
python -m http.server 8000

View file

@ -118,7 +118,7 @@ window.BurgsAndStates = (function () {
let burgsAdded = 0;
const burgsTree = burgs[0];
let spacing = (graphWidth + graphHeight) / 150 / (burgsNumber ** 0.7 / 66); // min distance between towns
let spacing = (graphWidth + graphHeight) / 15 / (burgsNumber ** 0.7 / 24); // min distance between towns
while (burgsAdded < burgsNumber && spacing > 1) {
for (let i = 0; burgsAdded < burgsNumber && i < sorted.length; i++) {
@ -156,53 +156,53 @@ window.BurgsAndStates = (function () {
features = pack.features,
temp = grid.cells.temp;
for (const b of pack.burgs) {
if (!b.i || b.lock) continue;
const i = b.cell;
for (const burgs of pack.burgs) {
if (!burgs.i || burgs.lock) continue;
const i = burgs.cell;
// asign port status to some coastline burgs with temp > 0 °C
// assign port status to some coastline burgs with temp > 0 °C
const haven = cells.haven[i];
if (haven && temp[cells.g[i]] > 0) {
const f = cells.f[haven]; // water body id
// port is a capital with any harbor OR town with good harbor
const port = features[f].cells > 1 && ((b.capital && cells.harbor[i]) || cells.harbor[i] === 1);
b.port = port ? f : 0; // port is defined by water body id it lays on
} else b.port = 0;
const port = features[f].cells > 1 && ((burgs.capital && cells.harbor[i]) || cells.harbor[i] === 1);
burgs.port = port ? f : 0; // port is defined by water body id it lays on
} else burgs.port = 0;
// define burg population (keep urbanization at about 10% rate)
b.population = rn(Math.max((cells.s[i] + cells.road[i] / 2) / 8 + b.i / 1000 + (i % 100) / 1000, 0.1), 3);
if (b.capital) b.population = rn(b.population * 1.3, 3); // increase capital population
burgs.population = rn(Math.max((cells.s[i] + cells.road[i] / 2) / 8 + burgs.i / 1000 + (i % 100) / 1000, 0.1), 3);
if (burgs.capital) burgs.population = rn(burgs.population * 1.3, 3); // increase capital population
if (b.port) {
b.population = b.population * 1.3; // increase port population
if (burgs.port) {
burgs.population = burgs.population * 1.3; // increase port population
const [x, y] = getMiddlePoint(i, haven);
b.x = x;
b.y = y;
burgs.x = x;
burgs.y = y;
}
// add random factor
b.population = rn(b.population * gauss(2, 3, 0.6, 20, 3), 3);
burgs.population = rn(burgs.population * gauss(2, 3, 0.6, 20, 3), 3);
// shift burgs on rivers semi-randomly and just a bit
if (!b.port && cells.r[i]) {
if (!burgs.port && cells.r[i]) {
const shift = Math.min(cells.fl[i] / 150, 1);
if (i % 2) b.x = rn(b.x + shift, 2);
else b.x = rn(b.x - shift, 2);
if (cells.r[i] % 2) b.y = rn(b.y + shift, 2);
else b.y = rn(b.y - shift, 2);
if (i % 2) burgs.x = rn(burgs.x + shift, 2);
else burgs.x = rn(burgs.x - shift, 2);
if (cells.r[i] % 2) burgs.y = rn(burgs.y + shift, 2);
else burgs.y = rn(burgs.y - shift, 2);
}
// define emblem
const state = pack.states[b.state];
const state = pack.states[burgs.state];
const stateCOA = state.coa;
let kinship = 0.25;
if (b.capital) kinship += 0.1;
else if (b.port) kinship -= 0.1;
if (b.culture !== state.culture) kinship -= 0.25;
b.type = getType(i, b.port);
const type = b.capital && P(0.2) ? "Capital" : b.type === "Generic" ? "City" : b.type;
b.coa = COA.generate(stateCOA, kinship, null, type);
b.coa.shield = COA.getShield(b.culture, b.state);
if (burgs.capital) kinship += 0.1;
else if (burgs.port) kinship -= 0.1;
if (burgs.culture !== state.culture) kinship -= 0.25;
burgs.type = getType(i, burgs.port);
const type = burgs.capital && P(0.2) ? "Capital" : burgs.type === "Generic" ? "City" : burgs.type;
burgs.coa = COA.generate(stateCOA, kinship, null, type);
burgs.coa.shield = COA.getShield(burgs.culture, burgs.state);
}
// de-assign port status if it's the only one on feature

View file

@ -71,7 +71,7 @@ window.Cultures = (function () {
function placeCenter(v) {
let c,
spacing = (graphWidth + graphHeight) / 2 / count;
spacing = (graphWidth + graphHeight) / 20 / count;
const sorted = [...populated].sort((a, b) => v(b) - v(a)),
max = Math.floor(sorted.length / 2);
do {
@ -125,13 +125,13 @@ window.Cultures = (function () {
}
function defineCultureExpansionism(type) {
let base = 1; // Generic
if (type === "Lake") base = 0.8;
else if (type === "Naval") base = 1.5;
else if (type === "River") base = 0.9;
else if (type === "Nomadic") base = 1.5;
else if (type === "Hunting") base = 0.7;
else if (type === "Highland") base = 1.2;
let base = 0.1; // Generic
if (type === "Lake") base = 0.2;
else if (type === "Naval") base = 0.5;
else if (type === "River") base = 0.3;
else if (type === "Nomadic") base = 0.8;
else if (type === "Hunting") base = 0.6;
else if (type === "Highland") base = 0.3;
return rn(((Math.random() * powerInput.value) / 2 + 1) * base, 1);
}
@ -173,52 +173,87 @@ window.Cultures = (function () {
const cells = pack.cells,
s = cells.s,
sMax = d3.max(s),
t = cells.t,
h = cells.h,
temperature = cells.t, // Temperature
height = cells.h, // Height
temp = grid.cells.temp;
const n = cell => Math.ceil((s[cell] / sMax) * 3); // normalized cell score
const td = (cell, goal) => {
const normalizedCellScore = cell => Math.ceil((s[cell] / sMax) * 3); // normalized cell score
const tempDiff = (cell, goal) => {
const d = Math.abs(temp[cells.g[cell]] - goal);
return d ? d + 1 : 1;
}; // temperature difference fee
const bd = (cell, biomes, fee = 4) => (biomes.includes(cells.biome[cell]) ? 1 : fee); // biome difference fee
const biomeGoals = (cell, biomes, fee = 4) => (biomes.includes(cells.biome[cell]) ? 1 : fee); // biome difference fee
const sf = (cell, fee = 4) => (cells.haven[cell] && pack.features[cells.f[cells.haven[cell]]].type !== "lake" ? 1 : fee); // not on sea coast fee
if (culturesSet.value === "darkFantasy") {
return [
{name: "Castien (Elvish)", base: 33, odd: 1, sort: i => (normalizedCellScore(i) / biomeGoals(i, [6, 7, 8, 9], 10)) * temperature[i], shield: "gondor"}, // Elves
{name: "Hagluin (Elvish)", base: 33, odd: 1, sort: i => (normalizedCellScore(i) / biomeGoals(i, [6, 7, 8, 9], 10)) * temperature[i], shield: "noldor"}, // Elves
{name: "Lothian (Elvish)", base: 33, odd: 1, sort: i => (normalizedCellScore(i) / biomeGoals(i, [7, 8, 9, 12], 10)) * temperature[i], shield: "wedged"},
{name: "Dunirr (Dwarven)", base: 35, odd: 1, sort: i => normalizedCellScore(i) + (height[i]*3), shield: "ironHills"}, // Dwarfs
{name: "Khazadur (Dwarven)", base: 35, odd: 1, sort: i => normalizedCellScore(i) + (height[i]*4), shield: "erebor"}, // Dwarfs
{name: "Dhommeam (Dwarven)", base: 35, odd: 1, sort: i => normalizedCellScore(i) + height[i], shield: "erebor"}, // Dwarfs
{name: "Mudtoe (Dwarven)", base: 35, odd: 1, sort: i => normalizedCellScore(i) + height[i], shield: "erebor"}, // Dwarfs
{name: "Gongrem (Dwarven)", base: 35, odd: 1, sort: i => normalizedCellScore(i) + height[i], shield: "erebor"}, // Dwarfs
{name: "Pabolk (Goblin)", base: 36, odd: 1, sort: i => temperature[i] - s[i], shield: "moriaOrc"}, // Goblin
{name: "Lagakh (Orkish)", base: 37, odd: 1, sort: i => (height[i] * normalizedCellScore(i) * biomeGoals(i,[2], 100)), shield: "urukHai"}, // Orc
{name: "Mogak (Orkish)", base: 37, odd: 1, sort: i => (height[i]* normalizedCellScore(i) * biomeGoals(i,[2], 100)), shield: "urukHai"}, // Orc
{name: "Xugarf (Orkish)", base: 37, odd: 1, sort: i => ((height[i] * normalizedCellScore(i) * temperature[i]) / biomeGoals(i, [2, 10, 11],100)), shield: "moriaOrc"}, // Orc
{name: "Zildud (Orkish)", base: 37, odd: 1, sort: i => ((height[i]* normalizedCellScore(i) * temperature[i]) / biomeGoals(i, [2, 10, 11],100)), shield: "moriaOrc"}, // Orc
{name: "Shazgob (Orkish)", base: 37, odd: 1, sort: i => ((height[i]* normalizedCellScore(i) * temperature[i]) / biomeGoals(i, [2, 10, 11],100)), shield: "moriaOrc"}, // Orc
{name: "Mazoga (Orkish)", base: 37, odd: 1, sort: i => ((height[i] * temperature[i]) / biomeGoals(i, [2, 10, 11],100)), shield: "moriaOrc"}, // Orc
{name: "Gul (Orkish)", base: 37, odd: 1, sort: i => ((height[i] * temperature[i]) / biomeGoals(i, [2, 10, 11],100)), shield: "moriaOrc"}, // Orc
{name: "Goren (Elvish}", base: 33, odd: 0.5, sort: i => (normalizedCellScore(i) / biomeGoals(i, [6, 7, 8, 9], 10)) * temperature[i], shield: "fantasy5"}, // Elves
{name: "Ginikirr {Dwarven)", base: 35, odd: 0.8, sort: i => normalizedCellScore(i) + height[i], shield: "erebor"}, // Dwarven
{name: "Heenzurm (Goblin)", base: 36, odd: 0.8, sort: i => temperature[i] - s[i], shield: "moriaOrc"}, // Goblin
{name: "Yotunn (Giant)", base: 38, odd: 0.8, sort: i => tempDiff(i, -5), shield: "pavise"}, // Giant
{name: "Zakaos (Giant)", base: 38, odd: 0.8, sort: i => tempDiff(i, -5), shield: "pavise"}, // Giant
{name: "Fruthos (Human)", base: 32, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 10), shield: "fantasy5"},
{name: "Rulor (Human)", base: 32, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 13), shield: "roman"},
{name: "Gralcek (Human)", base: 16, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 16), shield: "round"},
{name: "Llekkolk (Human)", base: 31, odd: 1, sort: i => (normalizedCellScore(i) / tempDiff(i, 5) / biomeGoals(i, [2, 4, 10], 7)) * temperature[i], shield: "easterling"}
];
if (culturesSet.value === "european") {
return [
{name: "Shwazen", base: 0, odd: 1, sort: i => n(i) / td(i, 10) / bd(i, [6, 8]), shield: "swiss"},
{name: "Angshire", base: 1, odd: 1, sort: i => n(i) / td(i, 10) / sf(i), shield: "wedged"},
{name: "Luari", base: 2, odd: 1, sort: i => n(i) / td(i, 12) / bd(i, [6, 8]), shield: "french"},
{name: "Tallian", base: 3, odd: 1, sort: i => n(i) / td(i, 15), shield: "horsehead"},
{name: "Astellian", base: 4, odd: 1, sort: i => n(i) / td(i, 16), shield: "spanish"},
{name: "Slovan", base: 5, odd: 1, sort: i => (n(i) / td(i, 6)) * t[i], shield: "polish"},
{name: "Norse", base: 6, odd: 1, sort: i => n(i) / td(i, 5), shield: "heater"},
{name: "Elladan", base: 7, odd: 1, sort: i => (n(i) / td(i, 18)) * h[i], shield: "boeotian"},
{name: "Romian", base: 8, odd: 0.2, sort: i => n(i) / td(i, 15) / t[i], shield: "roman"},
{name: "Soumi", base: 9, odd: 1, sort: i => (n(i) / td(i, 5) / bd(i, [9])) * t[i], shield: "pavise"},
{name: "Portuzian", base: 13, odd: 1, sort: i => n(i) / td(i, 17) / sf(i), shield: "renaissance"},
{name: "Vengrian", base: 15, odd: 1, sort: i => (n(i) / td(i, 11) / bd(i, [4])) * t[i], shield: "horsehead2"},
{name: "Turchian", base: 16, odd: 0.05, sort: i => n(i) / td(i, 14), shield: "round"},
{name: "Euskati", base: 20, odd: 0.05, sort: i => (n(i) / td(i, 15)) * h[i], shield: "oldFrench"},
{name: "Keltan", base: 22, odd: 0.05, sort: i => (n(i) / td(i, 11) / bd(i, [6, 8])) * t[i], shield: "oval"}
{name: "Shwazen", base: 0, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 10) / biomeGoals(i, [6, 8]), shield: "swiss"},
{name: "Angshire", base: 1, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 10) / sf(i), shield: "wedged"},
{name: "Luari", base: 2, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 12) / biomeGoals(i, [6, 8]), shield: "french"},
{name: "Tallian", base: 3, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 15), shield: "horsehead"},
{name: "Astellian", base: 4, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 16), shield: "spanish"},
{name: "Slovan", base: 5, odd: 1, sort: i => (normalizedCellScore(i) / tempDiff(i, 6)) * temperature[i], shield: "polish"},
{name: "Norse", base: 6, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 5), shield: "heater"},
{name: "Elladan", base: 7, odd: 1, sort: i => (normalizedCellScore(i) / tempDiff(i, 18)) * height[i], shield: "boeotian"},
{name: "Romian", base: 8, odd: 0.2, sort: i => normalizedCellScore(i) / tempDiff(i, 15) / temperature[i], shield: "roman"},
{name: "Soumi", base: 9, odd: 1, sort: i => (normalizedCellScore(i) / tempDiff(i, 5) / biomeGoals(i, [9])) * temperature[i], shield: "pavise"},
{name: "Portuzian", base: 13, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 17) / sf(i), shield: "renaissance"},
{name: "Vengrian", base: 15, odd: 1, sort: i => (normalizedCellScore(i) / tempDiff(i, 11) / biomeGoals(i, [4])) * temperature[i], shield: "horsehead2"},
{name: "Turchian", base: 16, odd: 0.05, sort: i => normalizedCellScore(i) / tempDiff(i, 14), shield: "round"},
{name: "Euskati", base: 20, odd: 0.05, sort: i => (normalizedCellScore(i) / tempDiff(i, 15)) * height[i], shield: "oldFrench"},
{name: "Keltan", base: 22, odd: 0.05, sort: i => (normalizedCellScore(i) / tempDiff(i, 11) / biomeGoals(i, [6, 8])) * temperature[i], shield: "oval"}
];
}
if (culturesSet.value === "oriental") {
return [
{name: "Koryo", base: 10, odd: 1, sort: i => n(i) / td(i, 12) / t[i], shield: "round"},
{name: "Hantzu", base: 11, odd: 1, sort: i => n(i) / td(i, 13), shield: "banner"},
{name: "Yamoto", base: 12, odd: 1, sort: i => n(i) / td(i, 15) / t[i], shield: "round"},
{name: "Turchian", base: 16, odd: 1, sort: i => n(i) / td(i, 12), shield: "round"},
{name: "Berberan", base: 17, odd: 0.2, sort: i => (n(i) / td(i, 19) / bd(i, [1, 2, 3], 7)) * t[i], shield: "oval"},
{name: "Eurabic", base: 18, odd: 1, sort: i => (n(i) / td(i, 26) / bd(i, [1, 2], 7)) * t[i], shield: "oval"},
{name: "Efratic", base: 23, odd: 0.1, sort: i => (n(i) / td(i, 22)) * t[i], shield: "round"},
{name: "Tehrani", base: 24, odd: 1, sort: i => (n(i) / td(i, 18)) * h[i], shield: "round"},
{name: "Maui", base: 25, odd: 0.2, sort: i => n(i) / td(i, 24) / sf(i) / t[i], shield: "vesicaPiscis"},
{name: "Carnatic", base: 26, odd: 0.5, sort: i => n(i) / td(i, 26), shield: "round"},
{name: "Vietic", base: 29, odd: 0.8, sort: i => n(i) / td(i, 25) / bd(i, [7], 7) / t[i], shield: "banner"},
{name: "Guantzu", base: 30, odd: 0.5, sort: i => n(i) / td(i, 17), shield: "banner"},
{name: "Ulus", base: 31, odd: 1, sort: i => (n(i) / td(i, 5) / bd(i, [2, 4, 10], 7)) * t[i], shield: "banner"}
{name: "Koryo", base: 10, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 12) / temperature[i], shield: "round"},
{name: "Hantzu", base: 11, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 13), shield: "banner"},
{name: "Yamoto", base: 12, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 15) / temperature[i], shield: "round"},
{name: "Turchian", base: 16, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 12), shield: "round"},
{name: "Berberan", base: 17, odd: 0.2, sort: i => (normalizedCellScore(i) / tempDiff(i, 19) / biomeGoals(i, [1, 2, 3], 7)) * temperature[i], shield: "oval"},
{name: "Eurabic", base: 18, odd: 1, sort: i => (normalizedCellScore(i) / tempDiff(i, 26) / biomeGoals(i, [1, 2], 7)) * temperature[i], shield: "oval"},
{name: "Efratic", base: 23, odd: 0.1, sort: i => (normalizedCellScore(i) / tempDiff(i, 22)) * temperature[i], shield: "round"},
{name: "Tehrani", base: 24, odd: 1, sort: i => (normalizedCellScore(i) / tempDiff(i, 18)) * height[i], shield: "round"},
{name: "Maui", base: 25, odd: 0.2, sort: i => normalizedCellScore(i) / tempDiff(i, 24) / sf(i) / temperature[i], shield: "vesicaPiscis"},
{name: "Carnatic", base: 26, odd: 0.5, sort: i => normalizedCellScore(i) / tempDiff(i, 26), shield: "round"},
{name: "Vietic", base: 29, odd: 0.8, sort: i => normalizedCellScore(i) / tempDiff(i, 25) / biomeGoals(i, [7], 7) / temperature[i], shield: "banner"},
{name: "Guantzu", base: 30, odd: 0.5, sort: i => normalizedCellScore(i) / tempDiff(i, 17), shield: "banner"},
{name: "Ulus", base: 31, odd: 1, sort: i => (normalizedCellScore(i) / tempDiff(i, 5) / biomeGoals(i, [2, 4, 10], 7)) * temperature[i], shield: "banner"}
];
}
@ -240,89 +275,51 @@ window.Cultures = (function () {
if (culturesSet.value === "antique") {
return [
{name: "Roman", base: 8, odd: 1, sort: i => n(i) / td(i, 14) / t[i], shield: "roman"}, // Roman
{name: "Roman", base: 8, odd: 1, sort: i => n(i) / td(i, 15) / sf(i), shield: "roman"}, // Roman
{name: "Roman", base: 8, odd: 1, sort: i => n(i) / td(i, 16) / sf(i), shield: "roman"}, // Roman
{name: "Roman", base: 8, odd: 1, sort: i => n(i) / td(i, 17) / t[i], shield: "roman"}, // Roman
{name: "Hellenic", base: 7, odd: 1, sort: i => (n(i) / td(i, 18) / sf(i)) * h[i], shield: "boeotian"}, // Greek
{name: "Hellenic", base: 7, odd: 1, sort: i => (n(i) / td(i, 19) / sf(i)) * h[i], shield: "boeotian"}, // Greek
{name: "Macedonian", base: 7, odd: 0.5, sort: i => (n(i) / td(i, 12)) * h[i], shield: "round"}, // Greek
{name: "Celtic", base: 22, odd: 1, sort: i => n(i) / td(i, 11) ** 0.5 / bd(i, [6, 8]), shield: "round"},
{name: "Germanic", base: 0, odd: 1, sort: i => n(i) / td(i, 10) ** 0.5 / bd(i, [6, 8]), shield: "round"},
{name: "Persian", base: 24, odd: 0.8, sort: i => (n(i) / td(i, 18)) * h[i], shield: "oval"}, // Iranian
{name: "Scythian", base: 24, odd: 0.5, sort: i => n(i) / td(i, 11) ** 0.5 / bd(i, [4]), shield: "round"}, // Iranian
{name: "Cantabrian", base: 20, odd: 0.5, sort: i => (n(i) / td(i, 16)) * h[i], shield: "oval"}, // Basque
{name: "Estian", base: 9, odd: 0.2, sort: i => (n(i) / td(i, 5)) * t[i], shield: "pavise"}, // Finnic
{name: "Carthaginian", base: 17, odd: 0.3, sort: i => n(i) / td(i, 19) / sf(i), shield: "oval"}, // Berber
{name: "Mesopotamian", base: 23, odd: 0.2, sort: i => n(i) / td(i, 22) / bd(i, [1, 2, 3]), shield: "oval"} // Mesopotamian
{name: "Roman", base: 8, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 14) / temperature[i], shield: "roman"}, // Roman
{name: "Roman", base: 8, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 15) / sf(i), shield: "roman"}, // Roman
{name: "Roman", base: 8, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 16) / sf(i), shield: "roman"}, // Roman
{name: "Roman", base: 8, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 17) / temperature[i], shield: "roman"}, // Roman
{name: "Hellenic", base: 7, odd: 1, sort: i => (normalizedCellScore(i) / tempDiff(i, 18) / sf(i)) * height[i], shield: "boeotian"}, // Greek
{name: "Hellenic", base: 7, odd: 1, sort: i => (normalizedCellScore(i) / tempDiff(i, 19) / sf(i)) * height[i], shield: "boeotian"}, // Greek
{name: "Macedonian", base: 7, odd: 0.5, sort: i => (normalizedCellScore(i) / tempDiff(i, 12)) * height[i], shield: "round"}, // Greek
{name: "Celtic", base: 22, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 11) ** 0.5 / biomeGoals(i, [6, 8]), shield: "round"},
{name: "Germanic", base: 0, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 10) ** 0.5 / biomeGoals(i, [6, 8]), shield: "round"},
{name: "Persian", base: 24, odd: 0.8, sort: i => (normalizedCellScore(i) / tempDiff(i, 18)) * height[i], shield: "oval"}, // Iranian
{name: "Scythian", base: 24, odd: 0.5, sort: i => normalizedCellScore(i) / tempDiff(i, 11) ** 0.5 / biomeGoals(i, [4]), shield: "round"}, // Iranian
{name: "Cantabrian", base: 20, odd: 0.5, sort: i => (normalizedCellScore(i) / tempDiff(i, 16)) * height[i], shield: "oval"}, // Basque
{name: "Estian", base: 9, odd: 0.2, sort: i => (normalizedCellScore(i) / tempDiff(i, 5)) * temperature[i], shield: "pavise"}, // Finnic
{name: "Carthaginian", base: 17, odd: 0.3, sort: i => normalizedCellScore(i) / tempDiff(i, 19) / sf(i), shield: "oval"}, // Berber
{name: "Mesopotamian", base: 23, odd: 0.2, sort: i => normalizedCellScore(i) / tempDiff(i, 22) / biomeGoals(i, [1, 2, 3]), shield: "oval"} // Mesopotamian
];
}
/**
* Note the sort is the way the race orders the cell by preference
*/
if (culturesSet.value === "highFantasy") {
return [
// fantasy races
{name: "Quenian (Elfish)", base: 33, odd: 1, sort: i => (n(i) / bd(i, [6, 7, 8, 9], 10)) * t[i], shield: "gondor"}, // Elves
{name: "Eldar (Elfish)", base: 33, odd: 1, sort: i => (n(i) / bd(i, [6, 7, 8, 9], 10)) * t[i], shield: "noldor"}, // Elves
{name: "Trow (Dark Elfish)", base: 34, odd: 0.9, sort: i => (n(i) / bd(i, [7, 8, 9, 12], 10)) * t[i], shield: "hessen"}, // Dark Elves
{name: "Lothian (Dark Elfish)", base: 34, odd: 0.3, sort: i => (n(i) / bd(i, [7, 8, 9, 12], 10)) * t[i], shield: "wedged"}, // Dark Elves
{name: "Dunirr (Dwarven)", base: 35, odd: 1, sort: i => n(i) + h[i], shield: "ironHills"}, // Dwarfs
{name: "Khazadur (Dwarven)", base: 35, odd: 1, sort: i => n(i) + h[i], shield: "erebor"}, // Dwarfs
{name: "Kobold (Goblin)", base: 36, odd: 1, sort: i => t[i] - s[i], shield: "moriaOrc"}, // Goblin
{name: "Uruk (Orkish)", base: 37, odd: 1, sort: i => h[i] * t[i], shield: "urukHai"}, // Orc
{name: "Ugluk (Orkish)", base: 37, odd: 0.5, sort: i => (h[i] * t[i]) / bd(i, [1, 2, 10, 11]), shield: "moriaOrc"}, // Orc
{name: "Yotunn (Giants)", base: 38, odd: 0.7, sort: i => td(i, -10), shield: "pavise"}, // Giant
{name: "Quenian (Elfish)", base: 33, odd: 1, sort: i => (normalizedCellScore(i) / biomeGoals(i, [6, 7, 8, 9], 10)) * temperature[i], shield: "gondor"}, // Elves
{name: "Eldar (Elfish)", base: 33, odd: 1, sort: i => (normalizedCellScore(i) / biomeGoals(i, [6, 7, 8, 9], 10)) * temperature[i], shield: "noldor"}, // Elves
{name: "Trow (Dark Elfish)", base: 34, odd: 0.9, sort: i => (normalizedCellScore(i) / biomeGoals(i, [7, 8, 9, 12], 10)) * temperature[i], shield: "hessen"}, // Dark Elves
{name: "Lothian (Dark Elfish)", base: 34, odd: 0.3, sort: i => (normalizedCellScore(i) / biomeGoals(i, [7, 8, 9, 12], 10)) * temperature[i], shield: "wedged"}, // Dark Elves
{name: "Dunirr (Dwarven)", base: 35, odd: 1, sort: i => normalizedCellScore(i) + height[i], shield: "ironHills"}, // Dwarfs
{name: "Khazadur (Dwarven)", base: 35, odd: 1, sort: i => normalizedCellScore(i) + height[i], shield: "erebor"}, // Dwarfs
{name: "Kobold (Goblin)", base: 36, odd: 1, sort: i => temperature[i] - s[i], shield: "moriaOrc"}, // Goblin
{name: "Uruk (Orkish)", base: 37, odd: 1, sort: i => height[i] * temperature[i], shield: "urukHai"}, // Orc
{name: "Ugluk (Orkish)", base: 37, odd: 1.5, sort: i => (height[i] * temperature[i]) / biomeGoals(i, [1, 2, 10, 11]), shield: "moriaOrc"}, // Orc
{name: "Yotunn (Giants)", base: 38, odd: 0.7, sort: i => tempDiff(i, -10), shield: "pavise"}, // Giant
{name: "Rake (Drakonic)", base: 39, odd: 0.7, sort: i => -s[i], shield: "fantasy2"}, // Draconic
{name: "Arago (Arachnid)", base: 40, odd: 0.7, sort: i => t[i] - s[i], shield: "horsehead2"}, // Arachnid
{name: "Aj'Snaga (Serpents)", base: 41, odd: 0.7, sort: i => n(i) / bd(i, [12], 10), shield: "fantasy1"}, // Serpents
{name: "Arago (Arachnid)", base: 40, odd: 0.7, sort: i => temperature[i] - s[i], shield: "horsehead2"}, // Arachnid
{name: "Aj'Snaga (Serpents)", base: 41, odd: 0.7, sort: i => normalizedCellScore(i) / biomeGoals(i, [12], 10), shield: "fantasy1"}, // Serpents
// fantasy human
{name: "Anor (Human)", base: 32, odd: 1, sort: i => n(i) / td(i, 10), shield: "fantasy5"},
{name: "Dail (Human)", base: 32, odd: 1, sort: i => n(i) / td(i, 13), shield: "roman"},
{name: "Rohand (Human)", base: 16, odd: 1, sort: i => n(i) / td(i, 16), shield: "round"},
{name: "Dulandir (Human)", base: 31, odd: 1, sort: i => (n(i) / td(i, 5) / bd(i, [2, 4, 10], 7)) * t[i], shield: "easterling"}
{name: "Anor (Human)", base: 32, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 10), shield: "fantasy5"},
{name: "Dail (Human)", base: 32, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 13), shield: "roman"},
{name: "Rohand (Human)", base: 16, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 16), shield: "round"},
{name: "Dulandir (Human)", base: 31, odd: 1, sort: i => (normalizedCellScore(i) / tempDiff(i, 5) / biomeGoals(i, [2, 4, 10], 7)) * temperature[i], shield: "easterling"}
];
}
if (culturesSet.value === "darkFantasy") {
return [
// common real-world English
{name: "Angshire", base: 1, odd: 1, sort: i => n(i) / td(i, 10) / sf(i), shield: "heater"},
{name: "Enlandic", base: 1, odd: 1, sort: i => n(i) / td(i, 12), shield: "heater"},
{name: "Westen", base: 1, odd: 1, sort: i => n(i) / td(i, 10), shield: "heater"},
{name: "Nortumbic", base: 1, odd: 1, sort: i => n(i) / td(i, 7), shield: "heater"},
{name: "Mercian", base: 1, odd: 1, sort: i => n(i) / td(i, 9), shield: "heater"},
{name: "Kentian", base: 1, odd: 1, sort: i => n(i) / td(i, 12), shield: "heater"},
// rare real-world western
{name: "Norse", base: 6, odd: 0.7, sort: i => n(i) / td(i, 5) / sf(i), shield: "oldFrench"},
{name: "Schwarzen", base: 0, odd: 0.3, sort: i => n(i) / td(i, 10) / bd(i, [6, 8]), shield: "gonfalon"},
{name: "Luarian", base: 2, odd: 0.3, sort: i => n(i) / td(i, 12) / bd(i, [6, 8]), shield: "oldFrench"},
{name: "Hetallian", base: 3, odd: 0.3, sort: i => n(i) / td(i, 15), shield: "oval"},
{name: "Astellian", base: 4, odd: 0.3, sort: i => n(i) / td(i, 16), shield: "spanish"},
// rare real-world exotic
{name: "Kiswaili", base: 28, odd: 0.05, sort: i => n(i) / td(i, 29) / bd(i, [1, 3, 5, 7]), shield: "vesicaPiscis"},
{name: "Yoruba", base: 21, odd: 0.05, sort: i => n(i) / td(i, 15) / bd(i, [5, 7]), shield: "vesicaPiscis"},
{name: "Koryo", base: 10, odd: 0.05, sort: i => n(i) / td(i, 12) / t[i], shield: "round"},
{name: "Hantzu", base: 11, odd: 0.05, sort: i => n(i) / td(i, 13), shield: "banner"},
{name: "Yamoto", base: 12, odd: 0.05, sort: i => n(i) / td(i, 15) / t[i], shield: "round"},
{name: "Guantzu", base: 30, odd: 0.05, sort: i => n(i) / td(i, 17), shield: "banner"},
{name: "Ulus", base: 31, odd: 0.05, sort: i => (n(i) / td(i, 5) / bd(i, [2, 4, 10], 7)) * t[i], shield: "banner"},
{name: "Turan", base: 16, odd: 0.05, sort: i => n(i) / td(i, 12), shield: "round"},
{name: "Berberan", base: 17, odd: 0.05, sort: i => (n(i) / td(i, 19) / bd(i, [1, 2, 3], 7)) * t[i], shield: "round"},
{name: "Eurabic", base: 18, odd: 0.05, sort: i => (n(i) / td(i, 26) / bd(i, [1, 2], 7)) * t[i], shield: "round"},
{name: "Slovan", base: 5, odd: 0.05, sort: i => (n(i) / td(i, 6)) * t[i], shield: "round"},
{name: "Keltan", base: 22, odd: 0.1, sort: i => n(i) / td(i, 11) ** 0.5 / bd(i, [6, 8]), shield: "vesicaPiscis"},
{name: "Elladan", base: 7, odd: 0.2, sort: i => (n(i) / td(i, 18) / sf(i)) * h[i], shield: "boeotian"},
{name: "Romian", base: 8, odd: 0.2, sort: i => n(i) / td(i, 14) / t[i], shield: "roman"},
// fantasy races
{name: "Eldar", base: 33, odd: 0.5, sort: i => (n(i) / bd(i, [6, 7, 8, 9], 10)) * t[i], shield: "fantasy5"}, // Elves
{name: "Trow", base: 34, odd: 0.8, sort: i => (n(i) / bd(i, [7, 8, 9, 12], 10)) * t[i], shield: "hessen"}, // Dark Elves
{name: "Durinn", base: 35, odd: 0.8, sort: i => n(i) + h[i], shield: "erebor"}, // Dwarven
{name: "Kobblin", base: 36, odd: 0.8, sort: i => t[i] - s[i], shield: "moriaOrc"}, // Goblin
{name: "Uruk", base: 37, odd: 0.8, sort: i => (h[i] * t[i]) / bd(i, [1, 2, 10, 11]), shield: "urukHai"}, // Orc
{name: "Yotunn", base: 38, odd: 0.8, sort: i => td(i, -10), shield: "pavise"}, // Giant
{name: "Drake", base: 39, odd: 0.9, sort: i => -s[i], shield: "fantasy2"}, // Draconic
{name: "Rakhnid", base: 40, odd: 0.9, sort: i => t[i] - s[i], shield: "horsehead2"}, // Arachnid
{name: "Aj'Snaga", base: 41, odd: 0.9, sort: i => n(i) / bd(i, [12], 10), shield: "fantasy1"} // Serpents
];
}
if (culturesSet.value === "random") {
@ -335,38 +332,38 @@ window.Cultures = (function () {
// all-world
return [
{name: "Shwazen", base: 0, odd: 0.7, sort: i => n(i) / td(i, 10) / bd(i, [6, 8]), shield: "hessen"},
{name: "Angshire", base: 1, odd: 1, sort: i => n(i) / td(i, 10) / sf(i), shield: "heater"},
{name: "Luari", base: 2, odd: 0.6, sort: i => n(i) / td(i, 12) / bd(i, [6, 8]), shield: "oldFrench"},
{name: "Tallian", base: 3, odd: 0.6, sort: i => n(i) / td(i, 15), shield: "horsehead2"},
{name: "Astellian", base: 4, odd: 0.6, sort: i => n(i) / td(i, 16), shield: "spanish"},
{name: "Slovan", base: 5, odd: 0.7, sort: i => (n(i) / td(i, 6)) * t[i], shield: "round"},
{name: "Norse", base: 6, odd: 0.7, sort: i => n(i) / td(i, 5), shield: "heater"},
{name: "Elladan", base: 7, odd: 0.7, sort: i => (n(i) / td(i, 18)) * h[i], shield: "boeotian"},
{name: "Romian", base: 8, odd: 0.7, sort: i => n(i) / td(i, 15), shield: "roman"},
{name: "Soumi", base: 9, odd: 0.3, sort: i => (n(i) / td(i, 5) / bd(i, [9])) * t[i], shield: "pavise"},
{name: "Koryo", base: 10, odd: 0.1, sort: i => n(i) / td(i, 12) / t[i], shield: "round"},
{name: "Hantzu", base: 11, odd: 0.1, sort: i => n(i) / td(i, 13), shield: "banner"},
{name: "Yamoto", base: 12, odd: 0.1, sort: i => n(i) / td(i, 15) / t[i], shield: "round"},
{name: "Portuzian", base: 13, odd: 0.4, sort: i => n(i) / td(i, 17) / sf(i), shield: "spanish"},
{name: "Nawatli", base: 14, odd: 0.1, sort: i => h[i] / td(i, 18) / bd(i, [7]), shield: "square"},
{name: "Vengrian", base: 15, odd: 0.2, sort: i => (n(i) / td(i, 11) / bd(i, [4])) * t[i], shield: "wedged"},
{name: "Turchian", base: 16, odd: 0.2, sort: i => n(i) / td(i, 13), shield: "round"},
{name: "Berberan", base: 17, odd: 0.1, sort: i => (n(i) / td(i, 19) / bd(i, [1, 2, 3], 7)) * t[i], shield: "round"},
{name: "Eurabic", base: 18, odd: 0.2, sort: i => (n(i) / td(i, 26) / bd(i, [1, 2], 7)) * t[i], shield: "round"},
{name: "Inuk", base: 19, odd: 0.05, sort: i => td(i, -1) / bd(i, [10, 11]) / sf(i), shield: "square"},
{name: "Euskati", base: 20, odd: 0.05, sort: i => (n(i) / td(i, 15)) * h[i], shield: "spanish"},
{name: "Yoruba", base: 21, odd: 0.05, sort: i => n(i) / td(i, 15) / bd(i, [5, 7]), shield: "vesicaPiscis"},
{name: "Keltan", base: 22, odd: 0.05, sort: i => (n(i) / td(i, 11) / bd(i, [6, 8])) * t[i], shield: "vesicaPiscis"},
{name: "Efratic", base: 23, odd: 0.05, sort: i => (n(i) / td(i, 22)) * t[i], shield: "diamond"},
{name: "Tehrani", base: 24, odd: 0.1, sort: i => (n(i) / td(i, 18)) * h[i], shield: "round"},
{name: "Maui", base: 25, odd: 0.05, sort: i => n(i) / td(i, 24) / sf(i) / t[i], shield: "round"},
{name: "Carnatic", base: 26, odd: 0.05, sort: i => n(i) / td(i, 26), shield: "round"},
{name: "Inqan", base: 27, odd: 0.05, sort: i => h[i] / td(i, 13), shield: "square"},
{name: "Kiswaili", base: 28, odd: 0.1, sort: i => n(i) / td(i, 29) / bd(i, [1, 3, 5, 7]), shield: "vesicaPiscis"},
{name: "Vietic", base: 29, odd: 0.1, sort: i => n(i) / td(i, 25) / bd(i, [7], 7) / t[i], shield: "banner"},
{name: "Guantzu", base: 30, odd: 0.1, sort: i => n(i) / td(i, 17), shield: "banner"},
{name: "Ulus", base: 31, odd: 0.1, sort: i => (n(i) / td(i, 5) / bd(i, [2, 4, 10], 7)) * t[i], shield: "banner"}
{name: "Shwazen", base: 0, odd: 0.7, sort: i => normalizedCellScore(i) / tempDiff(i, 10) / biomeGoals(i, [6, 8]), shield: "hessen"},
{name: "Angshire", base: 1, odd: 1, sort: i => normalizedCellScore(i) / tempDiff(i, 10) / sf(i), shield: "heater"},
{name: "Luari", base: 2, odd: 0.6, sort: i => normalizedCellScore(i) / tempDiff(i, 12) / biomeGoals(i, [6, 8]), shield: "oldFrench"},
{name: "Tallian", base: 3, odd: 0.6, sort: i => normalizedCellScore(i) / tempDiff(i, 15), shield: "horsehead2"},
{name: "Astellian", base: 4, odd: 0.6, sort: i => normalizedCellScore(i) / tempDiff(i, 16), shield: "spanish"},
{name: "Slovan", base: 5, odd: 0.7, sort: i => (normalizedCellScore(i) / tempDiff(i, 6)) * temperature[i], shield: "round"},
{name: "Norse", base: 6, odd: 0.7, sort: i => normalizedCellScore(i) / tempDiff(i, 5), shield: "heater"},
{name: "Elladan", base: 7, odd: 0.7, sort: i => (normalizedCellScore(i) / tempDiff(i, 18)) * height[i], shield: "boeotian"},
{name: "Romian", base: 8, odd: 0.7, sort: i => normalizedCellScore(i) / tempDiff(i, 15), shield: "roman"},
{name: "Soumi", base: 9, odd: 0.3, sort: i => (normalizedCellScore(i) / tempDiff(i, 5) / biomeGoals(i, [9])) * temperature[i], shield: "pavise"},
{name: "Koryo", base: 10, odd: 0.1, sort: i => normalizedCellScore(i) / tempDiff(i, 12) / temperature[i], shield: "round"},
{name: "Hantzu", base: 11, odd: 0.1, sort: i => normalizedCellScore(i) / tempDiff(i, 13), shield: "banner"},
{name: "Yamoto", base: 12, odd: 0.1, sort: i => normalizedCellScore(i) / tempDiff(i, 15) / temperature[i], shield: "round"},
{name: "Portuzian", base: 13, odd: 0.4, sort: i => normalizedCellScore(i) / tempDiff(i, 17) / sf(i), shield: "spanish"},
{name: "Nawatli", base: 14, odd: 0.1, sort: i => height[i] / tempDiff(i, 18) / biomeGoals(i, [7]), shield: "square"},
{name: "Vengrian", base: 15, odd: 0.2, sort: i => (normalizedCellScore(i) / tempDiff(i, 11) / biomeGoals(i, [4])) * temperature[i], shield: "wedged"},
{name: "Turchian", base: 16, odd: 0.2, sort: i => normalizedCellScore(i) / tempDiff(i, 13), shield: "round"},
{name: "Berberan", base: 17, odd: 0.1, sort: i => (normalizedCellScore(i) / tempDiff(i, 19) / biomeGoals(i, [1, 2, 3], 7)) * temperature[i], shield: "round"},
{name: "Eurabic", base: 18, odd: 0.2, sort: i => (normalizedCellScore(i) / tempDiff(i, 26) / biomeGoals(i, [1, 2], 7)) * temperature[i], shield: "round"},
{name: "Inuk", base: 19, odd: 0.05, sort: i => tempDiff(i, -1) / biomeGoals(i, [10, 11]) / sf(i), shield: "square"},
{name: "Euskati", base: 20, odd: 0.05, sort: i => (normalizedCellScore(i) / tempDiff(i, 15)) * height[i], shield: "spanish"},
{name: "Yoruba", base: 21, odd: 0.05, sort: i => normalizedCellScore(i) / tempDiff(i, 15) / biomeGoals(i, [5, 7]), shield: "vesicaPiscis"},
{name: "Keltan", base: 22, odd: 0.05, sort: i => (normalizedCellScore(i) / tempDiff(i, 11) / biomeGoals(i, [6, 8])) * temperature[i], shield: "vesicaPiscis"},
{name: "Efratic", base: 23, odd: 0.05, sort: i => (normalizedCellScore(i) / tempDiff(i, 22)) * temperature[i], shield: "diamond"},
{name: "Tehrani", base: 24, odd: 0.1, sort: i => (normalizedCellScore(i) / tempDiff(i, 18)) * height[i], shield: "round"},
{name: "Maui", base: 25, odd: 0.05, sort: i => normalizedCellScore(i) / tempDiff(i, 24) / sf(i) / temperature[i], shield: "round"},
{name: "Carnatic", base: 26, odd: 0.05, sort: i => normalizedCellScore(i) / tempDiff(i, 26), shield: "round"},
{name: "Inqan", base: 27, odd: 0.05, sort: i => height[i] / tempDiff(i, 13), shield: "square"},
{name: "Kiswaili", base: 28, odd: 0.1, sort: i => normalizedCellScore(i) / tempDiff(i, 29) / biomeGoals(i, [1, 3, 5, 7]), shield: "vesicaPiscis"},
{name: "Vietic", base: 29, odd: 0.1, sort: i => normalizedCellScore(i) / tempDiff(i, 25) / biomeGoals(i, [7], 7) / temperature[i], shield: "banner"},
{name: "Guantzu", base: 30, odd: 0.1, sort: i => normalizedCellScore(i) / tempDiff(i, 17), shield: "banner"},
{name: "Ulus", base: 31, odd: 0.1, sort: i => (normalizedCellScore(i) / tempDiff(i, 5) / biomeGoals(i, [2, 4, 10], 7)) * temperature[i], shield: "banner"}
];
};

View file

@ -351,6 +351,7 @@ window.Religions = (function () {
: cells.i.filter(i => cells.s[i] > 2).sort((a, b) => cells.s[b] - cells.s[a]);
const religionsTree = d3.quadtree();
const spacing = (graphWidth + graphHeight) / 6 / religionsInput.value; // base min distance between towns
//const spacing = (graphWidth + graphHeight) / distanceScaleInput.value
const cultsCount = Math.floor((rand(10, 40) / 100) * religionsInput.value);
const count = +religionsInput.value - cultsCount + religions.length;

View file

@ -160,8 +160,12 @@ window.Rivers = (function () {
// mark real confluences and assign river to cells
if (cells.r[cell]) cells.conf[cell] = 1;
else cells.r[cell] = riverId;
if (cells.s && cells.s[cell]) {
cells.s[cell] = cells.s[cell] * 1.25; // Increase value of rivers
}
}
const source = riverCells[0];
const mouth = riverCells[riverCells.length - 2];
const parent = riverParents[key] || 0;

View file

@ -416,8 +416,8 @@ function editBurg(id) {
const {cells} = pack;
const {name, population, cell} = burg;
const burgSeed = getBurgSeed(burg);
const sizeRaw = 2.13 * Math.pow((population * populationRate) / urbanDensity, 0.385);
const size = minmax(Math.ceil(sizeRaw), 6, 100);
const sizeRaw = 0.43 * Math.pow((population * populationRate) / urbanDensity, 0.385);
const size = minmax(Math.ceil(sizeRaw), 2, 40);
const people = rn(population * populationRate * urbanization);
const hub = +cells.road[cell] > 50;