From ab7323d2e1264050e563265e4b43f5a003b15ad8 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Wed, 18 Aug 2021 23:28:54 +0300 Subject: [PATCH] Updated Object Model (markdown) --- Object-Model.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Object-Model.md b/Object-Model.md index 9fc0d70..18fbacf 100644 --- a/Object-Model.md +++ b/Object-Model.md @@ -45,21 +45,21 @@ Both `grid` and `pack` objects include data representing voronoi diagrams and th * * `pack.vertices.v`: `number[][]` - indexes of vertices adjacent to each vertex. Most vertices have 3 neighboring vertices, bordering vertices has only 2, while the third is still added to the data as `-1` ## Features data + +### Grid object * `grid.features`: `object[]` - array containing objects for all enclosed entities of original graph: islands, lakes and oceans. Feature object structure: * * `i`: `number` - feature id starting from `1` * * `land`: `boolean` - `true` if feature is land (height >= `20`) * * `border`: `boolean` - `true` if feature touches map border (used to separate lakes from oceans) * * `type`: `string` - feature type, can be `ocean`, `island` or `lake +### Pack object * `pack.features`: `object[]` - array containing objects for all enclosed entities of repacked graph: islands, lakes and oceans. Note: element 0 has no data. Stored in .map file. Feature object structure: * * `i`: `number` - feature id starting from `1` * * `land`: `boolean` - `true` if feature is land (height >= `20`) * * `border`: `boolean` - `true` if feature touches map border (used to separate lakes from oceans) * * `type`: `string` - feature type, can be `ocean`, `island` or `lake` -* * `group`: `string`: feature subtype. The variants are: -* * * `ocean` - is always `ocean` -* * * `island` - `continent`, `island`, `isle` or `lake_island` -* * * `lake` - `freshwater`, `salt`, `dry`, `sinkhole` or `lava` +* * `group`: `string`: feature subtype, depends on type. Subtype for ocean is `ocean`; for land it is `continent`, `island`, `isle` or `lake_island`; for lake it is `freshwater`, `salt`, `dry`, `sinkhole` or `lava` * * `cells`: `number` - number of cells in feature * * `firstCell`: `number` - index of the first (top left) cell in feature * * `vertices`: `number[]` - indexes of vertices around the feature (perimetric vertices) @@ -68,12 +68,11 @@ Both `grid` and `pack` objects include data representing voronoi diagrams and th World data is mainly stored in typed arrays within `cells` object in both `grid` and `pack`. ### Grid object - -* `grid.cells`: `{}` - cells data object, including world data: -* * `grid.cells.f`: `number[]` - _features_ indexes `Uint16Array` or `Uint32Array` (depending on cells number) -* * `grid.cells.c`: `number[][]` - indexes of cells adjacent to each cell (neighboring cells) -* * `grid.cells.v`: `number[][]` - indexes of vertices of each cell -* * `grid.cells.b`: `number[]` - indicates if cell borders map edge, 1 if `true`, 0 if `false`. Integers, not Boolean +* `grid.cells.h`: `number[]` - cells elevation in `[0, 100]` range, where `20` is the minimal land elevation. `Uint8Array` +* `grid.cells.f`: `number[]` - indexes of feature. `Uint16Array` or `Uint32Array` (depending on cells number) +* `grid.cells.t`: `number[]` - distance field. `1, 2, ...` - land cells, `-1, -2, ...` - water cells, `0` - unmarked cell. `Uint8Array` +* `grid.cells.temp`: `number[]` - cells temperature in Celsius. `Uint8Array` +* `grid.cells.prec`: `number[]` - cells precipitation in unspecified scale. `Uint8Array` ### Pack object ---