Total Annihilation & TA: Kingdoms Format Reference

A field guide to the proprietary file formats Cavedog Entertainment shipped
in Total Annihilation (1997) and Total Annihilation: Kingdoms (1999),
written from a working reverse-engineering perspective. Every page pairs the
on-disk byte layout with a one-line kbot command so you can poke at the
real files alongside the prose.
Tip
First time here? Read Quickstart — five commands that show off the toolkit in five minutes.
Note
If you have not yet, install the toolkit and register a context first:
go install github.com/coreprime/kbot/cmd/kbot@latest
kbot ctx add ~/games/totala --alias ta --game totala
Once a context is current, most commands (kbot tnt preview …,
kbot gaf list …, kbot mount --server) resolve bare filenames against
every HPI/UFO/CCX/GP3 archive in the install — no more typing absolute
paths.
Format catalogue
Container & wrapper formats
| Page | Extensions | Purpose | First class? |
|---|---|---|---|
| HPI / UFO / CCX / GP3 | .hpi .ufo .ccx .gp3 |
Encrypted, compressed archive — the wrapper for everything else | TA ✅ TA:K ✅ |
Graphics & media
| Page | Extensions | Purpose | First class? |
|---|---|---|---|
| GAF | .gaf .taf |
Indexed-colour sprite animations (cursors, explosions, unit gadgets, features) | TA ✅ TA:K ✅ |
| TAF / TSF | .taf .tsf |
TA: Kingdoms truecolor (16-bit ARGB) animations — spell effects, explosions, menu backgrounds — plus their editable text form | TA:K ✅ |
| PCX | .pcx |
ZSoft Paintbrush bitmap — unit portraits, GUI panels, and TA:K palette carriers | TA ✅ TA:K ✅ |
| PAL / ALP / LHT / SHD | .pal .alp .lht .shd |
256-entry colour palette (1,024 bytes) and colour lookup tables: .alp 256×256 (65,536 bytes), .shd / .lht 32×256 (8,192 bytes) |
TA ✅ TA:K ✅ |
| FNT | .fnt |
1-bit-per-pixel variable-width bitmap font | TA ✅ |
| Smacker / ZRB | .smk .zrb |
Cutscene video (RAD Game Tools Smacker, renamed .zrb) |
TA ✅ |
| Bink | .bik |
TA: Kingdoms cutscene video (RAD Bink 1) — Smacker's successor | TA:K ✅ |
| WAV / Sound | .wav |
Plain WAV plus the three-layer sound-bank wiring | TA ✅ TA:K ✅ |
Maps & terrain
| Page | Extensions | Purpose | First class? |
|---|---|---|---|
| SCT | .sct |
Reusable map sections stitched together to build .tnt maps |
TA ✅ |
| TNT | .tnt |
A complete playable map (tile grid + heightmap + minimap + feature list) | TA ✅ |
| TA:K maps | .tnt .ota .crt .kmp |
TA: Kingdoms map pipeline — texture-mapped terrain + minimap render, and the .crt scenario sidecar (placed units, rules, triggers) |
TA:K 🟡 |
Units, scripts, configs
| Page | Extensions | Purpose | First class? |
|---|---|---|---|
| 3DO | .3do |
Hierarchical 3D unit/feature mesh with palette-indexed faces | TA ✅ |
| COB / BOS | .cob .bos |
Stack-based animation/scripting bytecode that drives every unit | TA ✅ TA:K ✅ |
| TDF / FBI / OTA | .tdf .fbi .ota |
INI-style configuration trees — unit stats, weapons, map metadata. Includes full FBI field dictionary. | TA ✅ TA:K ✅ |
| Gamedata TDFs | gamedata/*.tdf |
Movement classes, side data, sound bindings, weapon reference | TA ✅ |
| AI profiles | ai/*.txt |
Plain-text per-difficulty AI weights and unit limits (TAK profiles are plan-less; see TAK note) | TA ✅ TA:K ✅ |
TA: Kingdoms GUI
| Page | Extensions | Purpose | First class? |
|---|---|---|---|
| TA:K GUI | .gui |
Whitespace-delimited widget tree for TA: Kingdoms menus | TA:K ✅ |
Tutorials & reference
| Page | Content |
|---|---|
| Quickstart | Five commands to try first. |
| Modding a unit | End-to-end tutorial: extract → edit → repack → test (TA). |
| Pitfalls | Single-page cheat-sheet of every gotcha across the format docs. |
| TA vs TA:K formats | Single-page matrix of what's shared, similar, or game-exclusive. |
| Reference catalogues | Standalone repos: coreprime/reference-ta — 278 units / 199 weapons / 45 builders; coreprime/reference-tak — 203 units / 198 weapons / 32 builders. |
| Glossary | Common terms (piece, axis, sealevel, signal mask, …). |
| Image gallery | Every figure in the docs with the producing command. |
Legend: ✅ first-class kbot support · 🟡 documented but not parsed by kbot today.
How the formats fit together
┌───────────────────────────────┐
│ HPI / UFO / CCX / GP3 │
│ (encrypted, compressed VFS) │
└──────────────┬────────────────┘
│ contains
┌──────────────────────┬───────────┼───────────────┬──────────────────┐
▼ ▼ ▼ ▼ ▼
┌───────┐ ┌───────┐ ┌───────┐ ┌────────┐ ┌─────────┐
│ FBI │ unit stats │ COB │ │ 3DO │ mesh │ GAF │ sprites│ TNT │ map
└───┬───┘ └───┬───┘ └───┬───┘ └────┬───┘ └────┬────┘
│ references │ runs on │ textured by │ used by │ built from
▼ ▼ ▼ ▼ ▼
┌───────┐ ┌───────┐ ┌───────┐ ┌────────┐ ┌─────────┐
│ TDF │ weapons │ piece │ │ PCX │ skins │ PAL │ colour │ SCT │ tiles
│ /OTA │ /features │ tree │ │ unitpic│ │ /ALP/LHT/SHD │ + heights
└───────┘ └───────┘ └───────┘ └────────┘ └─────────┘
Almost every reverse-engineering session begins by mounting an HPI — even
flattened installs are just an HPI extraction. From there, units (FBI)
point at meshes (3DO), scripts (COB), unit portraits (PCX), and
animation gadgets (GAF). Maps (TNT) are assembled from sections (SCT)
and feature placements that resolve into TDF feature definitions.
Note
Mount the whole install at once. Instead of poking at one archive at
a time, point kbot mount at the install root. It walks every HPI/UFO/CCX
in the folder and layers the contents into a single virtual filesystem so
you can browse units/ARMCOM.fbi without caring which archive it came
from.
kbot mount ~/games/totala --server # opens at http://localhost:8090
Endianness, character set & coordinate conventions
These hold across every format in this document unless a page explicitly overrides them:
| Property | Convention |
|---|---|
| Endianness | Little-endian (Intel x86). |
| String encoding | ASCII / CP-437, NUL-terminated. TA:K added partial Windows-1252 support but never UTF-8. |
| Numeric widths | uint8 (char), uint16 (short), uint32 (long). 64-bit values do not appear. |
| Coordinate origin | Images, tile grids, attribute grids — (0, 0) is the top-left. 3DO meshes use Y as vertical (up). |
| 3D fixed-point scale | 3DO models use 16-bit fractional fixed-point: value / 65536.0 ≈ world-space units. |
| Game tick rate | 30 ticks/second. Most timing fields in COB and GAF use ticks. |
| Transparent colour | There is no palette-wide transparent index. A GAF frame names its own key (often 9, sometimes 0) and a compressed frame's skipped pixels are transparent; terrain, minimaps, backdrops and model textures draw every index, palette index 0 (black) included. |
Important
Always validate magic numbers before trusting an offset. Several
formats (HPI, COB, GAF, TNT, SCT) carry a 32-bit signature in the first
field. If the value does not match, the file is either corrupted, from a
mod that uses a private format, or — for TA:K — a .taf/.tsf variant
with a different version word.
Working with this documentation
Every per-format page is structured the same way:
- What it is — purpose and where it appears in a TA install.
- On-disk layout — header struct, then payload sections, with byte offsets called out.
- Reading order — the sequence of seeks/reads that successfully parse the file.
- Worked example — a real Cavedog file dissected byte-by-byte.
- Inspect it yourself —
kbotcommands you can run against your own install to see the data live. - Gotchas — undocumented edge cases, version differences, scratch bytes left in by Cavedog tools, etc.
If a callout looks like this:
Tip
Try it yourself.
kbot pal swatch palettes/palette.pal --target out.png --cell 24
…then the command is meant to be runnable verbatim once a context is set.
Credits & source materials
These docs synthesise decades of community reverse-engineering work. Pages attribute specific findings inline, but the foundations come from:
- Joe D. — original HPI format dissection (1997).
- Saruman & Bobban / dFR Engineering — first TNT walkthrough (1997).
- Scott "me22" McMurray — TNT format clarifications (2003), drawing on Kinboat's Annihilator source.
- Kinboat — SCT format, GAF tooling, Annihilator map editor.
- Dan Melchione & Dark Rain — 3DO format (1998, revised 2002).
- C_A_P, Switeck, KhalvKalash — COB/BOS opcode reverse engineering and the Scriptor tool family.
- Dark Rain — TA:K GUI format and the TA:K format-challenges notes.
- Cavedog Entertainment — for making a game worth keeping alive 25+ years later.
When this documentation conflicts with one of those originals, the kbot source code is the source of truth — the formats here are tested round-trip against thousands of real Cavedog files. If you find a discrepancy, open an issue or PR at https://github.com/coreprime/kbot.