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.
EGAGRAPH.xxx, EGAHEAD.xxx and EGADCT.xxx
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:
|Number of 8x8 background tiles
|Number of 8x8 foreground tiles
|Number of 16x16 background tiles
|Number of 16x16 foreground tiles
|Number of 32x32 background tiles
|Number of 32x32 foreground tiles
|8x8 back tile start
|8x8 fore tile start
|16x16 back start
|16x16 fore start
|32x32 back start
|32x32 fore start
|Number of pictures
|Number of masked pictures
|Number of sprites
|Mask picture start
|Number of extra EGA resources
|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:
|Bit field for level planes (+1 unmasked, +2 masked, +4 infoplane)
|Type of tile (8x8 = 1, 16x16 = 2, 32x32 = 3)
|Number of unmasked tileinfo (TILEINFO) planes in file. Most games 2, speed and offset. Max 10
|Number of unmasked tiles
|Pointers to tileinfo planes in MAPTHEAD file
|Size of TILFINFO planes data.
|TILEINFO plane names
|Number of masked tileinfo (TILEINFOM) planes in file. Usually 7. Max 10
|Number of masked tiles
|Pointers to TILEINFOM planes in file
|Size of TILFINFOM planes data.
|TILFINFOM plane names
|RLEW flag, default $ABCD
|Pointers to level headers in MAPTEMP. 100 pointers, null values are -1 ($FFFFFFFF)
|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
|Number of ICON rows TED5 sets aside from masked tiles to display icons. For most games this is 5
|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:
|Level TED opens in (last edited)
|Screen view, close (1) or distant (2)
|Number of tile planes in levels (usually 2, fore and back)
|Planes editable/visible in TED; +1 view icon, +2 view fore, +4 view back, +16 edit icon, +32 edit fore, +64 edit back
|h loc in level
|v loc in level
|Import map path
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.
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.
- 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
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.