Skip to content
jlicht edited this page May 21, 2013 · 1 revision

Tiled

Tiled is a general purpose tile map editor. It can be used for creating, converting or editing existing tile-map representations.

File format

Jest uses a constrained version of the standard JSON-format as provided through the export functionality of Tiled.

A valid Jest level should have at least the following entries:

  • height (int)
  • width (int)
  • layers (layers[])
  • tileheight (int)
  • tilewidth (int)
  • tilesets (tileset[])
  • version (int)

A simple example of a valid Jest level can be seen here:

{ "height":3,
 "width":3,
 "layers": ... snip ...,
 "orientation":"orthogonal",
 "tileheight":32,
 "tilesets": ... snip ...,
 "tilewidth":32,
 "version":1
}

The next sections elaborates on the requirements Jest places on tilesets and layers

Tilesets

A tileset in Jest is usually embedded in the "tilesets" section of a level. The JSON entry for a tileset has at least the following properties:

  • name (string)
  • image (string) [path to tileset image]
  • imagewidth (int)
  • imageheight (int)
  • tileheight (int)
  • tileheight (int)
  • properties (dictionary)

A correct, simple tileset could look somewhat like this:

        {
         "image":"Jester/jest/resources/mapdata-tileset.png",
         "imageheight":128,
         "imagewidth":128,
         "name":"mapdata",
         "properties":
            {
             "0":"path-NE"
             "1":"path-NS"
             "2":"path-NW"
             "3":"path-EN"
             "4":"path-ES"
             "5":"path-EW"
             "6":"path-SN"
             "7":"path-SE"
             "8":"path-SW"
             "9":"path-WN"
             "10":"path-WE"
             "11":"path-WS"
             "12":"color-red"
             "13":"color-green"
             "14":"color-blue"
             "15":"color-white"
             "16":"color-black"
            },
         "tileheight":32,
         "tilewidth":32
        },

Incidentally, at least one tileset has to exist that embeds the mappings present in the example above; the name of this tileset needs to be "mapdata".

Layers

A layer in Jest w.r.t. the Brick tiling engine should at least have the following properties:

  • name (string)
  • width (int)
  • height (int)
  • visible (bool)
  • data (int[])
  • type (string) [should be equal to "tilelayer"]

All layers are sequentially ordered from lowest to highest in the "layers" entry of the tiled JSON data structure.

    {
     "data":[4, 4, 0, 4, 2, 0, 0, 0, 0],
     "height":3,
     "name":"background",
     "opacity":1,
     "type":"tilelayer",
     "visible":true,
     "width":3,
     "x":0,
     "y":0
    },
    {
     "data":[1, 1, 0, 0, 1, 0, 0, 0, 0],
     "height":3,
     "name":"roads",
     "opacity":1,
     "type":"tilelayer",
     "visible":true,
     "width":3,
     "x":0,
     "y":0
    },
    {
     "data":[0, 3, 0, 0, 0, 0, 0, 0, 0],
     "height":3,
     "name":"buildings",
     "opacity":1,
     "type":"tilelayer",
     "visible":true,
     "width":3,
     "x":0,
     "y":0
    }]