ArgDocs

Racing Line (Track File Format)

This defines the line that computer cars drive around the track, and also applies steering help to the player’s car, especially keyboard users.

The first segment is always 8 bytes long, defined like this:

Field Type Comment
Length byte Length of first segment
byte Always 0x80 (128)
Displacement short Sideways adjustment of the starting point
Correction short
Radius short

After this, a number of segments appear. The segments are of two kinds, either “Normal” or a “Wide Radius” variant. The “Wide Radius” version is used for pieces of track that have a very long curvature, e.g. the back straight between turns 7 and 8 at Montreal which isn’t really a straight, but in fact a very long curve. Of the total number of best line segments, “Wide Radius” segments don’t appear very often. In fact, they only account for around 1% of all best line segments.

The type of segment is identified by the second byte in each segment.

Normal segments, 6 bytes long:

Field Type Comment
Length byte Length of segment
byte Always 0x00
Correction short
Radius short Positive values for right-hand turns, negative values for left-hand turns. Smaller value for sharper turns.

Wide radius segments, 8 bytes long:

Field Type Comment
Length byte Length of segment
byte Always 0x40
Correction short
High Radius short
Low Radius short

The High Radius and Low Radius values are combined to provide an effective radius value.

Note that the effective radius may turn out to be 0, but the racing line will still follow the curvature of the track section it is located at.

The Best Line Segment part of the file is ended by two null values, i.e. 0x00 00.

Back to F1GP Track File Format