mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
religion gen fix
This commit is contained in:
parent
ed3648a49e
commit
470e814a0e
2 changed files with 324 additions and 28 deletions
10
index.html
10
index.html
|
|
@ -4333,11 +4333,11 @@
|
||||||
<script defer src="modules/load.js"></script>
|
<script defer src="modules/load.js"></script>
|
||||||
<script defer src="modules/cloud.js"></script>
|
<script defer src="modules/cloud.js"></script>
|
||||||
<script defer src="main.js"></script>
|
<script defer src="main.js"></script>
|
||||||
<script async defer src="modules/save.js"></script>
|
<script defer src="modules/save.js"></script>
|
||||||
<script async defer src="modules/export.js"></script>
|
<script defer src="modules/export.js"></script>
|
||||||
<script async defer src="modules/relief-icons.js"></script>
|
<script defer src="modules/relief-icons.js"></script>
|
||||||
<script async defer src="modules/ui/tools.js"></script>
|
<script defer src="modules/ui/tools.js"></script>
|
||||||
<script async defer src="modules/ui/world-configurator.js"></script>
|
<script defer src="modules/ui/world-configurator.js"></script>
|
||||||
<script async defer src="modules/ui/heightmap-editor.js"></script>
|
<script async defer src="modules/ui/heightmap-editor.js"></script>
|
||||||
<script async defer src="modules/ui/states-editor.js"></script>
|
<script async defer src="modules/ui/states-editor.js"></script>
|
||||||
<script async defer src="modules/ui/provinces-editor.js"></script>
|
<script async defer src="modules/ui/provinces-editor.js"></script>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,22 @@
|
||||||
|
|
||||||
window.Religions = (function () {
|
window.Religions = (function () {
|
||||||
// name generation approach and relative chance to be selected
|
// name generation approach and relative chance to be selected
|
||||||
const approach = {Number: 1, Being: 3, Adjective: 5, "Color + Animal": 5, "Adjective + Animal": 5, "Adjective + Being": 5, "Adjective + Genitive": 1, "Color + Being": 3, "Color + Genitive": 3, "Being + of + Genitive": 2, "Being + of the + Genitive": 1, "Animal + of + Genitive": 1, "Adjective + Being + of + Genitive": 2, "Adjective + Animal + of + Genitive": 2};
|
const approach = {
|
||||||
|
Number: 1,
|
||||||
|
Being: 3,
|
||||||
|
Adjective: 5,
|
||||||
|
"Color + Animal": 5,
|
||||||
|
"Adjective + Animal": 5,
|
||||||
|
"Adjective + Being": 5,
|
||||||
|
"Adjective + Genitive": 1,
|
||||||
|
"Color + Being": 3,
|
||||||
|
"Color + Genitive": 3,
|
||||||
|
"Being + of + Genitive": 2,
|
||||||
|
"Being + of the + Genitive": 1,
|
||||||
|
"Animal + of + Genitive": 1,
|
||||||
|
"Adjective + Being + of + Genitive": 2,
|
||||||
|
"Adjective + Animal + of + Genitive": 2
|
||||||
|
};
|
||||||
|
|
||||||
// turn weighted array into simple array
|
// turn weighted array into simple array
|
||||||
const approaches = [];
|
const approaches = [];
|
||||||
|
|
@ -14,11 +29,254 @@ window.Religions = (function () {
|
||||||
|
|
||||||
const base = {
|
const base = {
|
||||||
number: ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve"],
|
number: ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve"],
|
||||||
being: ["God", "Goddess", "Lord", "Lady", "Deity", "Creator", "Maker", "Overlord", "Ruler", "Chief", "Master", "Spirit", "Ancestor", "Father", "Forebear", "Forefather", "Mother", "Brother", "Sister", "Elder", "Numen", "Ancient", "Virgin", "Giver", "Council", "Guardian", "Reaper"],
|
being: [
|
||||||
animal: ["Dragon", "Wyvern", "Phoenix", "Unicorn", "Sphinx", "Centaur", "Pegasus", "Kraken", "Basilisk", "Chimera", "Cyclope", "Antelope", "Ape", "Badger", "Bear", "Beaver", "Bison", "Boar", "Buffalo", "Cat", "Cobra", "Crane", "Crocodile", "Crow", "Deer", "Dog", "Eagle", "Elk", "Fox", "Goat", "Goose", "Hare", "Hawk", "Heron", "Horse", "Hyena", "Ibis", "Jackal", "Jaguar", "Lark", "Leopard", "Lion", "Mantis", "Marten", "Moose", "Mule", "Narwhal", "Owl", "Panther", "Rat", "Raven", "Rook", "Scorpion", "Shark", "Sheep", "Snake", "Spider", "Swan", "Tiger", "Turtle", "Viper", "Vulture", "Walrus", "Wolf", "Wolverine", "Worm", "Camel", "Falcon", "Hound", "Ox", "Serpent"],
|
"God",
|
||||||
adjective: ["New", "Good", "High", "Old", "Great", "Big", "Young", "Major", "Strong", "Happy", "Last", "Main", "Huge", "Far", "Beautiful", "Wild", "Fair", "Prime", "Crazy", "Ancient", "Proud", "Secret", "Lucky", "Sad", "Silent", "Latter", "Severe", "Fat", "Holy", "Pure", "Aggressive", "Honest", "Giant", "Mad", "Pregnant", "Distant", "Lost", "Broken", "Blind", "Friendly", "Unknown", "Sleeping", "Slumbering", "Loud", "Hungry", "Wise", "Worried", "Sacred", "Magical", "Superior", "Patient", "Dead", "Deadly", "Peaceful", "Grateful", "Frozen", "Evil", "Scary", "Burning", "Divine", "Bloody", "Dying", "Waking", "Brutal", "Unhappy", "Calm", "Cruel", "Favorable", "Blond", "Explicit", "Disturbing", "Devastating", "Brave", "Sunny", "Troubled", "Flying", "Sustainable", "Marine", "Fatal", "Inherent", "Selected", "Naval", "Cheerful", "Almighty", "Benevolent", "Eternal", "Immutable", "Infallible"],
|
"Goddess",
|
||||||
genitive: ["Day", "Life", "Death", "Night", "Home", "Fog", "Snow", "Winter", "Summer", "Cold", "Springs", "Gates", "Nature", "Thunder", "Lightning", "War", "Ice", "Frost", "Fire", "Doom", "Fate", "Pain", "Heaven", "Justice", "Light", "Love", "Time", "Victory"],
|
"Lord",
|
||||||
theGenitive: ["World", "Word", "South", "West", "North", "East", "Sun", "Moon", "Peak", "Fall", "Dawn", "Eclipse", "Abyss", "Blood", "Tree", "Earth", "Harvest", "Rainbow", "Sea", "Sky", "Stars", "Storm", "Underworld", "Wild"],
|
"Lady",
|
||||||
|
"Deity",
|
||||||
|
"Creator",
|
||||||
|
"Maker",
|
||||||
|
"Overlord",
|
||||||
|
"Ruler",
|
||||||
|
"Chief",
|
||||||
|
"Master",
|
||||||
|
"Spirit",
|
||||||
|
"Ancestor",
|
||||||
|
"Father",
|
||||||
|
"Forebear",
|
||||||
|
"Forefather",
|
||||||
|
"Mother",
|
||||||
|
"Brother",
|
||||||
|
"Sister",
|
||||||
|
"Elder",
|
||||||
|
"Numen",
|
||||||
|
"Ancient",
|
||||||
|
"Virgin",
|
||||||
|
"Giver",
|
||||||
|
"Council",
|
||||||
|
"Guardian",
|
||||||
|
"Reaper"
|
||||||
|
],
|
||||||
|
animal: [
|
||||||
|
"Dragon",
|
||||||
|
"Wyvern",
|
||||||
|
"Phoenix",
|
||||||
|
"Unicorn",
|
||||||
|
"Sphinx",
|
||||||
|
"Centaur",
|
||||||
|
"Pegasus",
|
||||||
|
"Kraken",
|
||||||
|
"Basilisk",
|
||||||
|
"Chimera",
|
||||||
|
"Cyclope",
|
||||||
|
"Antelope",
|
||||||
|
"Ape",
|
||||||
|
"Badger",
|
||||||
|
"Bear",
|
||||||
|
"Beaver",
|
||||||
|
"Bison",
|
||||||
|
"Boar",
|
||||||
|
"Buffalo",
|
||||||
|
"Cat",
|
||||||
|
"Cobra",
|
||||||
|
"Crane",
|
||||||
|
"Crocodile",
|
||||||
|
"Crow",
|
||||||
|
"Deer",
|
||||||
|
"Dog",
|
||||||
|
"Eagle",
|
||||||
|
"Elk",
|
||||||
|
"Fox",
|
||||||
|
"Goat",
|
||||||
|
"Goose",
|
||||||
|
"Hare",
|
||||||
|
"Hawk",
|
||||||
|
"Heron",
|
||||||
|
"Horse",
|
||||||
|
"Hyena",
|
||||||
|
"Ibis",
|
||||||
|
"Jackal",
|
||||||
|
"Jaguar",
|
||||||
|
"Lark",
|
||||||
|
"Leopard",
|
||||||
|
"Lion",
|
||||||
|
"Mantis",
|
||||||
|
"Marten",
|
||||||
|
"Moose",
|
||||||
|
"Mule",
|
||||||
|
"Narwhal",
|
||||||
|
"Owl",
|
||||||
|
"Panther",
|
||||||
|
"Rat",
|
||||||
|
"Raven",
|
||||||
|
"Rook",
|
||||||
|
"Scorpion",
|
||||||
|
"Shark",
|
||||||
|
"Sheep",
|
||||||
|
"Snake",
|
||||||
|
"Spider",
|
||||||
|
"Swan",
|
||||||
|
"Tiger",
|
||||||
|
"Turtle",
|
||||||
|
"Viper",
|
||||||
|
"Vulture",
|
||||||
|
"Walrus",
|
||||||
|
"Wolf",
|
||||||
|
"Wolverine",
|
||||||
|
"Worm",
|
||||||
|
"Camel",
|
||||||
|
"Falcon",
|
||||||
|
"Hound",
|
||||||
|
"Ox",
|
||||||
|
"Serpent"
|
||||||
|
],
|
||||||
|
adjective: [
|
||||||
|
"New",
|
||||||
|
"Good",
|
||||||
|
"High",
|
||||||
|
"Old",
|
||||||
|
"Great",
|
||||||
|
"Big",
|
||||||
|
"Young",
|
||||||
|
"Major",
|
||||||
|
"Strong",
|
||||||
|
"Happy",
|
||||||
|
"Last",
|
||||||
|
"Main",
|
||||||
|
"Huge",
|
||||||
|
"Far",
|
||||||
|
"Beautiful",
|
||||||
|
"Wild",
|
||||||
|
"Fair",
|
||||||
|
"Prime",
|
||||||
|
"Crazy",
|
||||||
|
"Ancient",
|
||||||
|
"Proud",
|
||||||
|
"Secret",
|
||||||
|
"Lucky",
|
||||||
|
"Sad",
|
||||||
|
"Silent",
|
||||||
|
"Latter",
|
||||||
|
"Severe",
|
||||||
|
"Fat",
|
||||||
|
"Holy",
|
||||||
|
"Pure",
|
||||||
|
"Aggressive",
|
||||||
|
"Honest",
|
||||||
|
"Giant",
|
||||||
|
"Mad",
|
||||||
|
"Pregnant",
|
||||||
|
"Distant",
|
||||||
|
"Lost",
|
||||||
|
"Broken",
|
||||||
|
"Blind",
|
||||||
|
"Friendly",
|
||||||
|
"Unknown",
|
||||||
|
"Sleeping",
|
||||||
|
"Slumbering",
|
||||||
|
"Loud",
|
||||||
|
"Hungry",
|
||||||
|
"Wise",
|
||||||
|
"Worried",
|
||||||
|
"Sacred",
|
||||||
|
"Magical",
|
||||||
|
"Superior",
|
||||||
|
"Patient",
|
||||||
|
"Dead",
|
||||||
|
"Deadly",
|
||||||
|
"Peaceful",
|
||||||
|
"Grateful",
|
||||||
|
"Frozen",
|
||||||
|
"Evil",
|
||||||
|
"Scary",
|
||||||
|
"Burning",
|
||||||
|
"Divine",
|
||||||
|
"Bloody",
|
||||||
|
"Dying",
|
||||||
|
"Waking",
|
||||||
|
"Brutal",
|
||||||
|
"Unhappy",
|
||||||
|
"Calm",
|
||||||
|
"Cruel",
|
||||||
|
"Favorable",
|
||||||
|
"Blond",
|
||||||
|
"Explicit",
|
||||||
|
"Disturbing",
|
||||||
|
"Devastating",
|
||||||
|
"Brave",
|
||||||
|
"Sunny",
|
||||||
|
"Troubled",
|
||||||
|
"Flying",
|
||||||
|
"Sustainable",
|
||||||
|
"Marine",
|
||||||
|
"Fatal",
|
||||||
|
"Inherent",
|
||||||
|
"Selected",
|
||||||
|
"Naval",
|
||||||
|
"Cheerful",
|
||||||
|
"Almighty",
|
||||||
|
"Benevolent",
|
||||||
|
"Eternal",
|
||||||
|
"Immutable",
|
||||||
|
"Infallible"
|
||||||
|
],
|
||||||
|
genitive: [
|
||||||
|
"Day",
|
||||||
|
"Life",
|
||||||
|
"Death",
|
||||||
|
"Night",
|
||||||
|
"Home",
|
||||||
|
"Fog",
|
||||||
|
"Snow",
|
||||||
|
"Winter",
|
||||||
|
"Summer",
|
||||||
|
"Cold",
|
||||||
|
"Springs",
|
||||||
|
"Gates",
|
||||||
|
"Nature",
|
||||||
|
"Thunder",
|
||||||
|
"Lightning",
|
||||||
|
"War",
|
||||||
|
"Ice",
|
||||||
|
"Frost",
|
||||||
|
"Fire",
|
||||||
|
"Doom",
|
||||||
|
"Fate",
|
||||||
|
"Pain",
|
||||||
|
"Heaven",
|
||||||
|
"Justice",
|
||||||
|
"Light",
|
||||||
|
"Love",
|
||||||
|
"Time",
|
||||||
|
"Victory"
|
||||||
|
],
|
||||||
|
theGenitive: [
|
||||||
|
"World",
|
||||||
|
"Word",
|
||||||
|
"South",
|
||||||
|
"West",
|
||||||
|
"North",
|
||||||
|
"East",
|
||||||
|
"Sun",
|
||||||
|
"Moon",
|
||||||
|
"Peak",
|
||||||
|
"Fall",
|
||||||
|
"Dawn",
|
||||||
|
"Eclipse",
|
||||||
|
"Abyss",
|
||||||
|
"Blood",
|
||||||
|
"Tree",
|
||||||
|
"Earth",
|
||||||
|
"Harvest",
|
||||||
|
"Rainbow",
|
||||||
|
"Sea",
|
||||||
|
"Sky",
|
||||||
|
"Stars",
|
||||||
|
"Storm",
|
||||||
|
"Underworld",
|
||||||
|
"Wild"
|
||||||
|
],
|
||||||
color: ["Dark", "Light", "Bright", "Golden", "White", "Black", "Red", "Pink", "Purple", "Blue", "Green", "Yellow", "Amber", "Orange", "Brown", "Grey"]
|
color: ["Dark", "Light", "Bright", "Golden", "White", "Black", "Red", "Pink", "Purple", "Blue", "Green", "Yellow", "Amber", "Orange", "Brown", "Grey"]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -29,7 +287,16 @@ window.Religions = (function () {
|
||||||
Heresy: {Heresy: 1}
|
Heresy: {Heresy: 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
const methods = {"Random + type": 3, "Random + ism": 1, "Supreme + ism": 5, "Faith of + Supreme": 5, "Place + ism": 1, "Culture + ism": 2, "Place + ian + type": 6, "Culture + type": 4};
|
const methods = {
|
||||||
|
"Random + type": 3,
|
||||||
|
"Random + ism": 1,
|
||||||
|
"Supreme + ism": 5,
|
||||||
|
"Faith of + Supreme": 5,
|
||||||
|
"Place + ism": 1,
|
||||||
|
"Culture + ism": 2,
|
||||||
|
"Place + ian + type": 6,
|
||||||
|
"Culture + type": 4
|
||||||
|
};
|
||||||
|
|
||||||
const types = {
|
const types = {
|
||||||
Shamanism: {Beliefs: 3, Shamanism: 2, Spirits: 1},
|
Shamanism: {Beliefs: 3, Shamanism: 2, Spirits: 1},
|
||||||
|
|
@ -78,7 +345,10 @@ window.Religions = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
const burgs = pack.burgs.filter(b => b.i && !b.removed);
|
const burgs = pack.burgs.filter(b => b.i && !b.removed);
|
||||||
const sorted = burgs.length > +religionsInput.value ? burgs.sort((a, b) => b.population - a.population).map(b => b.cell) : cells.i.filter(i => cells.s[i] > 2).sort((a, b) => cells.s[b] - cells.s[a]);
|
const sorted =
|
||||||
|
burgs.length > +religionsInput.value
|
||||||
|
? burgs.sort((a, b) => b.population - a.population).map(b => b.cell)
|
||||||
|
: cells.i.filter(i => cells.s[i] > 2).sort((a, b) => cells.s[b] - cells.s[a]);
|
||||||
const religionsTree = d3.quadtree();
|
const religionsTree = d3.quadtree();
|
||||||
const spacing = (graphWidth + graphHeight) / 6 / religionsInput.value; // base min distance between towns
|
const spacing = (graphWidth + graphHeight) / 6 / religionsInput.value; // base min distance between towns
|
||||||
const cultsCount = Math.floor((rand(10, 40) / 100) * religionsInput.value);
|
const cultsCount = Math.floor((rand(10, 40) / 100) * religionsInput.value);
|
||||||
|
|
@ -160,9 +430,20 @@ window.Religions = (function () {
|
||||||
const name = getCultName("Heresy", center);
|
const name = getCultName("Heresy", center);
|
||||||
const expansionism = gauss(1.2, 0.5, 0, 5);
|
const expansionism = gauss(1.2, 0.5, 0, 5);
|
||||||
const color = getMixedColor(r.color, 0.4, 0.2); // "url(#hatch6)";
|
const color = getMixedColor(r.color, 0.4, 0.2); // "url(#hatch6)";
|
||||||
religions.push({i: religions.length, name, color, culture, type: "Heresy", form: r.form, deity: r.deity, expansion: "global", expansionism, center, origin: r.i});
|
religions.push({
|
||||||
|
i: religions.length,
|
||||||
|
name,
|
||||||
|
color,
|
||||||
|
culture,
|
||||||
|
type: "Heresy",
|
||||||
|
form: r.form,
|
||||||
|
deity: r.deity,
|
||||||
|
expansion: "global",
|
||||||
|
expansionism,
|
||||||
|
center,
|
||||||
|
origin: r.i
|
||||||
|
});
|
||||||
religionsTree.add([x, y]);
|
religionsTree.add([x, y]);
|
||||||
//debug.append("circle").attr("cx", x).attr("cy", y).attr("r", 2).attr("fill", "green");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -195,7 +476,24 @@ window.Religions = (function () {
|
||||||
name,
|
name,
|
||||||
religions.map(r => r.code)
|
religions.map(r => r.code)
|
||||||
);
|
);
|
||||||
religions.push({i, name, color, culture, type, form: formName, deity, expansion, expansionism: 0, center, cells: 0, area: 0, rural: 0, urban: 0, origin: r, code});
|
religions.push({
|
||||||
|
i,
|
||||||
|
name,
|
||||||
|
color,
|
||||||
|
culture,
|
||||||
|
type,
|
||||||
|
form: formName,
|
||||||
|
deity,
|
||||||
|
expansion,
|
||||||
|
expansionism: 0,
|
||||||
|
center,
|
||||||
|
cells: 0,
|
||||||
|
area: 0,
|
||||||
|
rural: 0,
|
||||||
|
urban: 0,
|
||||||
|
origin: r,
|
||||||
|
code
|
||||||
|
});
|
||||||
cells.religion[center] = i;
|
cells.religion[center] = i;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -292,21 +590,19 @@ window.Religions = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
function checkCenters() {
|
function checkCenters() {
|
||||||
const cells = pack.cells,
|
const {cells, religions} = pack;
|
||||||
religions = pack.religions;
|
|
||||||
|
|
||||||
const codes = religions.map(r => r.code);
|
const codes = religions.map(r => r.code);
|
||||||
religions
|
religions.forEach(r => {
|
||||||
.filter(r => r.i)
|
if (!r.i) return;
|
||||||
.forEach(r => {
|
r.code = abbreviate(r.name, codes);
|
||||||
r.code = abbreviate(r.name, codes);
|
|
||||||
|
|
||||||
// move religion center if it's not within religion area after expansion
|
// move religion center if it's not within religion area after expansion
|
||||||
if (cells.religion[r.center] === r.i) return; // in area
|
if (cells.religion[r.center] === r.i) return; // in area
|
||||||
const religCells = cells.i.filter(i => cells.religion[i] === r.i);
|
const religCells = cells.i.filter(i => cells.religion[i] === r.i);
|
||||||
if (!religCells.length) return; // extinct religion
|
if (!religCells.length) return; // extinct religion
|
||||||
r.center = religCells.sort((a, b) => b.pop - a.pop)[0];
|
r.center = religCells.sort((a, b) => cells.pop[b] - cells.pop[a])[0];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCultures() {
|
function updateCultures() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue