TED5

From ModdingWiki

Jump to: navigation, search
Edge of map!
Editing a Keen 4 level with TED5

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.

Contents

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.

Gamemaps

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 InstantCarma (See below)

GFXINFOE.xxx

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:

OffsetTypeDescription
0UINT16LENumber of 8x8 background tiles
2UINT16LENumber of 8x8 foreground tile
4UINT16LENumber of 16x16 background tiles
6UINT16LENumber of 16x16 foreground tiles
8UINT16LENumber of 32x32 background tiles
10UINT16LENumber of 32x32 foreground tiles
12UINT16LE8x8 back tile start
14UINT16LE8x8 fore tile start
16UINT16LE16x16 back start
18UINT16LE16x16 fore start
20UINT16LE32x32 back start
22UINT16LE32x32 back start
26char[20]??? Usually blank, probably has some function

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:

OffsetTypeDescription
0UINT16LEUnknown, 7
2UINT16LENumber of level planes - 1 Max value is 2 (Back, fore, info)
4UINT16LENumber of tileinfo (TILEINFO) planes in file. Most games 2, back and fore. Max 10
6UINT16LEUnknown, relates to TILEINFO planes, 1440
8UINT32LEPointers to tileinfo planes in MAPTHEAD file
48UINT16LESize of TILFINFO planes data.
68char[8]TILFINFO plane names
148UINT16LENumber of main tileinfo (TILEINFOM) planes in file. Usually 8. Max 10
150UINT16LEUnknown, relates to TILEINFOM planes, 1206
152UINT16LEPointers to TILEINFOM planes in file
192UINT16LESize of TILFINFOM planes data.
212char[8]TILFINFOM plane names
292UINT16LERLEW flag, default $ABCD
294UINT32LEPointers to level headers in MAPTEMP. 100 pointers, null values are -1
694UINT32LELevel 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
1094UINT16LENumber of ICON rows TED5 sets aside from masked tiles to display icons. For most games this is 5
1096char[x]Optional TILEINFOM and TILEINFO data


Tedinfo

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:

OffsetTypeDescription
0UINT16LELevel TED opens in (last edited)
2UINT16LEScreen view, close (1) or distant (2)
...
8UINT16LENumber of tile planes in levels (usually 2, fore and back)
...
35BYTEPlanes editable/visible in TED; +1 view icon, +2 view fore, +4 view back, +16 edit icon, +32 edit fore, +64 edit back
36UINT16LEh loc in level
38UINT16LEv loc in level
...
119char[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 3D, 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 Instantcarma 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
  • Instantcarma: A Keen Community program by Ceilick. It automates 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

This is a list of games that have been successfully edited with TED5: (though many of them have dedicated editors that are more user friendly)

Download

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.

Personal tools
programming