Notes and Conventions
This section is an overview of concepts and conventions used throughout the IESDP and serves as a continuation of the Infinity Engine File Format Hacking Project.

All versions of the Infinity Engine, except that used in Planescape: Torment, make some internal of the Lua programming language, as developed by TeCGraf at the Pontifical Catholic University of Rio de Janeiro in Brazil. In the Infinity Engine, LUA is primarily used for the cheats/debugging console. The debug console actually allows complete LUA programs to be entered and run, though these programs can only have a very limited affect on the game and the engine. The LUA documentation is available online, though knowledge of LUA is of limited use in IE modding. It should be mentionned, that unlike other engines where LUA is used, the Infinity Engine AI scripts have nothing to do with LUA.

The data types used to describe the file formats used by the Infinity Engine are:

Data type Description
char array An array of ASCII characters of a fixed length
ASCIIZ string An array of ASCII characters terminated by a NUL character (ASCII 00). Note that the full length of the array need not be used, and may in fact contain garbage data, so long as a NUL character is found earlier in the array to mark the end of valid data.
word A little-endian "word" of 16-bits
dword A little-endian "double-word" of 32-bits
point A point within some reference frame, composed of two 16-bit words; the first is the x-coordinate and the second is the y-coordinate.
rect A rectangle within some reference frame, composed of 4 16-bit words; the order of the coordinates is: left, top, right, bottom. Typically this is used to store bounding boxes of various objects.
strref A reference into the 'TLK' resource. Stored as a 32-bit number (though the top 8 bits refer to an internal file Id, e.g. 0x01 refers to dialogf.tlk) which can be mapped to a string via a lookup into the TLK table.
resref A reference to a specific resource -- a string (max 8 characters) which is mapped to a resource (stored in a BIF file or an override directory) via the KEY file. Note that these are always treated as 8 characters long; unused characters should generally be filled with NUL bytes.

When bits are numbered, they will be numbered with the least-significant bit as 0, and the most significant bit as 7, 15, or 31, for byte, word, or dword, respectively.

Several file types are used in the Infinity Engine. These file types can be identified in three different ways. First, most file formats have a numerical code (e.g. 0x03e8), called the resType. Second, all file formats have a file extension (e.g. 2da), which is used to determine what format the data inside is expected to be. Third, most of the file formats contain a 4-byte signature string in the file header to indicate the file type, and a 4-byte version string to indicate the file format version.

ResType Extension Format tag Notes Description
N/A .key 'KEY '   A directory of resources, resource locations and resource types. Each game generally have one KEY file, located in the main game directory.
N/A .bif 'BIFF'   Archive containing resources; indexed by the KEY file.
N/A .cbf 'BIF '   zlib compressed BIF file; index by the KEY file.
N/A .tlk 'TLK '   Table in which strings and sounds are looked up by strref.
N/A .acm ???   Music.
N/A .mus N/A Text format Music playlist.
0x0001 .bmp N/A   Microsoft-endorsed standard for static graphics. Often used for storing palettes, in which case the file will be a 1x1 pixel image with a full palette. Only uncompressed BMP files are supported, though the engine supports colour depths of 4, 8, and 24 bits.
0x0002 .mve ???   Movies. Proprietry Interplay format.
0x0004 .wav


'WAVC'   Sounds. Note that 'WAVC' and 'RIFF' .wav files are used interchangeably throughout the engine; WAVC is an internal format -- more precisely, an ACM file with a header attached to simplify buffer estimation during file decompression.
0x0004 .wav N/A   RIFF wave files. The Microsoft mmio* routines are not used for WAV reading, meaning files must be simple and straightforward.
0x0005 N/A 'WFX '   Wave FX file. WFX files are used to determine variation for playback of wave sounds.
0x0006 .plt 'PLT '   Graphics, specifically paperdolls (as displayed on the inventory screen).
0x03e8 .bam 'BAM '   Graphics, specifically animations though also multi-frame static graphics. The format supports multiple animation cycles, each containing multiple frames.
0x03e8 .bam 'BAMC'   zlib compressed BAM file.
0x03e9 .wed 'WED'   Area region information.
0x03ea .chu 'CHUI'   GUI definition.
0x03eb .tis N/A   Graphics, specifically area art.
0x03ec .mos 'MOS'   Graphics, specifically minimaps and GUI backgrounds.
0x03ec .mos 'MOSC'   zlib compressed MOS file.
0x03ed .itm 'ITM'   Items.
0x03ee .spl 'SPL'   Spells.
0x03ef .bcs N/A Text format Compiled script.
0x03f0 .ids N/A Text format Identifier tables. Generally a mapping from numbers to text, typically giving descriptive names or labels to engine internals.
0x03f1 .cre 'CRE'   Creatures.
0x03f2 .are 'AREA'   Area defintion, including actor, door, region and container details.
0x03f3 .dlg 'DLG'   Dialog definition.
0x03f4 .2da 2DA' Text format. 2-dimensional array. Note that the signature may not occur at the start of the file; there may be leading spaces, or the file may be encrypted using a XOR encryption scheme.
0x03f5 .gam 'GAME'   Save games, specifically party details.
N/A .sav 'SAV'   Save games, specifically area and store details.
0x03f6 .sto 'STOR'   Stores.
0x03f7 .wmp 'WMAP'   World map.
0x03f8 .chr 'CHR'   Characters.
0x03f8 .eff 'EFF ' ToTSC and IWD and BG2 Effects; a replacement for the 30-byte effect structure found in CRE and ITM files. The EFF V2.0 format can be found either as a standalone file or embedded in CRE, ITM and SPL files.
0x03f9 .bs N/A Text format Compiled script, for character AI scripts.
0x03fa .chr 'CHR'   Character.
0x03fb .vvc 'VVC'   Visual 'spell casting' effects.
0x03fc .vef ??? Baldur's Gate 2 only Visual effects. There are no known files of this type.
0x03fd .pro 'PRO'   Projectiles.
N/A .res ??? Text format
IWD only
Character biography.
0x03fe .bio ??? Text format
Baldur's Gate 2 only
Character biography.
0x03ff .wbm ??? EE only Video format
0x0400 .fnt ??? Baldur's Gate Enhanced Edition / Baldur's Gate Enhanced Edition 2 only Font.
0x0402 .gui ??? Baldur's Gate Enhanced Edition / Baldur's Gate Enhanced Edition 2 only GUI definition.
0x0403 .sql ??? Baldur's Gate Enhanced Edition / Baldur's Gate Enhanced Edition 2 only Sql.
0x0404 .pvrz ??? Baldur's Gate Enhanced Edition / Baldur's Gate Enhanced Edition 2 only Compressed tileset.
0x0405 .glsl ??? EE only Shader description language.
0x0408 .menu ??? EE only Menu definition
0x0409 .menu ??? EE only LUA script file
0x040a .ttf ??? EE only True Type Font
0x040b .png ??? EE patch 2+ only Image file
0x044c .bah ??? Baldur's Gate 2 only Unknown
N/A .baf N/A Text format Uncompiled scripts.
0x0802 .ini N/A Text format
Planescape: Torment and Icewind Dale
Quest and spawn information.
0x0803 .src N/A Planescape: Torment only Overhead text.
N/A .toh 'TLK ' Icewind Dale only/BG2 only "Talk Table Override Header". This is used to override to specific entries in the TLK file. TOH files are used in conjunction with the TOT file.
N/A .tot N/A Icewind Dale only/BG2 only "Talk Table Override Text". This is used to override to specific entries in the TLK file. TOT files are used in conjunction with the TOH file.
N/A .var N/A Planescape Torment only File that stores variables declarations for starting game.