Clarify JSON format as "LiBPoV JSON"
This commit is contained in:
parent
f635b083b9
commit
209e76a55e
@ -16,8 +16,8 @@ If you want to read the manual locally instead, open `manual.html` in your brows
|
||||
* Show biomes for given **world coordinates** only
|
||||
* Modify the **noise parameters** of the heat and humidity Perlin noises used by the mapgen
|
||||
* Visualize the biomes of the **v6 mapgen** in a special diagram
|
||||
* **Export** to Lua, JSON and *Amidst for Minetest* biome profiles
|
||||
* **Import** from JSON
|
||||
* **Export** to Lua, LiBPoV JSON and *Amidst for Minetest* biome profiles
|
||||
* **Import** from LiBPoV JSON and *Amidst for Minetest* biome profiles
|
||||
|
||||
## See also
|
||||
|
||||
|
@ -201,11 +201,11 @@ A Voronoi diagram is supposed to be here but for some reason it cannot be displa
|
||||
<br>
|
||||
<textarea id="inputImport" rows="12" cols="80"></textarea>
|
||||
<br>
|
||||
<button id="inputImportJSONSubmit" type="button">Import from <span class="importExportEmphasis">JSON</span></button>
|
||||
<button id="inputImportLibpovJSONSubmit" type="button">Import from <span class="importExportEmphasis">LiBPoV JSON</span></button>
|
||||
<button id="inputImportAmidstForMinetestSubmit" type="button">Import from <span class="importExportEmphasis">Amidst for Minetest</span> biome profile</button>
|
||||
<div id="importResultOuter" hidden><br><div id="importResultMessage"></div></div>
|
||||
<hr class="thin">
|
||||
<div>Hint: Use <a href="https://codeberg.org/Wuzzy/libpov_biome_exporter" title="Luanti mod: libpov_biome_exporter">libpov_biome_exporter</a> to convert game biomes to JSON.</div>
|
||||
<div>Hint: Use <a href="https://codeberg.org/Wuzzy/libpov_biome_exporter" title="Luanti mod: libpov_biome_exporter">libpov_biome_exporter</a> to convert game biomes to LiBPoV JSON.</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -215,7 +215,7 @@ A Voronoi diagram is supposed to be here but for some reason it cannot be displa
|
||||
<div class="configFrame" id="exportContainer" style="display:none">
|
||||
<form id="exportForm">
|
||||
<div>
|
||||
<button id="inputExportJSON" type="button">Export as <span class="importExportEmphasis">JSON</span></button>
|
||||
<button id="inputExportLibpovJSON" type="button">Export as <span class="importExportEmphasis">LiBPoV JSON</span></button>
|
||||
<button id="inputExportLua" type="button">Export as <span class="importExportEmphasis">Lua</span></button>
|
||||
<button id="inputExportAmidstForMinetest" type="button">Export as <span class="importExportEmphasis">Amidst for Minetest</span> biome profile</button>
|
||||
<button id="inputExportClear" type="button">Clear</button>
|
||||
|
10
libpov.js
10
libpov.js
@ -2307,14 +2307,14 @@ inputExportLua.onclick = function() {
|
||||
}
|
||||
exportSectionOuter.hidden = false;
|
||||
}
|
||||
inputExportJSON.onclick = function() {
|
||||
inputExportLibpovJSON.onclick = function() {
|
||||
// Convert the biome points to a new table
|
||||
let jsonPoints = [];
|
||||
for (let b=0; b<biomePoints.length; b++) {
|
||||
let biome = biomePoints[b];
|
||||
let jsonPoint = {};
|
||||
// Use different field names for the
|
||||
// JSON export to match the Lua field
|
||||
// LiBPoV JSON export to match the Lua field
|
||||
// names exactly.
|
||||
jsonPoint.name = biome.name;
|
||||
jsonPoint.heat_point = biome.heat;
|
||||
@ -2336,7 +2336,7 @@ inputExportJSON.onclick = function() {
|
||||
exportLabel.innerText = "Export is empty.";
|
||||
} else {
|
||||
exportSectionText.hidden = false;
|
||||
exportLabel.innerText = "Exported biomes (as JSON):";
|
||||
exportLabel.innerText = "Exported biomes (as LiBPoV JSON):";
|
||||
}
|
||||
exportSectionOuter.hidden = false;
|
||||
}
|
||||
@ -2402,6 +2402,8 @@ inputExportClear.onclick = function() {
|
||||
}
|
||||
/* Import */
|
||||
|
||||
// This importer is for both LiBPoV JSON
|
||||
// AND Amidst for Minetest biome profiles (which are also JSON-based)
|
||||
function importJSON(jsonType) {
|
||||
let importMessage = function(message) {
|
||||
importResultOuter.hidden = false;
|
||||
@ -2542,7 +2544,7 @@ function importJSON(jsonType) {
|
||||
}
|
||||
}
|
||||
|
||||
inputImportJSONSubmit.onclick = function() {
|
||||
inputImportLibpovJSONSubmit.onclick = function() {
|
||||
importJSON("libpov");
|
||||
}
|
||||
inputImportAmidstForMinetestSubmit.onclick = function() {
|
||||
|
30
manual.html
30
manual.html
@ -21,8 +21,8 @@
|
||||
<li>Show biomes for given <b>world coordinates</b> only</li>
|
||||
<li>Modify the <b>noise parameters</b> of the heat and humidity Perlin noises used by the mapgen</li>
|
||||
<li>Visualize the biomes of the <b>v6 mapgen</b> in a special diagram</li>
|
||||
<li><b>Export</b> to Lua, JSON and <i>Amidst for Minetest</i> biome profiles</li>
|
||||
<li><b>Import</b> from JSON</li>
|
||||
<li><b>Export</b> to Lua, LiBPoV JSON and <i>Amidst for Minetest</i> biome profiles</li>
|
||||
<li><b>Import</b> from LiBPoV JSON and <i>Amidst for Minetest</i> biome profiles</li>
|
||||
</ul>
|
||||
|
||||
<h2>Quick reminder how biomes work</h2>
|
||||
@ -119,16 +119,22 @@
|
||||
<h3>Import</h3>
|
||||
<p>This is only available in “Biome points” mode.</p>
|
||||
|
||||
<p>This allows you to <b>import biomes</b> from <b>JSON</b> text that has been exported before (see below). If you have a JSON text, just paste it in the text box and press “Import”. <b>This will replace all biomes.</b> A message below the text box will tell you if the import has succeeded or failed. If the import has failed, nothing will happen.</p>
|
||||
<p>This allows you to <b>import biomes</b> from text. There are two formats that can be imported:</p>
|
||||
|
||||
<p>You can also use the output of the Luanti helper mod <code><a href="https://codeberg.org/Wuzzy/libpov_biome_exporter" title="Luanti mod: libpov_biome_exporter">libpov_biome_exporter</a></code>. This is a small Luanti mod that prints the biomes of an existing Luanti game to the console, from which you can copy it directly into the import field. Refer to the README file of that mod for details.</p>
|
||||
<p><b>LiBPoV JSON</b> is LiBPoV’s native format that LiBPoV creates when exporting.</p>
|
||||
|
||||
<p>The <b>Amidst for Minetest</b> option imports from a biome profile from <a href="https://github.com/Treer/Amidst-for-Minetest">Amidst for Minetest</a>. Biome profile files usually have the ending “<code>.mt</code>”.</p>
|
||||
|
||||
<p>To use the import functionality, just paste the text in the text box and press the corresponding import button. <b>This will replace all biomes.</b> A message below the text box will tell you if the import has succeeded or failed. If the import has failed, nothing will happen.</p>
|
||||
|
||||
<p>To import biomes from an existing Luanti game, use the Luanti mod <code><a href="https://codeberg.org/Wuzzy/libpov_biome_exporter" title="Luanti mod: libpov_biome_exporter">libpov_biome_exporter</a></code>. This prints the biomes of an existing Luanti game in LiBPoV JSON format to the console, from which you can copy it to the import text box. Refer to the README file of that mod for details.</p>
|
||||
|
||||
<h3>Export</h3>
|
||||
<p>This is only available in “Biome points” mode.</p>
|
||||
|
||||
<p>This allows you to export the current biomes into a text. You can choose to export them in one of various formats. Only biome information is included, not the display settings or noise parameters.</p>
|
||||
<p>This allows you to export the current biomes into text. You can choose to export them in one of various formats. Only biome information is included, not the noise parameters.</p>
|
||||
|
||||
<p>The <b>JSON</b> export is a text you can use to import the biomes in LiBPoV later. This is the format most “native” to LiBPoV, as it contains all the information that LiBPoV uses, including the biome color in the diagram. You may want to copy this into a text file for later use.</p>
|
||||
<p>The <b>LiBPoV JSON</b> option exports the biomes in LiBPoV’s native format. This is the format most “native” to LiBPoV, as it contains all the biome information that LiBPoV uses, including the biome color in the diagram, but not the noise parameters. You may want to copy this into a text file for later use.</p>
|
||||
|
||||
<p>The <b>Lua</b> export gives you a very basic Lua code that can be pasted into a Luanti mod. The code is very basic and does not include the “landscape materials”, like what the surface is made of (dirt, stone, sand, etc.). Biome coordinate limits (<code>y_min</code>/<code>y_max</code> or <code>min_pos</code>/<code>max_pos</code>) are added to the export only if they differ from the default values -31000 and 31000.</p>
|
||||
|
||||
@ -148,10 +154,14 @@
|
||||
|
||||
<h2>Appendix</h2>
|
||||
|
||||
<h3>JSON format</h3>
|
||||
<p>LiBPoV uses a JSON format to import and export the biome points. This section explains the format used by LiBPoV.</p>
|
||||
<h3>LiBPoV JSON format</h3>
|
||||
<p>LiBPoV uses JSON to import and export the biome points. For general information about JSON, see <a href="https://www.json.org/" title="Introducing JSON">www.json.org</a>. This section explains how this format is used by LiBPoV.</p>
|
||||
|
||||
<p>The JSON used by LiBPoV is an array of objects. Each object represents a biome. Each of these objects must contain the following fields:</p>
|
||||
<p>“LiBPoV JSON” is just native JSON, no additional grammar is introduced. The name “LiBPoV JSON” is only used to clarify that LiBPoV is the intended use case for this JSON format. Because the <i>Amidst for Minetest</i> biome profiles are also JSON-based.</p>
|
||||
|
||||
<h4>Definition</h4>
|
||||
|
||||
<p>A LiBPoV JSON text is a JSON text that is an array of objects. Each object in that array represents a biome. Each of these objects must contain the following fields:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>name</code>: Biome name (string). Same name as in Lua</li>
|
||||
@ -173,8 +183,6 @@
|
||||
|
||||
<p>If unspecified, the minimum/maximum position arguments default to -31000 (minimum) and 31000 (maximum). If <code>color_index</code> is unspecified or is out of range, LiBPoV will pick a color index based on the position in the JSON array.</p>
|
||||
|
||||
<p>For general information about JSON, see <a href="https://www.json.org/" title="Introducing JSON">www.json.org</a>.</p>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user