mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Merge branch 'master' of https://github.com/Azgaar/Fantasy-Map-Generator into dev-economics
This commit is contained in:
commit
0fb6363f2a
2 changed files with 13 additions and 14 deletions
|
|
@ -28,7 +28,8 @@ window.BurgsAndStates = (function () {
|
||||||
let count = +regionsInput.value;
|
let count = +regionsInput.value;
|
||||||
let burgs = [0];
|
let burgs = [0];
|
||||||
|
|
||||||
const score = new Int16Array(cells.s.map((s) => s * Math.random())); // cell score for capitals placement
|
const rand = () => 0.5 + Math.random() * 0.5;
|
||||||
|
const score = new Int16Array(cells.s.map((s) => s * rand())); // cell score for capitals placement
|
||||||
const sorted = cells.i.filter((i) => score[i] > 0 && cells.culture[i]).sort((a, b) => score[b] - score[a]); // filtered and sorted array of indexes
|
const sorted = cells.i.filter((i) => score[i] > 0 && cells.culture[i]).sort((a, b) => score[b] - score[a]); // filtered and sorted array of indexes
|
||||||
|
|
||||||
if (sorted.length < count * 10) {
|
if (sorted.length < count * 10) {
|
||||||
|
|
@ -45,9 +46,8 @@ window.BurgsAndStates = (function () {
|
||||||
let spacing = (graphWidth + graphHeight) / 2 / count; // min distance between capitals
|
let spacing = (graphWidth + graphHeight) / 2 / count; // min distance between capitals
|
||||||
|
|
||||||
for (let i = 0; burgs.length <= count; i++) {
|
for (let i = 0; burgs.length <= count; i++) {
|
||||||
const cell = sorted[i],
|
const cell = sorted[i];
|
||||||
x = cells.p[cell][0],
|
const [x, y] = cells.p[cell];
|
||||||
y = cells.p[cell][1];
|
|
||||||
|
|
||||||
if (burgsTree.find(x, y, spacing) === undefined) {
|
if (burgsTree.find(x, y, spacing) === undefined) {
|
||||||
burgs.push({cell, x, y});
|
burgs.push({cell, x, y});
|
||||||
|
|
@ -57,7 +57,9 @@ window.BurgsAndStates = (function () {
|
||||||
if (i === sorted.length - 1) {
|
if (i === sorted.length - 1) {
|
||||||
WARN && console.warn('Cannot place capitals with current spacing. Trying again with reduced spacing');
|
WARN && console.warn('Cannot place capitals with current spacing. Trying again with reduced spacing');
|
||||||
burgsTree = d3.quadtree();
|
burgsTree = d3.quadtree();
|
||||||
(i = -1), (burgs = [0]), (spacing /= 1.2);
|
i = -1;
|
||||||
|
burgs = [0];
|
||||||
|
spacing /= 1.2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,15 +58,12 @@ window.HeightmapTemplates = (function () {
|
||||||
Strait 2 vertical 0 0
|
Strait 2 vertical 0 0
|
||||||
Strait 2 horizontal 0 0`;
|
Strait 2 horizontal 0 0`;
|
||||||
|
|
||||||
const atoll = `Add 11 all 0 0
|
const atoll = `Hill 1 75-80 50-60 45-55
|
||||||
Range 2-3 40-60 20-80 20-80
|
Hill 1.5 30-50 25-75 30-70
|
||||||
Hill 5 15-20 10-90 30-70
|
Hill .5 30-50 25-35 30-70
|
||||||
Hill 2 10-15 10-30 20-80
|
Smooth 1 0 0 0
|
||||||
Hill 2 10-15 60-90 20-80
|
Multiply 0.2 25-100 0 0
|
||||||
Smooth 3 0 0 0
|
Hill .5 10-20 50-55 48-52`;
|
||||||
Trough 10 20-30 5-95 5-95
|
|
||||||
Strait 2 vertical 0 0
|
|
||||||
Strait 2 horizontal 0 0`;
|
|
||||||
|
|
||||||
const mediterranean = `Range 3-4 30-50 0-100 0-10
|
const mediterranean = `Range 3-4 30-50 0-100 0-10
|
||||||
Range 3-4 30-50 0-100 90-100
|
Range 3-4 30-50 0-100 90-100
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue