Wrote the basic map specification

Kayne Ruse
2013-06-23 21:16:20 +10:00
parent b34c1e0faf
commit 5bc3e1fb26
+53 -1
@@ -1,2 +1,54 @@
TODO: This page is a work in progress, as is the map system of the game. The map data is stored in plain text.
The tiles are zero indexed, with -1 meaning transparent.
Each layer has it's own tileset.
## Containers
Patch:
int xCount, yCount
vector<vector<int>> data[xCount][yCount]
Layer:
int xCount, yCount
vector<vector<Patch>> data[xCount][yCount]
MapUtility:
int layerCount
list<Layer> data[layerCount]
list<Image> tilesets[layerCount]
## File Format
The files are layed out like this:
```
[format metadata]
[tileset list]
[data blob]
```
The format metadata includes the tile format, the number of tiles in a patch, the number of patches in a layer, and the number of layers and tilesets in the map. It also includes totals, which can be used to verify the formats before loading the data blob.
The metadata is layed out like this:
```
tileWidth tileHeight patchXCount patchYCount layerXCount layerYCount layerCount totalXCount totalYCount totalCount;
```
The tileset list is a list of filenames terminated by semicolons.
The data blob is made up of each tile, layed out from the bottom layer to the top, from the top-left most tile, read X first.
That is to say, in a map with 2 layers, 3 tiles along the X axis and 4 along the y, this is what the data blob would look like:
```
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
```