Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:MDL (GoldSrc)

From ReverseEngineering.wiki
Format
Developer Valve
Versions 10
Magic 49 44 53 54 ("IDST") at offset 0; sequence files "IDSQ"
Extensions .mdl
Endianness little
On this wiki Facts · Code · Notes · Topics

Studio model of GoldSrc (Half-Life 1): .mdl with magic IDST and version 10, a studiohdr_t with count/offset pairs for bones, sequences, textures and body parts; sequence groups live in separate IDSQ files.

Identification

studiomdl.h in the Half-Life SDK defines STUDIO_VERSION 10, IDSTUDIOHEADER as the int 'T'<<24 + 'S'<<16 + 'D'<<8 + 'I' (bytes IDST in the file) and IDSTUDIOSEQHEADER for IDSQ. Source engine models keep the IDST magic but use versions 44-49 (Format:MDL (Source studio model)); Quake's alias model is a different format (Format:MDL (Quake)).

Header

studiohdr_t (engine/studio.h): int id, version; char name[64]; int length; vec3 eyeposition, min, max, bbmin, bbmax; int flags; then count/offset pairs: bones, bonecontrollers, hitboxes, seq, seqgroups, textures (plus texturedataindex), numskinref/numskinfamilies/skinindex, bodyparts, attachments, soundtable/soundindex/soundgroups/soundgroupindex, transitions. There is no checksum field (the Source header has one).

Other records: mstudiobone_t (name[32], parent, flags, bonecontroller[6], value[6], scale[6]), mstudiotexture_t (name[64], flags, width, height, index), mstudiomodel_t (name[64], type, boundingradius, mesh and vertex/normal counts and offsets), mstudiomesh_t (numtris, triindex, skinref, numnorms, normindex). A studioseqhdr_t (id, version, name[64], length) starts each demand-loaded sequence group file.

Limits: 128 bones, 100 skins, 32 sub-models, 32 body parts, 16 sequence groups, 2048 sequences, 256 meshes, 8 bone controllers. Texture flags: 0x1 flatshade, 0x2 chrome, 0x4 fullbright, 0x8 nomips, 0x10 alpha, 0x20 additive, 0x40 masked.

Code & repositories

  • https://github.com/ValveSoftware/halflife @ b1b5cf5892918535619b2937bb927e46cb097ba1 · license: LicenseRef-Valve-Half-Life-SDK (declared by the contributor; GitHub's detector did not recognize LICENSE)
    Half-Life 1 SDK: utils/common/bspfile.h and wadlib.h/.c (BSP v30, WAD2/WAD3), engine/studio.h and utils/studiomdl/studiomdl.h (MDL v10). Valve SDK license, not open source.
    Tested on: source read, not run · checked 2026-10-18; last activity 2024-10-02

Pitfalls

Unverified: models with external textures use a companion <name>T.mdl and sequence groups use <name>01.mdl, <name>02.mdl; the naming comes from community documentation, the SDK header only says the sequences are "demand loaded". Unverified: texture pixels are 8-bit indexed with a 256-colour RGB palette after the pixels.

Evidence & references

ValveSoftware/halflife engine/studio.h lines 32-100, 112-121, 262-316, 329-335 and utils/studiomdl/studiomdl.h lines 17-21 at commit b1b5cf5892918535619b2937bb927e46cb097ba1.