Updated Data model (in progress) (markdown)

Azgaar 2026-03-10 01:21:52 +01:00
parent a116299cc4
commit f835ac43ae

@ -5,6 +5,30 @@ Relevant links:
* [Trello ticket](https://trello.com/c/IWltiMC2/902-rework-save-data-format) * [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) * [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: Structure:
`.map` file is a valid JSON capturing all data required to render and operate the map, including UI and style settings. `.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 "revision": 124
} }
}, },
"settings": { "settings": {
"seed": "342342342323", "seed": "342342342323",
"graph": { "graph": {
"width": 1280, "width": 1280,
"heigh": 740, "height": 740,
"points": 50000 "points": 50000
}, },
"heightmap": { "heightmap": {
"template": "Volcano", "template": "Volcano",
"isRandom": false, "isRandom": false,
"isPrecreated": false, "isPrecreated": false,
"isCustom": false "isCustom": false
}, },
"cultures": { "cultures": {
"set": "Oriental", "set": "Oriental",
"limit": 11, "limit": 11,
"sizeVariety": 2, "sizeVariety": 2,
"growthRate": 1.3 "growthRate": 1.3
}, },
"states": { "states": {
"limit": 14, "limit": 14,
"sizeVariety": 2, "sizeVariety": 2,
@ -54,23 +82,29 @@ Structure:
"mode": "auto" "mode": "auto"
} }
}, },
"provinces": { "provinces": {
"ratio": 30 "ratio": 30
}, },
"burgs": { "burgs": {
"limit": null, "limit": null,
"showMfcgMap": true "showMfcgMap": true
}, },
"religions": { "religions": {
"limit": 7 "limit": 7
}, },
"labels": { "labels": {
"autoHide": true, "autoHide": true,
"rescaleOnZoom": true "rescaleOnZoom": true
}, },
"notes": { "notes": {
"pinned": false "pinned": false
}, },
"scaleBar": { "scaleBar": {
"label": "", "label": "",
"position": { "position": {
@ -78,36 +112,32 @@ Structure:
"y": 99 "y": 99
} }
}, },
"military": { "military": {
"units": { "units": {
"0": { "0": { "name": "infantry" }
"name": "infantry"
}
} }
}, },
"world": { "world": {
"name": "Narnia", "name": "Narnia",
"calendar": { "calendar": {
"year": 2024, "year": 2024,
"era": "Test Era", "era": "Test Era",
"eraShort": "TE" "eraShort": "TE"
}, },
"climate": { "climate": {
"temperature": { "temperature": {
"equator": 30, "equator": 30,
"northPole": -30, "northPole": -30,
"southPole": -25 "southPole": -25
}, },
"winds": [ "winds": [225, 45, 225, 315, 135, 315],
225,
45,
225,
315,
135,
315
],
"precipitation": 100 "precipitation": 100
}, },
"geography": { "geography": {
"mapSize": 11, "mapSize": 11,
"latitudeShift": 50, "latitudeShift": 50,
@ -115,23 +145,12 @@ Structure:
"latN": 34 "latN": 34
} }
}, },
"units": { "units": {
"distance": { "distance": { "unit": "m", "scale": 3 },
"unit": "m", "area": { "unit": "square", "scale": 1 },
"scale": 3 "height": { "unit": "ft", "exponent": 2 },
}, "temperature": { "unit": "°C", "scale": 1 },
"area": {
"unit": "square",
"scale": 1
},
"height": {
"unit": "ft",
"exponent": 2
},
"temperature": {
"unit": "°C",
"scale": 1
},
"population": { "population": {
"scale": 1000, "scale": 1000,
"urbanization": { "urbanization": {
@ -141,11 +160,13 @@ Structure:
} }
} }
}, },
"layers": { "layers": {
"heightmap": false, "heightmap": false,
"states": true "states": true
} }
}, },
"style": { "style": {
"scaleBar": { "scaleBar": {
"size": 2, "size": 2,
@ -153,61 +174,74 @@ Structure:
"backColor": "#ffffff" "backColor": "#ffffff"
} }
}, },
"data": { "data": {
"grid": {
"cells": { "topology": {
"i": [], "grid": {
"temp": [] "cells": {
"i": [],
"temp": []
},
"vertices": {
"c": [[]]
}
}, },
"vertices": {
"c": [ "pack": {
[] "cells": {
] "i": [],
"g": [],
"state": [],
"culture": []
},
"vertices": {
"c": [[]]
}
} }
}, },
"pack": {
"cells": { "geography": {
"i": [], "biomes": {
"g": [], "0": {
"state": [], "name": "Marine",
"culture": [] "isCustom": false,
}, "cells": 354
"vertices": { },
"c": [ "1": {}
[]
]
} }
}, },
"biomes": {
"0": { "civilizations": {
"name": "Marine", "states": {
"isCustom": false, "0": {},
"cells": 354 "1": {}
}, },
"1": {}
"cultures": {},
"religions": {}
}, },
"states": {
"0": {}, "settlements": {
"1": {} "burgs": {},
"routes": {}
}, },
"cultures": {},
"notes": { "annotations": {
"0": {} "notes": {
}, "0": {}
"rulers": { },
"0": {
"i": 0, "rulers": {
"type": "ruler", "0": {
"points": [ "i": 0,
[ "type": "ruler",
0, "points": [
0 [0, 0],
], [642, 17]
[
642,
17
] ]
] }
} }
} }
} }