I was poking around the assetto corsa files and the ctelemtry files seemed interesting but I couldn't find any documentation for them. I was able to figure out the file format and wrote a script to parse it. I thought I'd document it here in case anyone wants to write tools to parse the files, or maybe even display them in content manager.
The file begins with a short header that contains the player name, track name, car name, track variation/layout name, and the lap time (in milliseconds). Following that, are a number of datapoints, each including your gear, some position/time value, speed (km/h), throttle %, break %.
Every .tc file seems to be the same size and have the same number of datapoints (3999), regardless of track length or lap time. I'm not sure if this means that the sampling is normalized (longer tracks/laptime less samples, shorter tracks/laptime more samples), or if the sample frequency is static and stored in a circular buffer, so that old data is lost. Assetto Corsa displays a `Km` value that goes from 0 to track length, which leads me to think it might be normalized but I don't know for sure.
I'm not sure what the position/time value represents. The values seem to increase from 0 to 1, but I haven't tried driving backwards to see what happens. In game on the graph screen, Assetto Corsa displays a
File format:
floats are in IEEE 754 format.
Proof of Concept:
can output the values in JSON or show a graph with matplotlib
Sample graph with matplotlib. Please forgive my metrics, I'm new
The file begins with a short header that contains the player name, track name, car name, track variation/layout name, and the lap time (in milliseconds). Following that, are a number of datapoints, each including your gear, some position/time value, speed (km/h), throttle %, break %.
Every .tc file seems to be the same size and have the same number of datapoints (3999), regardless of track length or lap time. I'm not sure if this means that the sampling is normalized (longer tracks/laptime less samples, shorter tracks/laptime more samples), or if the sample frequency is static and stored in a circular buffer, so that old data is lost. Assetto Corsa displays a `Km` value that goes from 0 to track length, which leads me to think it might be normalized but I don't know for sure.
I'm not sure what the position/time value represents. The values seem to increase from 0 to 1, but I haven't tried driving backwards to see what happens. In game on the graph screen, Assetto Corsa displays a
Km
value that increases up to the track length as you move your mouse from left to right. The track length isn't stored in the tc
file, so I think AC might lookup the track length and combine it with the position value to display the Km
value on that screen.File format:
Code:
+-------------------+-------------------+-----------------------+----------------------------+------------------------+
| 4 bytes | 4 bytes | sizeOfName bytes | 4 bytes | sizeOfTrack bytes |
| unknown | sizeOfName | Name string | sizeOfTrackName | TrackName string |
| | (integer) | (UTF-8 string) | (integer) | (UTF-8 string) |
+-------------------+-------------------+-----------------------+----------------------------+------------------------+
+-------------------+-------------------+-----------------------+----------------------------+------------------------+-------------------+
| 4 bytes | sizeOfCar bytes | 4 bytes | sizeOfTrackVariation bytes | 4 bytes | 4 bytes |
| sizeOfCar | CarName string | sizeOfTrackVariation | TrackVariation string | LapTime (milliseconds) | numDataPoints |
| (integer) | (UTF-8 string) | (integer) | (UTF-8 string) | (integer) | (integer) |
+-------------------+-------------------+-----------------------+----------------------------+------------------------+-------------------+
+-------------------+---------------------+------------------+-------------------+-----------------+
| 4 bytes | 4 bytes | 4 bytes | 4 bytes | 4 bytes |
| Gear | Position | Speed (km/h) | Throttle | Brake |
| (integer) | (float) | (float) | (float) | (float) |
+-------------------+---------------------+------------------+-------------------+-----------------+
| ... | ... | ... | ... | ... |
| Repeat for each datapoint (total numDataPoints times) |
+-------------------+---------------------+------------------+-------------------+-----------------+
Proof of Concept:
can output the values in JSON or show a graph with matplotlib
Proof of Concept for parsing Assetto Corsa tc files from the ctelemetry directory. Can output JSON or display a graph with matplotlib.
Proof of Concept for parsing Assetto Corsa tc files from the ctelemetry directory. Can output JSON or display a graph with matplotlib. - ac_tc_reader.py
gist.github.com
Sample graph with matplotlib. Please forgive my metrics, I'm new