I've pasted an example of the exported map file format; the format is also specified in the manual (for readability I've run the JSON through a prettifier, Tilekit exports it to a compact format):
{ "map": { "tile_w": 8, "tile_h": 8, "tile_spacing": 0, "image_filename": "../platformer.png", "animations": [ { "idx": 51, "rate": 126, "frames": [ 51, 59, 60 ] }, { "idx": 6, "rate": 203, "frames": [ 6, 22, 41 ] } ], "tags": [ { "label": "testtag", "tiles": [ 1, 5, 6, 22 ] }, { "label": "testtag2", "tiles": [ 25, 17 ] } ], "w": 16, "h": 16, "data": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 44, 44, 9, 10, 61, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 56, 0, 0, 31, 9, 10, 10, 0, 0, 0, 0, 0, 0, 0, 43, 31, 38, 33, 0, 31, 0, 0, 0, 34, 33, 0, 0, 0, 0, 3, 44, 0, 2, 2, 11, 31, 0, 0, 11, 44, 2, 4, 0, 0, 3, 44, 54, 0, 0, 56, 0, 0, 0, 0, 0, 46, 47, 0, 0, 0, 28, 31, 25, 46, 47, 36, 0, 0, 0, 0, 8, 46, 56, 0, 0, 3, 44, 47, 25, 46, 0, 2, 15, 15, 15, 15, 15, 31, 19, 0, 0, 0, 53, 0, 55, 0, 0, 47, 24, 24, 0, 23, 55, 47, 34, 43, 0, 0, 37, 53, 54, 0, 0, 0, 55, 55, 55, 55, 56, 37, 44, 44, 0, 0, 0, 26, 37, 53, 54, 54, 54, 0, 54, 56, 19, 0, 46, 47, 0, 0, 0, 27, 0, 26, 0, 0, 0, 31, 38, 0, 0, 0, 46, 56, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 10, 10, 10, 11, 31, 38 ] }, "objects": [ { "name": "Player", "id": "$1", "x": "40", "y": "24", "w": "8", "h": "8", "color": "#493cdb" }, { "name": "Chest", "id": "$2", "x": "104", "y": "48", "w": "8", "h": "8", "color": "#ff7f00" } ] }
Exporting the ruleset to a lua module (such that you would define your rules in Tilekit and have your game do the auto tiling itself) looks as follows:
local function random(n) return math.random(n) - 1 end local function chance(n, x, y) return random(100, x, y) < n end local function get_tile(m, x, y) if x < 0 or x >= m.w or y < 0 or y >= m.h then return 0 end return m.data[x + y * m.w + 1] end local function process_tile(m, x, y) if get_tile(m, x + 0, y + 0) == 0 and get_tile(m, x + 0, y + 1) == 0 and get_tile(m, x + 0, y + 2) == 1 and get_tile(m, x + 1, y + 0) == 0 and get_tile(m, x + -1, y + 0) == 0 and chance(3, x, y) then return 51 end if get_tile(m, x + 0, y + 0) == 0 and get_tile(m, x + 0, y + 1) == 1 and chance(2, x, y) then return 73 end if get_tile(m, x + 0, y + 0) == 0 and get_tile(m, x + 0, y + 1) == 1 and chance(4, x, y) then return 43 end if get_tile(m, x + 0, y + -1) == 19 and get_tile(m, x + 0, y + 0) == 5 then return 48 end if get_tile(m, x + 0, y + 0) == 19 and get_tile(m, x + 0, y + 1) ~= 19 then return 6 end if get_tile(m, x + 0, y + 0) == 19 then return 5 end if get_tile(m, x + 0, y + 0) == 0 and get_tile(m, x + 1, y + 0) == 1 and get_tile(m, x + 0, y + 1) == 5 and chance(47, x, y) then return 8 end if get_tile(m, x + 0, y + 0) == 0 and get_tile(m, x + -1, y + 0) == 1 and get_tile(m, x + 0, y + 1) == 5 and chance(77, x, y) then return 7 end if get_tile(m, x + 0, y + 0) == 5 and get_tile(m, x + 0, y + -1) == 0 then return 15 end if get_tile(m, x + 0, y + 0) == 5 and get_tile(m, x + 0, y + 1) == 1 and chance(87, x, y) then local n = random(3, x, y) if n == 0 then return 23 end if n == 1 then return 16 end if n == 2 then return 24 end end if get_tile(m, x + 0, y + 0) == 5 and chance(22, x, y) then local n = random(2, x, y) if n == 0 then return 32 end if n == 1 then return 24 end end return 0 end return function(src) local res = { w = src.w, h = src.h, data = {} } for y = 0, src.h - 1 do for x = 0, src.w - 1 do res.data[x + y * src.w + 1] = process_tile(src, x, y) end end return res end