From 7d291de91639ccf0f0a1db76a7e257681be3b087 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 28 Jun 2013 21:38:51 +1000 Subject: [PATCH] Finished versions one and two of the format specifications --- Map-File-Format.md | 88 +++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 60 deletions(-) diff --git a/Map-File-Format.md b/Map-File-Format.md index 06cab42..7cbf04a 100644 --- a/Map-File-Format.md +++ b/Map-File-Format.md @@ -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 (Under Construction) +## Version One 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. 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 - -MapUtility - - - - -#### File Format +#### File Format Specification The map files are layed out like this: @@ -22,12 +14,12 @@ The map files are layed out like this: [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: -* layers * width 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 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. -The tiles are zero indexed, with -1 meaning transparent. -Each layer has it's own tileset. - -#### Containers - -Patch: - int xCount, yCount - vector> data[xCount][yCount] - -Layer: - int xCount, yCount - vector> data[xCount][yCount] - -MapUtility: - int layerCount - list data[layerCount] - list tilesets[layerCount] +This version is designed to be as robust as possible, while still being easy to understand. +Tiles are zero indexed, with -1 meaning transparent. +Each layer has its own tileset, with the file name stored in the map file. +This version is stored mostly in binary format. #### File Format The files are layed out like this: ``` - [format metadata] - [tileset list] - [data blob] +[metadata] +[tilesets] +[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 layed out like this: +The metadata is a single line of non-negative integers. +The metadata contains: -``` -tileWidth tileHeight //the width and height of each tile in pixels -patchWidth patchHeight //the width and height of each patch in tiles -patchXCount patchYCount //the number of patches in -layerCount // -totalXCount // -totalYCount // -totalCount // -``` +* Tile width +* Tile height +* width of the map (in tiles) +* height of the map (in tiles) +* the number of layers -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 -``` -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 +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.