Finished versions one and two of the format specifications

Kayne Ruse
2013-06-28 21:38:51 +10:00
parent 8efa962d04
commit 7d291de916
+28 -60
@@ -1,19 +1,11 @@
I'm overthinking this too much. This is why I like coding more than documentation. Check back after the editor is finished. ## Version One
## Version One (Under Construction)
This version is designed to be as simple as possible, while still providing a solid feature set. This version is designed to be as simple as possible, while still providing a solid feature set.
Tiles are zero indexed, with -1 meaning transparent. Tiles are zero indexed, with -1 meaning transparent.
All tiles share the same tileset, which is loaded separately and not referenced in the map file. All tiles share the same tileset, which is loaded separately and not referenced in the map file.
This version is stored in plain text format.
#### Modules #### File Format Specification
MapUtility
-
#### File Format
The map files are layed out like this: The map files are layed out like this:
@@ -22,12 +14,12 @@ The map files are layed out like this:
[data blob] [data blob]
``` ```
The metadata is a single line of non-negative, comma delimited integers ending in a semicolon. The metadata is a single line of non-negative, space delimited integers.
The metadata contains: The metadata contains:
* layers
* width of the map (in tiles) * width of the map (in tiles)
* height of the map (in tiles) * height of the map (in tiles)
* the number of layers
The data blob contains the actual tile data. These are plain text integers delimited by whitespace. The data blob contains the actual tile data. These are plain text integers delimited by whitespace.
The data is read in this order: The data is read in this order:
@@ -38,65 +30,41 @@ The data is read in this order:
------------------------- -------------------------
## Version Two (Under Construction) ## Version Two
The map data is stored in plain text. This version is designed to be as robust as possible, while still being easy to understand.
The tiles are zero indexed, with -1 meaning transparent. Tiles are zero indexed, with -1 meaning transparent.
Each layer has it's own tileset. Each layer has its own tileset, with the file name stored in the map file.
This version is stored mostly in binary format.
#### 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 #### File Format
The files are layed out like this: The files are layed out like this:
``` ```
[format metadata] [metadata]
[tileset list] [tilesets]
[data blob] [data blob]
``` ```
The format metadata includes the tile size, the number of tiles in a patch, etc. as detailed below. It also includes totals, which can be used to verify the formats before loading the data blob. The metadata is a single line of non-negative integers.
The metadata is layed out like this: The metadata contains:
``` * Tile width
tileWidth tileHeight //the width and height of each tile in pixels * Tile height
patchWidth patchHeight //the width and height of each patch in tiles * width of the map (in tiles)
patchXCount patchYCount //the number of patches in * height of the map (in tiles)
layerCount // * the number of layers
totalXCount //
totalYCount //
totalCount //
```
The tilesets are a list of filenames terminated by semicolons. The tilesets are a list of plain text 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. The data blob contains the actual tile data. These are binary integers.
The data is read in this order:
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: * bottom layer
* left most column of the layer
* top most tile of a column
``` ## Version Three
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
```
Version three is identical to version two, except that the tilesets are stored in the map file instead of their names. This however, is not yet a priority.