
World files are those were changes to a world by a player are saved when the
world unloads.

All of these files are written un the
[MessagePack](https://github.com/msgpack/msgpack) serialization format and then
compressed. Their extension is '.mpk.gz'

A world is saved at '$XDG_DATA_HOME/voxelgarden/saves/WORLD/'.

## world.mpk.gz

Stores specific data about the whole world that is loaded once when the world
starts, and saved when the world closes.

```
[
  Mob player;
]
```

See below for mob data format.

## flat/X.Z.mpk.gz

Store data relative to the world heightmap for a 16x16 column of cells;
X and Z are the coordinates of any of the columns in the chunk divided by 16
(rounded down).

```
[
  int x = X,
  int y = Y,
  array(256) data = [
    [ int height, int light ]...
  ]
]
```

## cells/X.Y.Z.mpk.gz

Store the full cell map for a chunk of 16x16x16 cells;
X, Y, Z are the coordinates of any of the cells in the chunk divided by 16
(rounded down).

```
[
  array indices = [ string... ],
  array(4096) cells = [ int... ],
  bits(4096) light = [ byte... ],
  map data = { int pos: Cell_data data }
]
```

The dictionary is merely a list of the names of the cell types that appear in
the chunk; the list of cells uses indices from this list to determine the
actual cell type by cross-referencing this list and the internal cell type
database.

## mobs/X.Y.Z.mpk.gz

Store the full mob list for a chunk of 16x16x16 cells;
X, Y, Z are the coordinates of any of the cells in the chunk divided by 16
(rounded down).

```
[ Mob... ]
```

See below for mob data format.

## Mob Format

Each mob is stored as an array with the following values:

```
[
  string id
  array(3) pos = [ float, float, float ]
  array(3) vel = [ float, float, float ]
  array(3) rot = [ float, float, float ]
  array(2) size = [ float, float ]
  array items = [ Item... ]
]
```

## Item Format

Each item contains the following values

```
[
  string id,
  int count
]
```

Unlike cells and mobs, item stacks can have empty id strings, representing an
empty stack of items.

## Cell_data Format

At this point, additional data for cells contains only an optional inventory

```
[
   array items = [ Item... ]
]
```
