.MTP -- Model-Texture Packages

1. Architectural Role & Engine Purpose

The MTP ("Model-Texture Package") format is an EA IFF-85 binary container used in Project I.G.I. 1 to package collections of 3D models with their associated textures, shadow volumes, and bone animation references. It defines the exact binding matrix between 3D mesh instances and texture assets.

Crucial Architectural Distinction: MTP is a binary IFF container with FourCC chunks (FORM MTP ). It is completely distinct from levelN.dat, which is a human-readable plain-text asset manifest. While levelN.dat provides human-editable level-specific texture overrides, .MTP packages provide self-contained binary bundles for weapons, vehicles, and shared characters.

2. Binary File Layout & Memory Map Diagram

MTP files follow the standard big-endian EA IFF-85 container format with format type "MTP " at offset 0x08. FourCC and size fields are big-endian, while the contents of the string-list chunks are little-endian. Chunks are aligned to 2-byte boundaries. Canonical chunk order is BANM, SNDS, SVOL, MODS, VNAM, INST, TEXF, PALF, GTT, though INST commonly appears before TEXF; PALF and GTT are not interpreted and are skipped:

MTP PACKAGE — EA IFF-85 MODEL-TEXTURE CONTAINER LAYOUT 0x00: FORM MTP Container Header (12 Bytes) EA IFF-85 FourCC "FORM" (4B) | Total Container Size (uint32) | Form Type "MTP " (0x2050544D) magic[4]="FORM", form_size, form_type[4]="MTP " MODS Chunk: Model Name List MEF MODELS LE string count followed by packed null-terminated model filenames. uint32 LE count; char[] count null-terminated strings TEXF Chunk: Texture File Directory SURFACE TEXTURES LE string count followed by packed null-terminated texture filenames. uint32 LE count; char[] count null-terminated strings INST Chunk: Model-Texture Bindings WORLD INSTANCES One entry per MODS model (no count prefix): modelIdx + texCount + texture indices. modelIdx u32LE; texCount u32LE; texIdx[texCount] u32LE BANM & SNDS Chunks: Animation & Sound BONES & AUDIO Skeletal animation clip tables (BANM), sound references (SNDS), and shadow volume references (SVOL). Footstep sound triggers for metal, concrete, wood, glass, and water. Crucial Distinction: Binary Container vs Plain Text IFF vs TEXT .MTP is a binary EA IFF compound package. In contrast, levelN.dat is a plain-text token manifest. Level loading parses levelN.dat to locate .MTP packages and individual .MEF/.TEX files inside .RES.

3. Model-Texture Binding & Ingestion Pipeline Diagram

Because the INST chunk frequently appears before the TEXF chunk in file stream order, the engine executes a two-phase ingestion algorithm:

MTP PACKAGE — ASSET UNPACKING & SCENE GRAPH INSTANTIATION PIPELINE 1. IFF FORM MTP PARSE • Verify FORM MTP • Read Chunk Sizes • Swizzle Big-Endian IDs 2. MODS & TEXF RESOLVE • Load Embedded MEFs • Stream .TEX Bitmaps • Bind Surface Materials 3. INST PLACEMENT • Decompose 3x3 Matrix • Position in World XYZ • Register Octree Leaves 4. AUDIO & PHYSICS • Attach SNDS Triggers • Ricochet Resistance • Acoustic Reverb Volume 5. SCENE GRAPH MOUNT • Instantiate Entity • Frustum Culling List • Ready for Rendering

4. Architectural Mechanics & Chunk Specifications

4.1 String List Chunks (MODS, TEXF, BANM, SNDS, SVOL)

All string array chunks share an identical layout: a 32-bit little-endian string count followed by contiguous null-terminated ASCII strings:

OffsetSizeTypeFieldDescription
0x004uint32 (LE)countTotal count of strings in chunk
0x04Varchar[]stringscount null-terminated ASCII string paths packed sequentially

4.2 The VNAM Chunk (Virtual Model Aliases)

VNAM is not a plain string list. It starts with a 32-bit little-endian count, followed by that many 32-bit little-endian indices, and only then the null-terminated alias strings mapped onto those indices:

OffsetSizeTypeFieldDescription
0x004uint32 (LE)countNumber of alias index entries
0x04count * 4uint32[] (LE)alias_indicesIndices that the alias strings map onto
0x04 + count*4Varchar[]alias_stringsNull-terminated alias names following the index array

4.3 The INST Chunk (Model-Texture Instance Mappings)

The INST chunk contains exactly one entry per model in the MODS chunk (no separate count prefix). Each entry defines which textures from the TEXF pool are bound to that model:

OffsetSizeTypeFieldDescription
0x004uint32 (LE)model_idxIndex of the model in the MODS string array
0x044uint32 (LE)tex_countNumber of textures assigned to this model
0x08tex_count * 4uint32[]tex_indicesArray of indices pointing into the TEXF string array

5. C++ Struct Definitions

#pragma pack(push, 1)
// EA IFF-85 FORM Header (Big-Endian Sizes)
struct IffFormHeader {
    char     form_magic[4];  // "FORM"
    uint32_t file_size_be;   // Big-endian file size
    char     form_type[4];   // "MTP "
};
static_assert(sizeof(IffFormHeader) == 12, "IffFormHeader must be 12 bytes");

// MTP Instance Record Header
struct MtpInstanceHeader {
    uint32_t model_index;    // Little-endian index into MODS array
    uint32_t texture_count;  // Number of texture index DWORDs following
};
static_assert(sizeof(MtpInstanceHeader) == 8, "MtpInstanceHeader must be 8 bytes");
#pragma pack(pop)