diff --git a/Map-File-Format.md b/Map-File-Format.md index 49c5b9f..2a26331 100644 --- a/Map-File-Format.md +++ b/Map-File-Format.md @@ -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> data[xCount][yCount] + +Layer: + int xCount, yCount + vector> data[xCount][yCount] + +MapUtility: + int layerCount + list data[layerCount] + list 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 +```