claude_ut2k4

UT2004 DM Map Project — Context

Goal

Read, interpret, and ultimately reconstruct UT2004 official Deathmatch maps, with the longer-term aim of programmatically generating/modifying maps. Scope is intentionally limited to official UT2004 DM maps (the stock maps shipped with the game), not custom community content.

Repo contents


File format essentials

All UT2004 content files share one format — the Unreal package format. The extension (.ut2 map, .utx texture, .usx static mesh, .uax sound, .u compiled code) is organizational only; the binary structure is identical across all of them.

Two encoding details that bite

What parses cleanly vs. what’s hard


Architecture decision: read binary, write via T3D

Do not hand-author binary .ut2 files. Producing a map the engine will load requires reproducing internal UnrealEd work (CSG/BSP rebuild, node generation, lighting bake, path-node networks). A raw binary writer is far too fragile.

Pipeline:

  1. Read / interpret: parse the binary .ut2 directly (Python). Recover header, names, tables, and actor properties.
  2. Write / modify: generate or transform T3D (UnrealEd’s plain-text export format — actors, brushes with full polygon defs, properties). UnrealEd imports T3D and rebuilds geometry from it.
  3. Finalize in-engine: in UnrealEd, Build Geometry → Build Lighting → save as .ut2. The engine does the hard serialization.

Text in/out for the logic; the engine for the binary.


Reference resources

Note on distribution format

Community maps often ship compressed as .uz2 and need ucc decompress (or UT2004MI) back to .ut2. Stock official maps are already plain .ut2 in the game’s Maps/ folder.


Suggested first steps in Claude Code

  1. Write a Python .ut2 parser: validate magic, read header, decode compact index, walk name/import/export tables. Print a summary (package version, counts, name list).
  2. Run it against one official DM map; confirm the actor/object list comes out cleanly.
  3. Iterate to decode standard actor properties (location/rotation/scale/class).
  4. Only then move to T3D generation for the write side.