Deathtrack Track Format

From ModdingWiki
Jump to navigation Jump to search
Deathtrack Track Format
File:Deathtrack Track Format.png
There is no image of a map in this format — upload one!
Format typeMap/level
Map type3D road centreline (closed loop of points)
Layer count1
Games

Each of the ten cities has a .TRK file that holds the road's centreline as a series of 3D points, plus a list of roadside objects. The file is not compressed and does not use the chunk format: the TRK: signature is just a four-byte tag. The skyline is in the .MAP file of the same name and the objects are models from SHAPE.TBL (Deathtrack Model Format).

The file size is exactly 6 + 4×N + 6×P bytes, with N objects and P point records.

File format

Header

Data type Name Description
char[4] signature TRK:. The game only checks that the first byte is T and the fourth is :
INT16LE objectCount Number of roadside objects N (11–19 in the shipped tracks)

Object list

N records follow:

Data type Name Description
UINT16LE pointIndex Index of the track point the object is attached to
INT16LE shape Sign selects the side (positive = left, zero or negative = right); the absolute value is an index into SHAPE.TBL (0–123)

Points

The rest of the file is a list of 6-byte records up to the end of the file:

Data type Name Description
INT16LE x Position
INT16LE y Position
INT16LE z Height (−1 to 200)
  • The points form a closed loop, about 30 units apart. The shipped tracks have 877–1,892 retained points.
  • From the third record onward, a record in which all three words are zero is dropped by the loader and not counted.
  • The game does not check the number of points. The space reserved for them holds 1,908 points; the largest track (orlando) has 1,892.

Object placement

For the object at point p with successor q, the position is

  • left side: x = p.x + 8×(p.y − q.y), y = p.y + 8×(q.x − p.x)
  • right side: the lateral displacement has the opposite sign
  • z = p.z

The pitch is derived from the height difference to the next point, the heading is the track heading minus 90°. Models with an index of 11 or lower are replaced by model 3 beyond a distance of 50 units.

Source code

From re-deathtrack, the open-source browser port:

Credits

This file format was reverse engineered by VorticonCmdr. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)