From c71fed541e17927c425502a36f181e02e3bde09e Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sat, 7 Aug 2021 18:37:44 +0300 Subject: [PATCH 1/2] fix atoll heightmap template --- modules/heightmap-templates.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/heightmap-templates.js b/modules/heightmap-templates.js index 4a5860b8..3704a3e4 100644 --- a/modules/heightmap-templates.js +++ b/modules/heightmap-templates.js @@ -58,15 +58,12 @@ window.HeightmapTemplates = (function () { Strait 2 vertical 0 0 Strait 2 horizontal 0 0`; - const atoll = `Add 11 all 0 0 - Range 2-3 40-60 20-80 20-80 - Hill 5 15-20 10-90 30-70 - Hill 2 10-15 10-30 20-80 - Hill 2 10-15 60-90 20-80 - Smooth 3 0 0 0 - Trough 10 20-30 5-95 5-95 - Strait 2 vertical 0 0 - Strait 2 horizontal 0 0`; + const atoll = `Hill 1 75-80 50-60 45-55 + Hill 1.5 30-50 25-75 30-70 + Hill .5 30-50 25-35 30-70 + Smooth 1 0 0 0 + Multiply 0.2 25-100 0 0 + Hill .5 10-20 50-55 48-52`; const mediterranean = `Range 3-4 30-50 0-100 0-10 Range 3-4 30-50 0-100 90-100 From ec14e09c1402ffa7d7f10a1aad422b384433f651 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Wed, 11 Aug 2021 21:37:36 +0300 Subject: [PATCH 2/2] big cities to be capitals more often --- modules/burgs-and-states.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/burgs-and-states.js b/modules/burgs-and-states.js index 2538682a..cb486ff9 100644 --- a/modules/burgs-and-states.js +++ b/modules/burgs-and-states.js @@ -34,7 +34,8 @@ window.BurgsAndStates = (function () { let count = +regionsInput.value; 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 if (sorted.length < count * 10) { @@ -51,9 +52,8 @@ window.BurgsAndStates = (function () { let spacing = (graphWidth + graphHeight) / 2 / count; // min distance between capitals for (let i = 0; burgs.length <= count; i++) { - const cell = sorted[i], - x = cells.p[cell][0], - y = cells.p[cell][1]; + const cell = sorted[i]; + const [x, y] = cells.p[cell]; if (burgsTree.find(x, y, spacing) === undefined) { burgs.push({cell, x, y}); @@ -63,7 +63,9 @@ window.BurgsAndStates = (function () { if (i === sorted.length - 1) { WARN && console.warn("Cannot place capitals with current spacing. Trying again with reduced spacing"); burgsTree = d3.quadtree(); - (i = -1), (burgs = [0]), (spacing /= 1.2); + i = -1; + burgs = [0]; + spacing /= 1.2; } }