The Teeworlds map format

In this section you will learn how a teeworlds map is structured. This knowledge is not needed for using the library, but it can be helpfull if you are interested in understanding what is going on behind the scenes or just want to hack a map yourself.


After the header the types are stored. For each item type there is a list containing the type, the number of items for this type and which itme is the first for this type.

Item offsets

Right after the types the item offsets are stored. The first offset is 0. The offset to the next item will be the size of the previous item. The size of each item is as big as defined in mapitems.h (see teeworlds source) plus 2 more integers containing the type, id and the item size. Type and id is within the first integer. There is always one “envpoint” item with a dynamic size. It consists of the 2 integers and type size multiplicated with the number of envpoints.

Uncompressed data sizes

The uncompressed data sizes are stored after the item offsets. The sizes are used to allocate the memory for each data in teeworlds.


Finally the items are stored. Every item will be stored with all its data in this order:

  1. version
  2. images
  3. envelops
  4. groups
  5. layers
  6. envpoints

Compressed data

Eventually the compressed data is stored. Image- and tilelayers have an index which tells the position of the corresponding data. The compressed data part stores image names, tiles, quads and embedded images.

Table Of Contents

Previous topic


This Page