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:TD6 (RollerCoaster Tycoon 2)

From ReverseEngineering.wiki
Format
Platforms Windows x86
Magic none; checksum relation identifies the file
Extensions .TD6, .TD4 (.TD7 handled by OpenRCT2)
Endianness little
On this wiki Facts · Code · Notes · Topics

Track design format of Software:RollerCoaster Tycoon 2 (.TD6), sharing its envelope with RollerCoaster Tycoon's .TD4: the whole file is one RLE stream (Format:Sawyer chunk encoding encoding 1, no chunk header) followed by a 32-bit rotating checksum offset by a format constant. The decoded data starts with a 0xA3-byte ride header, followed by track or maze elements, entrances and scenery.

Identification

Compute the rotating checksum over all bytes except the last four and subtract the stored value: the result is 0x1D4C1 (120001) for TD6 and 0x1A67C (108156) or 0x1A650 (108112) for TD4. After decoding, bits 2-3 of byte 0x07 give the version: 0 TD4, 1 TD4 from Added Attractions, 2 TD6.

Structure

The decoded data is:

  1. Ride header, 0xA3 bytes: ride type (0x00), vehicle object index (0x01), flags (0x02), ride mode (0x06), version and colour scheme (0x07), per-train vehicle colours (0x08), ride statistics such as excitement, intensity and nausea (0x5B-0x5D, in tenths), track colours (0x60-0x6B), the vehicle object entry (16 bytes at 0x70) and the space the design needs (0x80, 0x81).
  2. For a maze ride: 4-byte maze elements until a zero u32. Otherwise: 2-byte track elements (track piece type, flags) until a 0xFF byte, then 6-byte entrance/exit elements until a 0xFF byte.
  3. Scenery: 0x16-byte elements (a 16-byte object entry, x, y, z, flags, two colours) until a 0xFF byte.

The 0xFF terminators work because a reader peeks at the first byte of each record: no valid track piece, entrance height or object type byte is 0xFF.

Versions

  • .TD7: handled by OpenRCT2 with 16-bit track records terminated by 0xFFFF. Unverified: written by RollerCoaster Tycoon Classic.

Pitfalls

  • G-forces in the header are stored divided by 32 and ratings in tenths; OpenRCT2 multiplies them on import.
  • TD4 and RollerCoaster Tycoon SC4 share the checksum algorithm, so the checksum alone cannot separate them.

Tools that read/write it

  • OpenRCT2 imports TD6 (src/openrct2/rct2/T6Importer.cpp) and exports it (T6Exporter.cpp); the checksum is in src/openrct2/sawyer_coding/SawyerCoding.cpp.