From 9daf3de91818d1f15c04baa6f38f658645923418 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Fri, 27 Aug 2021 20:32:07 +0300 Subject: [PATCH] Updated Data model (markdown) --- Data-model.md | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/Data-model.md b/Data-model.md index f20eea8..7517704 100644 --- a/Data-model.md +++ b/Data-model.md @@ -17,7 +17,7 @@ Both `grid` and `pack` objects include data representing voronoi diagrams and th * `grid.cellsY`: `number` - number of cells in column * `grid.cellsX`: `number` - number of cells in row * `grid.points`: `number[][]` - initial coordinates `[x, y]` based on jittered square grid. Numbers rounded to 2 decimals -* `grid.boundary`: `number[][]` - coordinates of out-of-canvas points used to cut the diagram approximately by canvas edges. Integers +* `grid.boundary`: `number[][]` - off-canvas points coordinates used to cut the diagram approximately by canvas edges. Integers * `grid.cells`: `{}` - cells data object, including voronoi data: * * `grid.cells.i`: `number[]` - cell indexes `Uint16Array` or `Uint32Array` (depending on cells number) * * `grid.cells.c`: `number[][]` - indexes of cells adjacent to each cell (neighboring cells) @@ -100,7 +100,7 @@ World data is mainly stored in typed arrays within `cells` object in both `grid` Secondary data available as a part of the `pack` object. ## Cultures -Cultures (races, language zones) data is stored as an array of objects with strict element order. Element 0 is reserved by the _wildlands_ culture. If culture is removed, the element in not getting removed, but instead a `removed` attribute is added. Object structure: +Cultures (races, language zones) data is stored as an array of objects with strict element order. Element 0 is reserved by the _wildlands_ culture. If culture is removed, the element is not getting removed, but instead a `removed` attribute is added. Object structure: * `i`: `number` - culture id, always equal to the array index * `base`: `number` - _nameBase_ id, name base is used for names generation * `name`: `string` - culture name @@ -118,7 +118,7 @@ Cultures (races, language zones) data is stored as an array of objects with stri * `removed`: `boolean` - `true` if culture is removed ## Burgs -Burgs (settlements) data is stored as an array of objects with strict element order. Element 0 is an empty object. If burg is removed, the element in not getting removed, but instead a `removed` attribute is added. Object structure: +Burgs (settlements) data is stored as an array of objects with strict element order. Element 0 is an empty object. If burg is removed, the element is not getting removed, but instead a `removed` attribute is added. Object structure: * `i`: `number` - burg id, always equal to the array index * `name`: `string` - burg name * `cell`: `number` - burg cell id. One cell can have only one burg @@ -141,7 +141,7 @@ Burgs (settlements) data is stored as an array of objects with strict element or * `removed`: `boolean` - `true` if burg is removed ## States -States (countries) data is stored as an array of objects with strict element order. Element 0 is reserved for `neutrals`. If state is removed, the element in not getting removed, but instead a `removed` attribute is added. Object structure: +States (countries) data is stored as an array of objects with strict element order. Element 0 is reserved for `neutrals`. If state is removed, the element is not getting removed, but instead a `removed` attribute is added. Object structure: * `i`: `number` - state id, always equal to the array index * `name`: `string` - short (proper) form of the state name * `form`: `string` - state form type. Available types are `Monarchy`, `Republic`, `Theocracy`, `Union`, and `Anarchy` @@ -168,7 +168,7 @@ States (countries) data is stored as an array of objects with strict element ord * `removed`: `boolean` - `true` if state is removed ## Provinces -Provinces data is stored as an array of objects with strict element order. Element 0 is not used. If province is removed, the element in not getting removed, but instead a `removed` attribute is added. Object structure: +Provinces data is stored as an array of objects with strict element order. Element 0 is not used. If province is removed, the element is not getting removed, but instead a `removed` attribute is added. Object structure: * `i`: `number` - province id, always equal to the array index * `name`: `string` - short (proper) form of the province name * `formName`: `string` - string form name, used to get province `fullName` @@ -186,7 +186,7 @@ Provinces data is stored as an array of objects with strict element order. Eleme * `removed`: `boolean` - `true` if province is removed ## Religions -Religions data is stored as an array of objects with strict element order. Element 0 is reserved for "No religion". If province is removed, the element in not getting removed, but instead a `removed` attribute is added. Object structure: +Religions data is stored as an array of objects with strict element order. Element 0 is reserved for "No religion". If province is removed, the element is not getting removed, but instead a `removed` attribute is added. Object structure: * `i`: `number` - religion id, always equal to the array index * `name`: `string` - religion name * `type`: `string` - religion type. Available types are `Folk`, `Organized`, `Heresy` and `Cult` @@ -207,10 +207,29 @@ Religions data is stored as an array of objects with strict element order. Eleme * `removed`: `boolean` - `true` if religion is removed ## Rivers +Rivers data is stored as an unordered array of objects (so element id is _not_ the array index). Object structure: +* `i`: `number` - river id +* `name`: `string` - river name +* `type`: `string` - river type, used to get river full name only +* `source`: `number` - id of cell at river source +* `mouth`: `number` - id of cell at river mouth +* `parent`: `number` - parent river id. If river doesn't have a parent, the value is self id or `0` +* `basin`: `number` - river basin id. Basin id is a river system main stem id. If river doesn't have a parent, the value is self id +* `cells`: `number[]` - if of river points cells. Cells may not be unique. Cell value `-1` means the river flows off-canvas +* `points`: `number[][]` - river points coordinates. Auto-generated rivers don't have points stored and rely on `cells` for rendering +* `discharge`: `number` - river flux in m3/s +* `length`: `number` - river length in km +* `width`: `number` - river mouth width in km +* `sourceWidth`: `number` - additional width added to river source on rendering. Used to make lake outlets start with some width depending on flux. Can be also used to manually create channels + ## Routes +Routes data is not in data model, but can be retrieved directly from svg `routes` element and `pack.cells.roads` array. # Secondary global data -Secondary data exposed to global. +Secondary data exposed to global space. + ## Biomes + ## Notes -## nameBases \ No newline at end of file + +## Name bases