mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
v1.0.10
This commit is contained in:
parent
263c2d6a3c
commit
0140eccd9f
15 changed files with 31 additions and 64 deletions
BIN
.DS_Store
vendored
BIN
.DS_Store
vendored
Binary file not shown.
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
.DS_Store
|
|
||||||
wikidata
|
|
||||||
2
LICENSE
2
LICENSE
|
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2018-2019 Max Ganiev (Azgaar)
|
Copyright 2018-2019 Max Ganiev (Azgaar), azgaar.fmg@yandex.by
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Refer to the [project wiki](https://github.com/Azgaar/Fantasy-Map-Generator/wiki
|
||||||
|
|
||||||
[](https://cdn.discordapp.com/attachments/515359096925454350/593891237984206848/The_Wichin_Island_-_diplomacy.png)
|
[](https://cdn.discordapp.com/attachments/515359096925454350/593891237984206848/The_Wichin_Island_-_diplomacy.png)
|
||||||
|
|
||||||
Join our [Reddit community](https://www.reddit.com/r/FantasyMapGenerator) and [Discord server](https://discordapp.com/invite/X7E84HU) to share the created maps, discuss the Generator, suggest ideas and get a most recent updates. You may also contact me directly via [email](mailto:maxganiev@yandex.com). For bug reports please use the project [issues page](https://github.com/Azgaar/Fantasy-Map-Generator/issues) or Discord "Bugs" channel. If you are facing performance issues, please read [the tips](https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Tips#performance-tips).
|
Join our [Reddit community](https://www.reddit.com/r/FantasyMapGenerator) and [Discord server](https://discordapp.com/invite/X7E84HU) to share the created maps, discuss the Generator, suggest ideas and get a most recent updates. You may also contact me directly via [email](mailto:azgaar.fmg@yandex.by). For bug reports please use the project [issues page](https://github.com/Azgaar/Fantasy-Map-Generator/issues) or Discord "Bugs" channel. If you are facing performance issues, please read [the tips](https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Tips#performance-tips).
|
||||||
|
|
||||||
You can support the project [on Patreon](https://www.patreon.com/azgaar).
|
You can support the project [on Patreon](https://www.patreon.com/azgaar).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1931,7 +1931,7 @@ svg.button {
|
||||||
|
|
||||||
#errorBox {
|
#errorBox {
|
||||||
font-size: .9em;
|
font-size: .9em;
|
||||||
font-family: monospace;
|
font-family: Consolas, monospace;
|
||||||
color: #920303;
|
color: #920303;
|
||||||
background-color: #dabdbd91;
|
background-color: #dabdbd91;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
|
|
|
||||||
|
|
@ -1812,7 +1812,7 @@
|
||||||
<div id="aboutContent" class="tabcontent">
|
<div id="aboutContent" class="tabcontent">
|
||||||
<p><a href="https://github.com/Azgaar/Fantasy-Map-Generator" target="_blank">Fantasy Map Generator</a> is a free <a href="https://github.com/Azgaar/Fantasy-Map-Generator/blob/master/LICENSE" target="_blank">open source</a> tool which procedurally generates fantasy maps. You may use auto-generated maps as they are, edit them or even create a new map from scratch. Check out the <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Quick-Start-Tutorial" target="_blank">quick start tutorial</a> and <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki" target="_blank">project wiki</a> for guidance.</p>
|
<p><a href="https://github.com/Azgaar/Fantasy-Map-Generator" target="_blank">Fantasy Map Generator</a> is a free <a href="https://github.com/Azgaar/Fantasy-Map-Generator/blob/master/LICENSE" target="_blank">open source</a> tool which procedurally generates fantasy maps. You may use auto-generated maps as they are, edit them or even create a new map from scratch. Check out the <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Quick-Start-Tutorial" target="_blank">quick start tutorial</a> and <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki" target="_blank">project wiki</a> for guidance.</p>
|
||||||
<p>Join our <a href='https://discordapp.com/invite/X7E84HU' target='_blank'>Discord server</a> and <a href="https://www.reddit.com/r/FantasyMapGenerator/" target="_blank">Reddit community</a> to ask questions, get help and share created maps. You may support the project on <a href='https://www.patreon.com/azgaar' target='_blank'>Patreon</a>.</p>
|
<p>Join our <a href='https://discordapp.com/invite/X7E84HU' target='_blank'>Discord server</a> and <a href="https://www.reddit.com/r/FantasyMapGenerator/" target="_blank">Reddit community</a> to ask questions, get help and share created maps. You may support the project on <a href='https://www.patreon.com/azgaar' target='_blank'>Patreon</a>.</p>
|
||||||
<p>The project is under active development. For older versions see the <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog" target="_blank">changelog</a>. To track the development progress see the <a href="https://trello.com/b/7x832DG4/fantasy-map-generator" target="_blank">devboard</a>. Please report bugs <a href="https://github.com/Azgaar/Fantasy-Map-Generator/issues" target="_blank">here</a>. You can also contact me directly via <a href="mailto:maxganiev@yandex.ru" target="_blank">email</a>.</p>
|
<p>The project is under active development. For older versions see the <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog" target="_blank">changelog</a>. To track the development progress see the <a href="https://trello.com/b/7x832DG4/fantasy-map-generator" target="_blank">devboard</a>. Please report bugs <a href="https://github.com/Azgaar/Fantasy-Map-Generator/issues" target="_blank">here</a>. You can also contact me directly via <a href="mailto:azgaar.fmg@yandex.by" target="_blank">email</a>.</p>
|
||||||
<p>A special thanks to all supporters! <i data-tip="Click to see supporters names" class="collapsible icon-down-open pointer"></i></p>
|
<p>A special thanks to all supporters! <i data-tip="Click to see supporters names" class="collapsible icon-down-open pointer"></i></p>
|
||||||
<p style="display:none">Supporters: Aaron Meyer, Ahmad Amerih, AstralJacks, aymeric, Billy Dean Goehring, Branndon Edwards,
|
<p style="display:none">Supporters: Aaron Meyer, Ahmad Amerih, AstralJacks, aymeric, Billy Dean Goehring, Branndon Edwards,
|
||||||
Chase Mayers, Curt Flood, cyninge, Dino Princip, E.M. White, es, Fondue, Fritjof Olsson, Gatsu, Johan Fröberg, Jonathan Moore,
|
Chase Mayers, Curt Flood, cyninge, Dino Princip, E.M. White, es, Fondue, Fritjof Olsson, Gatsu, Johan Fröberg, Jonathan Moore,
|
||||||
|
|
@ -1838,7 +1838,7 @@
|
||||||
<div id="saveMap" data-tip="Download the map as fully functional .map file to your machine. Shortcut: Ctrl + M">.map</div>
|
<div id="saveMap" data-tip="Download the map as fully functional .map file to your machine. Shortcut: Ctrl + M">.map</div>
|
||||||
<div id="saveSVG" data-tip="Download the map as vector image (open in browser or Inkscape). Shortcut: Ctrl + S">.svg</div>
|
<div id="saveSVG" data-tip="Download the map as vector image (open in browser or Inkscape). Shortcut: Ctrl + S">.svg</div>
|
||||||
<div id="savePNG" data-tip="Download visible part of the map as .png image. Shortcut: Ctrl + P">.png</div>
|
<div id="savePNG" data-tip="Download visible part of the map as .png image. Shortcut: Ctrl + P">.png</div>
|
||||||
<div id="saveGeo" data-tip="Download cell data as GeoJSON (for use in GIS tools such as QGIS).">.json</div>
|
<div id="saveGeo" data-tip="Download map data as GeoJSON (for use in GIS tools such as QGIS)">.json</div>
|
||||||
<div id="quickSave" data-tip="Save map to browser storage. Shortcut: F6">storage</div>
|
<div id="quickSave" data-tip="Save map to browser storage. Shortcut: F6">storage</div>
|
||||||
<!-- <div id="saveDropbox" data-tip="Save fully functional .map file to Dropbox. Shortcut: Ctrl + B">Dropbox</div> -->
|
<!-- <div id="saveDropbox" data-tip="Save fully functional .map file to Dropbox. Shortcut: Ctrl + B">Dropbox</div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -2385,7 +2385,7 @@
|
||||||
<button id="templateRedo" data-tip="Redo the action" class="icon-cw" disabled></button>
|
<button id="templateRedo" data-tip="Redo the action" class="icon-cw" disabled></button>
|
||||||
<button id="templateSave" data-tip="Download the template as a text file" class="icon-download"></button>
|
<button id="templateSave" data-tip="Download the template as a text file" class="icon-download"></button>
|
||||||
<button id="templateLoad" data-tip="Open previously downloaded template" class="icon-upload"></button>
|
<button id="templateLoad" data-tip="Open previously downloaded template" class="icon-upload"></button>
|
||||||
<button id="templateMail" onclick="window.open('mailto:maxganiev@yandex.com?Subject=Template%20suggestion', '_blank')" data-tip="Send a template suggestion to Azgaar" class="icon-mail-alt"></button>
|
<button id="templateMail" onclick="window.open('mailto:azgaar.fmg@yandex.by?Subject=Template%20suggestion', '_blank')" data-tip="Send a template suggestion to Azgaar" class="icon-mail-alt"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
15
main.js
15
main.js
|
|
@ -1,5 +1,5 @@
|
||||||
// Fantasy Map Generator main script
|
// Fantasy Map Generator main script
|
||||||
// Azgaar (maxganiev@yandex.com). Minsk, 2017-2019
|
// Azgaar (azgaar.fmg@yandex.by). Minsk, 2017-2019
|
||||||
// https://github.com/Azgaar/Fantasy-Map-Generator
|
// https://github.com/Azgaar/Fantasy-Map-Generator
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
||||||
|
|
@ -688,17 +688,14 @@ function generate() {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
clearMainTip();
|
clearMainTip();
|
||||||
|
|
||||||
const regex =/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
|
||||||
const errorNoURL = error.stack.replace(regex, url => '<i>' + last(url.split("/")) + '</i>');
|
|
||||||
const errorParsed = errorNoURL.replace(/at /ig, "<br> at ");
|
|
||||||
|
|
||||||
alertMessage.innerHTML = `An error is occured on map generation. Please retry.
|
alertMessage.innerHTML = `An error is occured on map generation. Please retry.
|
||||||
<br>If error persists, clear the stored data and try again.
|
<br>If error is critical, clear the stored data and try again.
|
||||||
<p id="errorBox">${errorParsed}</p>`;
|
<p id="errorBox">${parseError(error)}</p>`;
|
||||||
$("#alert").dialog({
|
$("#alert").dialog({
|
||||||
resizable: false, title: "Generation error", maxWidth:500, buttons: {
|
resizable: false, title: "Generation error", width:320, buttons: {
|
||||||
"Clear data": function() {localStorage.clear(); localStorage.setItem("version", version);},
|
"Clear data": function() {localStorage.clear(); localStorage.setItem("version", version);},
|
||||||
Regenerate: function() {regenerateMap(); $(this).dialog("close");}
|
Regenerate: function() {regenerateMap(); $(this).dialog("close");},
|
||||||
|
Ignore: function() {$(this).dialog("close");}
|
||||||
}, position: {my: "center", at: "center", of: "svg"}
|
}, position: {my: "center", at: "center", of: "svg"}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
Hill 6-12 10-20 10-90 10-90
|
|
||||||
Hill 2-5 20-30 25-75 20-80
|
|
||||||
Smooth 1 0 0 0
|
|
||||||
Range 0-2 30-60 25-75 25-75
|
|
||||||
Smooth 2 0 0 0
|
|
||||||
Range 1-2 40-50 40-60 40-60
|
|
||||||
Multiply 1.2 land 0 0
|
|
||||||
Pit 1-3 10-30 30-70 20-80
|
|
||||||
Trough 0-2 20-30 15-85 20-80
|
|
||||||
Hill 2-4 10-25 15-85 20-80
|
|
||||||
Smooth 3 0 0 0
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
Hill 2-3 10-25 20-30 20-30
|
|
||||||
Hill 1-2 10-25 20-30 70-80
|
|
||||||
Hill 2-3 10-25 70-80 20-30
|
|
||||||
Hill 1-2 10-25 70-80 70-80
|
|
||||||
Hill 6-12 10-20 30-70 30-70
|
|
||||||
Smooth 1 0 0 0
|
|
||||||
Hill 4-6 10-30 30-70 30-70
|
|
||||||
Range 1-2 40-50 20-80 20-40
|
|
||||||
Trough 1-2 10-30 15-85 40-80
|
|
||||||
Pit 2-4 10-20 15-85 20-80
|
|
||||||
Pit 1-2 20-30 25-75 60-80
|
|
||||||
Smooth 3 0 0 0
|
|
||||||
Range 0-2 40-50 15-85 20-80
|
|
||||||
Trough 0-2 40-50 15-85 20-80
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
Hill 1 90-100 45-55 25-30
|
|
||||||
Hill 1 60-80 45-55 70-75
|
|
||||||
Hill 1 60-80 30-50 40-50
|
|
||||||
Hill 1 40-50 50-70 40-60
|
|
||||||
Multiply 0.6 20-100 0 0
|
|
||||||
Smooth 1 0 0 0
|
|
||||||
Range 0-2 40-50 30-60 30-60
|
|
||||||
Trough 1-3 20-40 25-75 20-80
|
|
||||||
Smooth 2 0 0 0
|
|
||||||
Pit 3-5 10-30 15-85 20-80
|
|
||||||
Hill 3-5 10-30 20-80 20-80
|
|
||||||
Range 1-2 20-50 30-70 20-65
|
|
||||||
Trough 1-2 20-50 15-85 20-80
|
|
||||||
|
|
@ -436,6 +436,8 @@
|
||||||
|
|
||||||
void function drawLabels() {
|
void function drawLabels() {
|
||||||
const g = labels.select("#states"), t = defs.select("#textPaths");
|
const g = labels.select("#states"), t = defs.select("#textPaths");
|
||||||
|
const displayed = layerIsOn("toggleLabels");
|
||||||
|
if (!displayed) toggleLabels();
|
||||||
|
|
||||||
if (!list) {
|
if (!list) {
|
||||||
g.selectAll("text").remove();
|
g.selectAll("text").remove();
|
||||||
|
|
@ -520,6 +522,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
example.remove();
|
example.remove();
|
||||||
|
if (!displayed) toggleLabels();
|
||||||
}()
|
}()
|
||||||
|
|
||||||
console.timeEnd("drawStateLabels");
|
console.timeEnd("drawStateLabels");
|
||||||
|
|
@ -583,6 +586,7 @@
|
||||||
const generateDiplomacy = function() {
|
const generateDiplomacy = function() {
|
||||||
console.time("generateDiplomacy");
|
console.time("generateDiplomacy");
|
||||||
const cells = pack.cells, states = pack.states;
|
const cells = pack.cells, states = pack.states;
|
||||||
|
const chronicle = states[0].diplomacy = [];
|
||||||
const valid = states.filter(s => s.i && !states.removed);
|
const valid = states.filter(s => s.i && !states.removed);
|
||||||
if (valid.length < 2) return;
|
if (valid.length < 2) return;
|
||||||
|
|
||||||
|
|
@ -592,7 +596,6 @@
|
||||||
const navals = {"Neutral":1, "Suspicion":2, "Rival":1, "Unknown":1}; // relations of naval powers
|
const navals = {"Neutral":1, "Suspicion":2, "Rival":1, "Unknown":1}; // relations of naval powers
|
||||||
|
|
||||||
valid.forEach(s => s.diplomacy = new Array(states.length).fill("x")); // clear all relationships
|
valid.forEach(s => s.diplomacy = new Array(states.length).fill("x")); // clear all relationships
|
||||||
const chronicle = states[0].diplomacy = [];
|
|
||||||
const areaMean = d3.mean(valid.map(s => s.area)); // avarage state area
|
const areaMean = d3.mean(valid.map(s => s.area)); // avarage state area
|
||||||
|
|
||||||
// generic relations
|
// generic relations
|
||||||
|
|
|
||||||
|
|
@ -695,6 +695,7 @@ function parseLoadedData(data) {
|
||||||
|
|
||||||
// v 1.0 initially has Sympathy status then relaced with Friendly
|
// v 1.0 initially has Sympathy status then relaced with Friendly
|
||||||
for (const s of pack.states) {
|
for (const s of pack.states) {
|
||||||
|
if (!s.diplomacy) continue;
|
||||||
s.diplomacy = s.diplomacy.map(r => r === "Sympathy" ? "Friendly" : r);
|
s.diplomacy = s.diplomacy.map(r => r === "Sympathy" ? "Friendly" : r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -713,13 +714,9 @@ function parseLoadedData(data) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
clearMainTip();
|
clearMainTip();
|
||||||
|
|
||||||
const regex =/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
|
||||||
const errorNoURL = error.stack.replace(regex, url => '<i>' + last(url.split("/")) + '</i>');
|
|
||||||
const errorParsed = errorNoURL.replace(/ at /ig, "<br> at ");
|
|
||||||
|
|
||||||
alertMessage.innerHTML = `An error is occured on map loading. Select a different file to load,
|
alertMessage.innerHTML = `An error is occured on map loading. Select a different file to load,
|
||||||
<br>generate a new random map or cancel the loading
|
<br>generate a new random map or cancel the loading
|
||||||
<p id="errorBox">${errorParsed}</p>`;
|
<p id="errorBox">${parseError(error)}</p>`;
|
||||||
$("#alert").dialog({
|
$("#alert").dialog({
|
||||||
resizable: false, title: "Loading error", maxWidth:500, buttons: {
|
resizable: false, title: "Loading error", maxWidth:500, buttons: {
|
||||||
"Select file": function() {$(this).dialog("close"); mapToLoad.click();},
|
"Select file": function() {$(this).dialog("close"); mapToLoad.click();},
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
function editDiplomacy() {
|
function editDiplomacy() {
|
||||||
if (customization) return;
|
if (customization) return;
|
||||||
if (pack.states.filter(s => s.i && !s.removed).length < 2) {
|
if (pack.states.filter(s => s.i && !s.removed).length < 2) {
|
||||||
tip("There should be at least 2 states to edit the diplomacy", false, "Error");
|
tip("There should be at least 2 states to edit the diplomacy", false, "error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1011,11 +1011,11 @@ function toggleMarkers() {
|
||||||
function toggleLabels() {
|
function toggleLabels() {
|
||||||
if (!layerIsOn("toggleLabels")) {
|
if (!layerIsOn("toggleLabels")) {
|
||||||
turnButtonOn("toggleLabels");
|
turnButtonOn("toggleLabels");
|
||||||
$('#labels').fadeIn();
|
labels.attr("display", null)
|
||||||
invokeActiveZooming();
|
invokeActiveZooming();
|
||||||
} else {
|
} else {
|
||||||
turnButtonOff("toggleLabels");
|
turnButtonOff("toggleLabels");
|
||||||
$('#labels').fadeOut();
|
labels.attr("display", "none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue