From f835ac43aede7d9b2d630f1408f02ef7aeaeb345 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Tue, 10 Mar 2026 01:21:52 +0100 Subject: [PATCH] Updated Data model (in progress) (markdown) --- Data-model-(in-progress).md | 180 +++++++++++++++++++++--------------- 1 file changed, 107 insertions(+), 73 deletions(-) diff --git a/Data-model-(in-progress).md b/Data-model-(in-progress).md index 63015ff..2b64690 100644 --- a/Data-model-(in-progress).md +++ b/Data-model-(in-progress).md @@ -5,6 +5,30 @@ Relevant links: * [Trello ticket](https://trello.com/c/IWltiMC2/902-rework-save-data-format) * [Refactor branch contract changes](https://github.com/Azgaar/Fantasy-Map-Generator/pull/842) +Architecture + +The overall desired architecture model is as below: + +``` + settings + │ + ▼ + GENERATORS + │ + ▼ + WORLD + (data + style) + │ + ┌─────────────┴─────────────┐ + ▼ ▼ + EDITORS RENDERERS + │ │ + ▼ ▼ +data mutations SVG or WebGL Canvas +``` + +All the map-related state should be represented by a single gigantic `map` object. When the `.map` file is saved, the object is transformed into a single json file. + Structure: `.map` file is a valid JSON capturing all data required to render and operate the map, including UI and style settings. @@ -27,25 +51,29 @@ Structure: "revision": 124 } }, + "settings": { "seed": "342342342323", "graph": { "width": 1280, - "heigh": 740, + "height": 740, "points": 50000 }, + "heightmap": { "template": "Volcano", "isRandom": false, "isPrecreated": false, "isCustom": false }, + "cultures": { "set": "Oriental", "limit": 11, "sizeVariety": 2, "growthRate": 1.3 }, + "states": { "limit": 14, "sizeVariety": 2, @@ -54,23 +82,29 @@ Structure: "mode": "auto" } }, + "provinces": { "ratio": 30 }, + "burgs": { "limit": null, "showMfcgMap": true }, + "religions": { "limit": 7 }, + "labels": { "autoHide": true, "rescaleOnZoom": true }, + "notes": { "pinned": false }, + "scaleBar": { "label": "", "position": { @@ -78,36 +112,32 @@ Structure: "y": 99 } }, + "military": { "units": { - "0": { - "name": "infantry" - } + "0": { "name": "infantry" } } }, + "world": { "name": "Narnia", + "calendar": { "year": 2024, "era": "Test Era", "eraShort": "TE" }, + "climate": { "temperature": { "equator": 30, "northPole": -30, "southPole": -25 }, - "winds": [ - 225, - 45, - 225, - 315, - 135, - 315 - ], + "winds": [225, 45, 225, 315, 135, 315], "precipitation": 100 }, + "geography": { "mapSize": 11, "latitudeShift": 50, @@ -115,23 +145,12 @@ Structure: "latN": 34 } }, + "units": { - "distance": { - "unit": "m", - "scale": 3 - }, - "area": { - "unit": "square", - "scale": 1 - }, - "height": { - "unit": "ft", - "exponent": 2 - }, - "temperature": { - "unit": "°C", - "scale": 1 - }, + "distance": { "unit": "m", "scale": 3 }, + "area": { "unit": "square", "scale": 1 }, + "height": { "unit": "ft", "exponent": 2 }, + "temperature": { "unit": "°C", "scale": 1 }, "population": { "scale": 1000, "urbanization": { @@ -141,11 +160,13 @@ Structure: } } }, + "layers": { "heightmap": false, "states": true } }, + "style": { "scaleBar": { "size": 2, @@ -153,61 +174,74 @@ Structure: "backColor": "#ffffff" } }, + "data": { - "grid": { - "cells": { - "i": [], - "temp": [] + + "topology": { + "grid": { + "cells": { + "i": [], + "temp": [] + }, + "vertices": { + "c": [[]] + } }, - "vertices": { - "c": [ - [] - ] + + "pack": { + "cells": { + "i": [], + "g": [], + "state": [], + "culture": [] + }, + "vertices": { + "c": [[]] + } } }, - "pack": { - "cells": { - "i": [], - "g": [], - "state": [], - "culture": [] - }, - "vertices": { - "c": [ - [] - ] + + "geography": { + "biomes": { + "0": { + "name": "Marine", + "isCustom": false, + "cells": 354 + }, + "1": {} } }, - "biomes": { - "0": { - "name": "Marine", - "isCustom": false, - "cells": 354 + + "civilizations": { + "states": { + "0": {}, + "1": {} }, - "1": {} + + "cultures": {}, + + "religions": {} }, - "states": { - "0": {}, - "1": {} + + "settlements": { + "burgs": {}, + "routes": {} }, - "cultures": {}, - "notes": { - "0": {} - }, - "rulers": { - "0": { - "i": 0, - "type": "ruler", - "points": [ - [ - 0, - 0 - ], - [ - 642, - 17 + + "annotations": { + "notes": { + "0": {} + }, + + "rulers": { + "0": { + "i": 0, + "type": "ruler", + "points": [ + [0, 0], + [642, 17] ] - ] + } } } }