mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-23 04:21:24 +01:00
effective distanceScale
This commit is contained in:
parent
1b7fe659c1
commit
01cc1eec30
5 changed files with 23 additions and 12 deletions
20
index.html
20
index.html
|
|
@ -3506,14 +3506,22 @@
|
||||||
<div id="submapOptionsDialog" style="display: none; max-width:300px;" class="dialog">
|
<div id="submapOptionsDialog" style="display: none; max-width:300px;" class="dialog">
|
||||||
<p style="font-style: italic; color: red; font-weight:bold;">Original map will be destroyed! Don't forget to save your work!</p>
|
<p style="font-style: italic; color: red; font-weight:bold;">Original map will be destroyed! Don't forget to save your work!</p>
|
||||||
<p>Population rate (Units editor -> population) and map pixel size will
|
<p>Population rate (Units editor -> population) and map pixel size will
|
||||||
be automatically update according to the current scale factor. Options are interpreted as usual.</p>
|
be automatically updated according to the current scale factor. If you'd like
|
||||||
<hl />
|
to generate a new parent-map, <b>don't forget to reset them!</b> Options are interpreted as usual.</p>
|
||||||
|
<hr />
|
||||||
<div data-tip="All small cities of the parent map will be promoted to Capitals." >
|
<div data-tip="All small cities of the parent map will be promoted to Capitals." >
|
||||||
<input id="submapPromoteTown" class="checkbox" type="checkbox">
|
<input id="submapPromoteTown" class="checkbox" type="checkbox">
|
||||||
<label for="submapPromoteTown" class="checkbox-label">Promote towns to cities.</label>
|
<label for="submapPromoteTown" class="checkbox-label">Promote towns to cities.</label>
|
||||||
<input id="submapDepressRivers" class="checkbox" type="checkbox">
|
|
||||||
<label for="submapDepressRivers" class="checkbox-label">Errode riverbeds.</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div data-tip="Rivers on the parent map errode land (helps to get similar river network.)" >
|
||||||
|
<input id="submapDepressRivers" class="checkbox" type="checkbox">
|
||||||
|
<label for="submapDepressRivers" class="checkbox-label">Errode riverbeds.</label>
|
||||||
|
</div>
|
||||||
|
<div data-tip="Add lakes in depressions. (Can be very slow on big landmass!)" >
|
||||||
|
<input id="submapAddLakeInDepression" class="checkbox" type="checkbox">
|
||||||
|
<label for="submapAddLakeInDepression" class="checkbox-label">Add lakes in depressions.</label>
|
||||||
|
</div>
|
||||||
|
<hr/>
|
||||||
<button id="start" data-tip="Start submap resampling" class="options glow" onclick="generateSubmap()">Generate</button>
|
<button id="start" data-tip="Start submap resampling" class="options glow" onclick="generateSubmap()">Generate</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
1
main.js
1
main.js
|
|
@ -153,6 +153,7 @@ let mapCoordinates = {}; // map coordinates on globe
|
||||||
options.winds = [225, 45, 225, 315, 135, 315]; // default wind directions
|
options.winds = [225, 45, 225, 315, 135, 315]; // default wind directions
|
||||||
|
|
||||||
let populationRate = +document.getElementById("populationRateInput").value;
|
let populationRate = +document.getElementById("populationRateInput").value;
|
||||||
|
let distanceScale = +document.getElementById("distanceScaleInput").value;
|
||||||
let urbanization = +document.getElementById("urbanizationInput").value;
|
let urbanization = +document.getElementById("urbanizationInput").value;
|
||||||
|
|
||||||
applyStoredOptions();
|
applyStoredOptions();
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,14 @@ window.Rivers = (function () {
|
||||||
TIME && console.timeEnd("generateRivers");
|
TIME && console.timeEnd("generateRivers");
|
||||||
|
|
||||||
function drainWater() {
|
function drainWater() {
|
||||||
const MIN_FLUX_TO_FORM_RIVER = 30;
|
const MIN_FLUX_TO_FORM_RIVER = 10 * distanceScale;
|
||||||
const prec = grid.cells.prec;
|
const prec = grid.cells.prec;
|
||||||
const area = pack.cells.area;
|
const area = c => pack.cells.area[c] * distanceScale * distanceScale;
|
||||||
const land = cells.i.filter(i => h[i] >= 20).sort((a, b) => h[b] - h[a]);
|
const land = cells.i.filter(i => h[i] >= 20).sort((a, b) => h[b] - h[a]);
|
||||||
const lakeOutCells = Lakes.setClimateData(h);
|
const lakeOutCells = Lakes.setClimateData(h);
|
||||||
|
|
||||||
land.forEach(function (i) {
|
land.forEach(function (i) {
|
||||||
cells.fl[i] += prec[cells.g[i]] * area[i] / 100; // add flux from precipitation
|
cells.fl[i] += prec[cells.g[i]] * area(i) / 1000; // add flux from precipitation
|
||||||
|
|
||||||
// create lake outlet if lake is not in deep depression and flux > evaporation
|
// create lake outlet if lake is not in deep depression and flux > evaporation
|
||||||
const lakes = lakeOutCells[i] ? features.filter(feature => i === feature.outCell && feature.flux > feature.evaporation) : [];
|
const lakes = lakeOutCells[i] ? features.filter(feature => i === feature.outCell && feature.flux > feature.evaporation) : [];
|
||||||
|
|
@ -166,7 +166,7 @@ window.Rivers = (function () {
|
||||||
const mouth = riverCells[riverCells.length - 2];
|
const mouth = riverCells[riverCells.length - 2];
|
||||||
const parent = riverParents[key] || 0;
|
const parent = riverParents[key] || 0;
|
||||||
|
|
||||||
const widthFactor = !parent || parent === riverId ? 1.2 : 1;
|
const widthFactor = (!parent || parent === riverId ? 3.6 : 3) / distanceScale;
|
||||||
const meanderedPoints = addMeandering(riverCells);
|
const meanderedPoints = addMeandering(riverCells);
|
||||||
const discharge = cells.fl[mouth]; // m3 in second
|
const discharge = cells.fl[mouth]; // m3 in second
|
||||||
const length = rn(getApproximateLength(meanderedPoints), 2);
|
const length = rn(getApproximateLength(meanderedPoints), 2);
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ const generateSubmap = debounce(async function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix scale
|
// fix scale
|
||||||
distanceScaleInput.value = distanceScaleOutput.value = distanceScaleOutput.value / scale;
|
distanceScale = distanceScaleInput.value = distanceScaleOutput.value = distanceScaleOutput.value / scale;
|
||||||
populationRateInput.value = populationRateOutput.value = populationRateOutput.value / scale;
|
populationRate = populationRateInput.value = populationRateOutput.value = populationRateOutput.value / scale;
|
||||||
customization = 0;
|
customization = 0;
|
||||||
|
|
||||||
undraw();
|
undraw();
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ function editUnits() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeDistanceScale() {
|
function changeDistanceScale() {
|
||||||
|
distanceScale = +document.getElementById("distanceScaleInput").value;
|
||||||
drawScaleBar();
|
drawScaleBar();
|
||||||
calculateFriendlyGridSize();
|
calculateFriendlyGridSize();
|
||||||
}
|
}
|
||||||
|
|
@ -95,6 +96,7 @@ function editUnits() {
|
||||||
|
|
||||||
function restoreDefaultUnits() {
|
function restoreDefaultUnits() {
|
||||||
// distanceScale
|
// distanceScale
|
||||||
|
distanceScale = 3;
|
||||||
document.getElementById("distanceScaleOutput").value = 3;
|
document.getElementById("distanceScaleOutput").value = 3;
|
||||||
document.getElementById("distanceScaleInput").value = 3;
|
document.getElementById("distanceScaleInput").value = 3;
|
||||||
unlock("distanceScale");
|
unlock("distanceScale");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue