This page is not complete, and as time goes, I will try and add some more and more informations, as long as better presentation. For now on, only pertaining information is included. Do not hesitate to let me know what you think, and share any information you'd find.
This page is meant to allow for more and more people creating not only tracks, but also track editing tools. Therefore, you are free to copy, extract, mirror any information you would find meaningful in this page. Just let me know if you do so.
First of all, I would like to thank Paul Hoad for his Track Editor which got me started decoding the GP2 track file format. All information posted here is gathered from several sources, including myself. I tried to quote them all here, but errors are mine of course...
Well, let's go...
Before we begin, you need to be familiar with hexadecimal values datatypes.
Datatype | Example | Description |
long | 0x01234567 | 32 bits (4 bytes) value |
short | 0x0123 | 16 bits (2 bytes) value |
byte | 0x01 | 8 bits (1 byte) value |
The first 4096 bytes of any track file are unused. These were used initially in F1GP to hold some information that is no longer required. Paul Hoad's Trackeditor uses this to store several track informations. Any track editing tool may use this section as they see fit.
Thanks to Paul Hoad for the tip.
Offsets section begins at offset 0x1000.
Offset | Size | Description |
0x1000 | long | Unknown number 1 |
0x1004 | long | Unknown number 2 |
0x1008 | long | 0x1020 based offset to Checksum |
0x100C | long | 0x1020 based offset to Object Definitions |
0x1010 | long | 0x1020 based offset to Track Data |
0x1014 | long | 0x1020 based offset to CC Car Setup |
0x1018 | long | 0x1020 based offset to Pitlane Data |
Internal Objects Definition follows immediately the Offsets section in the track file. This is made up of:
Offset | Size | Description |
0x101C | long | Number of Internal Objects |
0x1020 | long | 0x1020 based offset to Internal Object 0 definition |
0x1024 ... | long | ... |
0x1020 + 4(n-1) | long | 0x1020 based offset to Internal Object n definition |
The Objects Definition structure are very simple:
Definition of Object 0 |
... |
Definition of Object n |
This section comes right before the track data section. To know the number of objects before reading the structure, just substract Offset to Track Data and Offset to Objects Definition and divide by 16.
Each definition is stored in a 16 bytes structure.
Field | Size | Description |
Ident number 1 | byte | Internal Id |
Detail Level | byte | Object detail level flag |
Unknown | short | |
Distance From Track | short | Distance from the center of the track. Positive on the right |
Angle X | short | Angle as an signed integer to be divided by 65536/360 = 182.04444 |
Angle Z | short | Angle as an signed integer to be divided by 65536/360 = 182.04444 |
Unknown | short | |
Height | short | Object Height from the floor |
Ident Number 2 | short | Internal Id |
The track config section defines several attributes pertaining to the track itself, in a 28 bytes structure described as follows:
Field | Size | Description |
Angle Start | unsigned short | Angle of track sector 0 to be divided by 65536/360 = 182.04444 |
Height Start | short | |
Track Start Y | short | Y coordinate of track sector 0 |
Track Start Z | short | Altitude of track sector 0 |
Track Start X | short | X coordinate of track sector 0 |
Unknown | short | |
Unknown | short | (Pole Side Left/Right) ? |
Unknown | short | (Pit Side Left/Right) ? (see Pitlane Editing tutorial for more info). |
Begin right bank | unsigned byte | Rigth verge width at track sector 0 |
Begin left bank | unsigned byte | Left verge width at track sector 0 |
Unknown | byte | |
Unknown | byte | |
Unknown | byte | |
Unknown | byte | |
Unknown | byte | |
Unknown | byte | |
Unknown | byte | |
Unknown | byte | |
Unknown | byte | |
Unknown | byte |
The track is actually made up of several sectors with commands associated with them. In the file the commands come before the track sector definition. You will find a better description on commands in the official Command Library Tutorial.
The format of the track sector information is as follows:
Track Sector 0 Commands Definition |
Track Sector 0 Attributes |
... |
... |
Track Sector n Commands Definition |
Track Sector n Attributes |
End of Track Section |
Track Sector Commands are used to perform all kind of modifications on the track. Some of them alter the track itself (track width) and should belong to a particular track sector. Some others allow for changing the tracksides (tarmac, grass, sand traps). Some may be used to apply some textures or to place some objects along the circuit. Some others are used to define the scenery environment.
Please, refer to the different tutorials on Sjon's GP2 web site for more information.
Track sector Commands are specified using an unsigned byte. There could only be 256 different commands in the game. Each command have a one-byte parameter, which I will refer to as Arg0, and may have also one or more two-bytes (short) commands, called Arg1, Arg2, ... The track commands appear just before the track sector definition itself (see below). There is no predefined length, however. Therefore, you need to know how many parameters a specific command takes when decoding. Again, do not hesitate to have a look a the Command Library Tutorial.
Cmd0|Arg0 | Arg1 | ... | Argn |
... | |||
Cmdn|Arg0 | Arg1 | ... | Argn |
A note for command decoding: Notice that the command and its first parameter come in as a single short value where the most significant byte is the command number and the least significant byte is Arg0. Because Intel processors reverse the byte ordering, you cannot read this as two one-byte values. If you do so, you would first fetch the Arg0, then the command number.
To make it clearer, here is what one can find in the first track sector of the Jerez circuit (f1ct14.dat):
Cmd Arg0 Arg1 Arg2 Arg3 Arg4 Arg5 Arg6 Arg7 Arg8 0xc9 0x00 0x00ba 0x00c1 0x00d7 0x00d7 0x0005 0x0003 0x001b 0x0023 0xc9 0x00 0x00fa 0x00fd 0x00a1 0x00a3 0x001c 0x001a 0x0015 0x0019 0xc9 0x00 0x00c2 0x00d5 0x0054 0x0038 0x0040 0x001c 0x0009 0x002a 0xc9 0x00 0x0068 0x006f 0x003b 0x003d 0x0031 0x0028 0x0015 0x0025 0xc9 0x00 0x0070 0x007b 0x0029 0x0026 0x0023 0x000e 0x001c 0x0031 0xc8 0x00 0x0009 0x0010 0x0022 0x0001 0x0010 0x0000 0x0081 0xc8 0x00 0x0008 0x0010 0x0022 0x0001 0x0010 0X0000 0x0081 0xc8 0x00 0x000b 0x0006 0x0007 0x0001 0x0010 0x0000 0x0087 0xc8 0x00 0x000c 0x0006 0x0007 0x0001 0x0010 0x0000 0x0087 0xc8 0x00 0x000d 0x0006 0X0007 0x0001 0x0010 0x0000 0x0087 0xc8 0x00 0x000e 0x0006 0x0007 0x0001 0x0010 0x0000 0x0087 0xc8 0x00 0x0012 0x0006 0x0007 0x0001 0x0010 0x0000 0x0087 0xc8 0x00 0x0013 0x0006 0x0007 0x0001 0x0010 0x0000 0x0087 0xbd 0x00 0x9118 0x20b4 0xca 0x00 0x0001 0x012c 0x0001 0x000a 0xcb 0x00 0x0001 0x0140 0x0001 0x000f 0xdf 0x00 0x02b7 0x02c8 0x0046 0xde 0x00 0x02c4 0x02de 0x0046 0xdf 0x00 0x02d9 0x02eb 0x0037 0xb9 0x00 0x0023 0xaf 0x00 0xc000 0x4000 0xb8 0x00 0x0002 0xf378 0x0000 0xf768 0x0000 0xff20 0x0000 0x0550 0x0000 0x093c 0x0000 0x0df8 0x0a 50 0x80 0x04 0x0650 0x95 0x00 0X0008 0x94 0x00 0x0008 0xd7 0x19 0x80 0x15 0x03a0
Track Sector Attributes are always stored in a 10 bytes structure described hereafter:
Field | Size | Description |
Sector Length | unsigned short | Length of the sector in units of 16 feet (4.87 m) |
Sector Arc | short | Angle value as a signed integer to be divided by 65536/360 = 182.04444 |
Height | short | Height gradient along the sector |
Flags | short | Kerbs, Wall remove and Road Signs Flags (see below) |
Right Bank | unsigned byte | Rigth verge width |
Left Bank | unsigned byte | Left verge width |
The Flags attribute contains information on the kerbs, road signs and fences:
Bit | Description |
15 | Unknown |
14 | Unknown |
13 | Left wall remove |
12 | Right wall remove |
11 | Left kerb |
10 | Right kerb |
9 | Unknown |
8 | Unknown |
7 | Road sign (Arrow/100) |
6 | Road sign (Arrow) |
5 | Bridged left fence |
4 | Bridged right fence |
3 | Road signs (300/200/100) |
2 | Kerb type selector |
1 | Pitlane exit |
0 | Pitlane entrance |
The end of the Track section comes as a short value.
Field | Size | Description |
0xffff | short | End of Track Section |
The first 12 bytes of the CC Line section contain the CC Line Config Data. These are made up of:
Field | Size | Description |
CC Line Start X | byte | X coordinate of CC line sector 0 |
Unknown | byte | |
CC Line Start Y | short | Y coordinate of CC line sector 0 |
Unknown | short | |
Unknown | short | |
Unknown | short | |
Unknown | short |
Each CC Line Sector is defined in an 8 bytes structure described hereafter:
Field | Size | Description |
Sector Length | unsigned byte | Length of the CC Line Sector |
Sector Command | unsigned byte | Sector Command. 0x50, 0x70? |
Unknown | short | Flag ? |
Radius Sign/Scale | short | Scaling factor for the radius |
Sector Radius | short | CC line sector radius |
The end of CC line section comes with a null command. That is a command of 0x00 instead of 0x50 or 0x70.
It is not clear, however, if the remaining of the structure is 'lost', that is, wether it should be used in the next section or not
Thanks to Paul hoad for this information.
The CC Car Setup section holds the configuration of the computer controlled cars. Here we find in a 38 bytes structure:
Field | Size | Description |
Rear Wing | unsigned byte | Rear wing setup. Substract 151 to get the value. |
Front Wing | unsigned byte | Front wing setup. Substract 151 to get the value. |
1st Gear | unsigned byte | 1st Gear ratio. Substract 151 to get the value. |
2nd Gear | unsigned byte | 2nd Gear ratio. Substract 151 to get the value. |
3rd Gear | unsigned byte | 3rd Gear ratio. Substract 151 to get the value. |
4th Gear | unsigned byte | 4th Gear ratio. Substract 151 to get the value. |
5th Gear | unsigned byte | 5th Gear ratio. Substract 151 to get the value. |
6th Gear | unsigned byte | 6th Gear ratio. Substract 151 to get the value. |
Tyre Compound | short | CC cars tyre compound. |
Unknown | unsigned byte | |
Track Grip | unsigned byte | Track grip for computer controlled cars |
Unknown | unsigned byte | |
Brake Balance | unsigned byte | Brake balance computer controlled cars |
Unknown | short | |
Unknown | short | |
Unknown | unsigned byte | |
Acceleration | unsigned byte | CC cars acceleration rate |
Unknown | unsigned byte | |
Air Resist | unsigned byte | Air Resist |
Unknown | short | |
Unknown | short | |
Fuel Load | short | Amount of fuel |
Unknown | short | |
Unknown | short | |
Unknown | short | |
Unknown | short | |
Unknown | short |
The Pitlane Section follows immediately the CC Car Setup Section in the track file.
The Pitlane Data is encoded is a similar way as the track data in the file. There is no such thing as a Pitlane Config section, though. As the first pitlane sector is connected to a particular track sector through one of its command, the starting attributes of the pitlane are implied by the track geometry itself.
Pitlane data encoding is described as follows:
Pitlane Sector 0 Commands Definition |
Pitlane Sector 0 Attributes |
... |
... |
Pitlane Sector n Commands Definition |
Pitlane Sector n Attributes |
End of Pitlane Section |
Pitlane commands are located before each pitlane sector they are related to. The commands are encoded in the same way as Track commands.
Notice that the first unsigned short field contains the Cmd0 as its most significant byte and the first parameter Arg0 as its least significant unsigned byte.
Cmd0|Arg0 | Arg1 | ... | Argn |
... | |||
Cmdn|Arg0 | Arg1 | ... | Argn |
Field | Size | Description |
Sector Length | short | Length of the sector in units of 16 feet (4.87 m) |
Sector Arc | short | Angle value as a signed integer to be divided by 65536/360 = 182.04444 |
Height | short | Height gradient along the sector |
Flags | short | Wall remove, and Pitlane Flags. |
Right Bank | byte | Rigth verge width |
Left Bank | byte | Left verge width |
The meaning of the Flags attributes follow the same rules as the one found in the track sectors definition. See its description there.
The end of the Pitlane section comes as a short value.
Field | Size | Description |
0xffff | short | End of Pitlane Section |
Camera Definitions appear rigth after the Pitlane section. There is no offset to access directly this structure in the file. However, read the Pitlane section until the End of Pitlane Section indicator (0xffff).
See the excellent Camera Editing Tutorial by David "SNQQPY.DOG" for more explanations.
The Camera Definition comes in a 32 bytes structure described as follows:
Field | Size | Description |
Location | short | Camera Location along the circuit in track sector units. Substract 16384 to get the value. |
Distance from Center | short | Distance from center of the track. Positive values to the right |
Height (Practice) | short | Camera height in practice circuit |
Unknown | short | Referred to as Unknown1 in TE (minus 16384 ?) |
Unknown | short | |
Switch Location | short | Distance along the circuit where the next camera takes control. Substract 16384 to get the value. |
Object View behind | short | Distance to be seen in external view |
Object View ahead | short | Distance to be seen in external view |
Zoom In/Out | short | Zoom in/out factor. The higher the closer of a car |
Zoom Adjust | short | Zoom factor adjustment. See tutorial for more informations |
Unknown | short | |
Unknown | short | |
Unknown | short | |
Unknown | short | |
Unknown | short | |
Height (Race) | short | Camera height in race mode |
The end of the Camera section comes as a short value.
Field | Size | Description |
0xffff | short | End of Camera Section |
Beware, mostly unknown, here... This section was initially set up according to Babbels' Excel Unknown Spread sheet.
It seems that this structure is always 100 bytes long, but not all of them are used from track to track.
Next in the file is a table:
Field | Size | Description | |
vdu0 | short | ||
vdu1 | short | ||
vdu2 | short | ||
vdu3 | short | ||
vdu4 | short | ||
vdu5 | short | ||
vdu6 | short | ||
vdu7 | short | ||
vdu8 | short | ||
vdu9 | short | ||
vdu10 | short | ||
Number of Laps | short | Number of laps for a 100% length race | |
vdu12 | short | ||
vdu13 | short | ||
Pitstop Strat 14 | short | ||
Pitstop Strat 15 | short | ||
Pitstop Strat 16 | short | ||
Pitstop Strat 17 | short | ||
Pitstop Strat 18 | short | ||
Pitstop Strat 19 | short | ||
Pitstop Strat 20 | short | ||
Pitstop Strat 21 | short | ||
Pitstop Strat 22 | short | ||
Pitstop Strat 23 | short | ||
Pitstop Strat 24 | short | ||
Pitstop Strat 25 | short | ||
Pitstop Strat 26 | short | ||
Pitstop Strat 27 | short | ||
Pitstop Strat 28 | short | ||
Pitstop Strat 29 | short | ||
Pitstop Strat 30 | short | ||
Pitstop Strat 31 | short | ||
Pitstop Strat 32 | short | ||
Pitstop Strat 33 | short | ||
Pitstop Strat 34 | short | ||
Pitstop Strat 35 | short | ||
Pitstop Strat 36 | short | ||
Pitstop Strat 37 | short | ||
vdu38 | short | ||
vdu39 | short | ||
vdu40 | short | ||
vdu41 | short | ||
vdu42 | short | ||
vdu43 | short | ||
vdu44 | short | ||
vdu45 | short | ||
vdu46 | short | ||
vdu47 | short | ||
vdu48 | short | ||
vdu49 | short |
This is followed by a variable size table, terminated by the end of section indicator. In the builtin tracks, the maximum number of unknown values is about 50.
Field | Size | Description | |
Unk Table 50 | short | ||
Unk Table 51 | short | ||
Unk Table 52 | short | ||
Unk Table 53 | short | ||
Unk Table 54 | short | ||
Unk Table 55 | short | ||
Unk Table 56 | short | ||
Unk Table 57 | short | ||
Unk Table 58 | short | ||
Unk Table 59 | short | ||
Unk Table 60 | short | ||
Unk Table 61 | short | ||
Unk Table 62 | short | ||
Unk Table 63 | short | ||
Unk Table 64 | short | ||
Unk Table 65 | short | ||
Unk Table 66 | short | ||
Unk Table 67 | short | ||
Unk Table 68 | short | ||
Unk Table 69 | short | ||
Unk Table 70 | short | ||
Unk Table 71 | short | ||
Unk Table 72 | short | ||
Unk Table 73 | short | ||
Unk Table 74 | short | ||
Unk Table 75 | short | ||
Unk Table 76 | short | ||
Unk Table 77 | short | ||
Unk Table 78 | short | ||
Unk Table 79 | short | ||
Unk Table 80 | short | ||
Unk Table 81 | short | ||
Unk Table 82 | short | ||
Unk Table 83 | short | ||
Unk Table 84 | short | ||
Unk Table 85 | short | ||
Unk Table 86 | short | ||
Unk Table 87 | short | ||
Unk Table 88 | short | ||
Unk Table 89 | short | ||
Unk Table 90 | short | ||
Unk Table 91 | short | ||
Unk Table 92 | short | ||
Unk Table 93 | short | ||
Unk Table 94 | short | ||
Unk Table 95 | short | ||
Unk Table 96 | short | ||
Unk Table 97 | short | ||
Unk Table 98 | short |
Not all of these data are used in a track. The table is terminated as soon as an end of section indicator as follows is encountered.
Field | Size | Description |
0xffff | short | End of Table |
It seems that a section of padding null values follows immediately the end of table, to accomodate this section for having a fixed size. This is quite strange, though, as this would make the end of section indicator useless. Theories welcome!
The Jam Files section lists all the Jam files used for texture mapping in the game. Paths are relative to the GP2 home directory.
Offset | Size | Description |
- | short | Number of Jam Files |
_ | - | Null terminated paths to individual Jam File |
_ | - | ... |
_ | - | Null terminated paths to individual Jam File |
Thanks to Robert Kimber, we know that GP2 files are checksummed by two short numbers computed as described in the following table:
Field | Size | Description |
Checksum 1 | short | 16 least significant bits of the sum of the (size - 4) bytes from the file! |
Checksum 2 | short | Computed on the (size - 4) bytes from the file, left rotate checksum2 by three then add the next byte... |
Maybe you want to have a look at a sample source code to make it clearer. This shows how to retrieve and calculate a GP2 track file checksum.
This page was designed by Maxime Labelle.
Copyright © 1998. All rights reserved.