From ModdingWiki
Jump to navigation Jump to search

Tile Editor v5.0 (TED5) is a level editor written by id Software that has been used to create the levels for many of their games. It edits the GameMaps Format seen in many older id Software games and is also apparently able to edit the Commander Keen 1-3 Level format, though how is not known.

Files used by TED5

TED5 is compatible with any ID game that has a GAMEMAPS.xxx file. However the actual GAMEMAPS.xxx file is the final product, many other supporting files are required for TED5 to function.

If the game is 'compressed', it will not have most of these files. Commander Keen 4-6 is one such game. In contrast 'uncompressed' games such as Bio Menace will have the full complement of files. Sadly, most games are compressed, as this is most efficient.


These are explained fully under EGAGraph Format; they are respectively the game graphics, the graphics header and the Huffman Compression dictionary for decompressing graphics. Compressed games will just have the EGAGRAPH; with the HEAD and DCT files stored internally in the executable. Uncompressed games will have an external EGAHEAD and no need for an EGADCT file.

Like all Huffman dictionaries, the EGADCT file can be located in the executable by looking for the string $FD $01 $00 $00 $00 $00 which is found at the file's end. (The file will be 1024 bytes long.) The EGAHEAD file can be located by looking for a 4 (Or 3) byte string which is the EGAGRAPH file size, this is always the last entry. (If you then proceed to move backwards until you reach a zero value entry, you will have the start of the file.)

You will receive an error if these files are absent. If the DCT is missing then TED5 will assume graphics are uncompressed.


The GAMEMAPS file is not used, but is produced by TED5. It contains the compressed game maps and is produced from the MAPTEMP file when the user selects 'Carmackize maps' in TED5. Carmackization is complex and takes a long time to do. Because of this it is recommended that modders use Instant Carma! (See below)


This is a 46 byte file that contains data allowing TED5 to extract the graphics used in levels.It consists of a number of numbers and locations of various tile types.

Levels can be made of 8x8, 16x16 or 32x32 tiles (Always 16 color EGA.) Levels have a foreground plane, and may also have a background and info (Sprite) plane.The structure of the GFXINFOE file is as follows:

Offset Type Description
0 UINT16LE Number of 8x8 background tiles
2 UINT16LE Number of 8x8 foreground tiles
4 UINT16LE Number of 16x16 background tiles
6 UINT16LE Number of 16x16 foreground tiles
8 UINT16LE Number of 32x32 background tiles
10 UINT16LE Number of 32x32 foreground tiles
12 UINT16LE 8x8 back tile start
14 UINT16LE 8x8 fore tile start
16 UINT16LE 16x16 back start
18 UINT16LE 16x16 fore start
20 UINT16LE 32x32 back start
22 UINT16LE 32x32 fore start
24 UINT16LE Number of pictures
26 UINT16LE Number of masked pictures
28 UINT16LE Number of sprites
30 UINT16LE Picture start
32 UINT16LE Mask picture start
34 UINT16LE Sprite start
36 UINT16LE "offpicstr"
38 UINT16LE "offpicmstr"
40 UINT16LE "offstrstr"
42 UINT16LE Number of extra EGA resources
44 UINT16LE Extra EGA resource start

The location (Start) given for tiles is the entry in the EGAHEAD.xxx file, most EGAHEAD.xxx files consist of 3 byte entries so the actual location, in bytes, in the file is three times this, though older games (Such as Commander Keen Dreams) have 4 byte entries. (It is not known if or how TED5 tells the difference between these.) Each tile has its own entry in the header.

The icons used by TED5 (For sprites, etc) are calculated as follows; icons follow directly after background tiles, then foreground tiles. There will thus be some 'extra' slots between the back and fore tiles. These are used as the number of icons.

This file is found with uncompressed games, but has to be created for compressed games. It is not currently known if it can be extracted somehow from the executable or if it is hard coded for each game.

Maptemp and Mapthead

The MAPTEMP file contains the uncarmackized level maps. Carmackization is a form of compression related to Keen 1-3 LZW compression in that it employs a sliding window. MAPTEMP is however RLE Compression compressed to avoid excess size. This is easy for TED5 to edit though. This file is changed each time levels are saved in TED5 and is not used by the game. To make usable levels you must select the item 'Carmackize maps' in the file menu, which will produce the GAMEMAPS file.

MAPTHEAD is the header for the MAPTEMP file. When maps are carmackized it is used to create the MAPHEAD file. MAPTHEAD contains several variables used by TED5 and some older games. Notably it has information for IDs tileinfo program to work with. Its structure is as follows:

Offset Type Description
0 UINT16LE Bit field for level planes (+1 unmasked, +2 masked, +4 infoplane)
2 UINT16LE Type of tile (8x8 = 1, 16x16 = 2, 32x32 = 3)
4 UINT16LE Number of unmasked tileinfo (TILEINFO) planes in file. Most games 2, speed and offset. Max 10
6 UINT16LE Number of unmasked tiles
8 UINT32LE[10] Pointers to tileinfo planes in MAPTHEAD file
48 UINT16LE[10] Size of TILFINFO planes data.
68 char[10][8] TILEINFO plane names
148 UINT16LE Number of masked tileinfo (TILEINFOM) planes in file. Usually 7. Max 10
150 UINT16LE Number of masked tiles
152 UINT16LE[10] Pointers to TILEINFOM planes in file
192 UINT16LE[10] Size of TILFINFOM planes data.
212 char[10][8] TILFINFOM plane names
292 UINT16LE RLEW flag, default $ABCD
294 UINT32LE[100] Pointers to level headers in MAPTEMP. 100 pointers, null values are -1 ($FFFFFFFF)
694 UINT32LE[100] Level header sizes MAPTEMP. Older games Huffman Compressed headers and used this. Older games have $26 here, the (uncompressed) header size and don't use it
1094 UINT16LE Number of ICON rows TED5 sets aside from masked tiles to display icons. For most games this is 5
1096 char[x] Optional TILEINFOM and TILEINFO data


This file is used by TED5 to store various details of the level format. Important here is the number of planes in each level, and the number of icons. Icons (used for sprites) are taken from the foreground tiles. The known values are:

Offset Type Description
0 UINT16LE Level TED opens in (last edited)
2 UINT16LE Screen view, close (1) or distant (2)
8 UINT16LE Number of tile planes in levels (usually 2, fore and back)
35 BYTE Planes editable/visible in TED; +1 view icon, +2 view fore, +4 view back, +16 edit icon, +32 edit fore, +64 edit back
36 UINT16LE h loc in level
38 UINT16LE v loc in level
119 char[64] Import map path

Backup files

TED5 backs up all its files when levels are saved or carmackized or TED5 is exited. The old files are saved as *.BAK files and a simple renaming will suffice to undo the latest change. Only one backup is made so it is wise to save these files occasionally.

Setting up TED5

For uncompressed games, such as Bio Menace, all that is required is to copy the file TED5.EXE into the games directory. For compressed games the situation is slightly more complex.

Some games, such as Commander Keen 4-6 have a Ted setup utility to either extract or create the necessary files. If this is the case then a two step process is required. The first involves copying TED5 and the setup utility and running the setup to obtain the required files. The second step involves using a patching utility (Such as CKPatch) to patch the modified files back into the executable.

Finally, some games, such as Catacomb 3-D, have no utilities at present. While it is not impossible to modify the levels in these games, it takes a bit more work, since the required files must be extracted manually and the executables illegally modified. It has already been mentioned how the graphics files can be located in an executable, but other files will need to be hard coded until somebody automates the procedure.

Modifying levels

If TED5 is setup correctly then it should run (Dosbox may be required for this.) and go to the first level in the game, usually a world map. There are a number of commands and actions that can be used, which will not be covered here. After the desired changes have been made the user must select 'Carmackize maps' from the file menu to produce a modified GAMEMAPS and MAPHEAD file. For compressed games such as Keen this file will then need to be patched into the executable.

A level can be completely replaced with one from another GAMEMAPS file by using the 'Import levels' command under the file menu. (You will need to specify a patch to a valid GAMEMAPS file.) This allows a person to copy levels between backups, etc.

The program Instant Carma! skips Carmack compression by doing the very minimal amount of work. It takes a fraction of the time of TED5 and can be used while TED5 is running and is thus very useful. Sadly it is only available for Commander Keen 4-6.

Other utilities

  • CKPatch: A set of utilities that allow Keen 4-6 executables to be modified temporarily and legally by patching a copy of the executable into memory and modifying that. This is vital for using new levels in Keen 4-6 There are several versions available, with the latest having the most features. http://www.bipship.com/CKPatch
  • Fixmhead: This converts the MAPTHEAD file to MAPHEAD. It is not really required for anything, but is included with a lot of TED5 packs.
  • Galaxymk: This pack contains everything needed to set Commander Keen 4-6 games up for editing with TED5, including the setups and patchers. http://keenmodding.org/search.php?search_author=The_Fosti&sid=92cde18022face91063ec52109b6c2ec
  • Instant Carma!: by CK Guy externalizes the carmackization of Keen 4-6 maps, saving time and improving efficiency. http://www.keenmodding.org/viewtopic.php?t=997
  • Tedsetup: A program that sets up certain games to be editable by TED5, automatically extracting or creating required files, Often comes with TED5

Supported Games

See the infobox above for a list of games that have been successfully edited with TED5, although many of those games have dedicated editors that are more user friendly.


TED5 has been released as open source freeware. TED5 and its source code can be downloaded from 3D Realms. It can be used to edit the levels of Bio Menace and to create new levels for Rise of the Triad. It is also possible to edit the levels of Commander Keen 4-6, but this is a bit harder to set up.

Older versions can be found in Dangerous Dave in Copyright Infringement, in the Rise of the Triad September 1993 prototype and in the source code of the SNES version of Super 3-D Noah's Ark.