Commander Keen 1-3 Level format

From ModdingWiki
Jump to: navigation, search

The Commander Keen 1-3 level format was widely used in early ID Software games, usually stored in the files LEVELxx.* (Usually with 8 or 16 levels.) The level files are usually compressed with RLEW compression, though earlier games omit this. The compressed level consists of a dword giving the size of the decompressed level in bytes (Always divisible by four.) and the compressed data.

The file is composed of three sections, the header, and the tile and sprite planes.


Header

Most of the header is (Or was.) used by TED v1.5 to load the level and its associated graphics and is not used by games per se. These can be left blank and nobody will care, since the original TED is long gone.

The plane size is interesting, since it has to be divisible by 16 because of how some game engines work. It is how many tiles are in each plane.

0   4    Data size   Size of the DECOMPRESSED level in bytes (May be absent.)
4   2    Lev height  Height of the level in tiles
6   2    Level width Width of level in tiles
8   2    Numplanes   Number of planes in level (2)
10  4    Blank       Blank
14  4    Ted var     2 TED 1.5 varaibles (Ignored)
18  2    Planesize   Level planesize; = 2(h * w) rounded to the next highest multiple of 16


Sprite and tile planes

These are identical on format and composed of words,(Hence the RLEW compression.) one for each 'tile' with the level being read in the 'normal' way. (Left to right, top to bottom.) Each plane is TWICE the planesize (A word is two bytes.) and padded with nulls. Tiles are first, then sprites


Notes

This format has been reverse engineered several times, always by the Commander Keen 1-3 modding community.

Games that use this format are Commander Keen 1-3, Dangerous Dave in Copyright Infringement, Dangerous Dave 2, Shadow Knights, and Slordax.

Dangerous Dave in Copyright Infringement appears to be the first game to use this format and has it uncompressed.

Personal tools
programming