Skip to content

A program to extract telemetry date from project cars 2 and Automobilista 2

Notifications You must be signed in to change notification settings

bobbythehuman/Project-Cars-2-Telemetry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Project-Cars-2-Telemetry

A Python project to receive and parse live UDP telemetry from Project CARS 2 (and Automobilista 2) and save it as JSON or display the data live.


Quick start

Prerequisites

  • Python 3.10+ (uses match/case syntax)
  • Optional packages: matplotlib (for live plotting) and binio (required by packet formatting)

Install dependencies (example):

python -m pip install matplotlib

Run the program

  1. Make sure your game is configured to send UDP telemetry to this machine's IP and port 5606 (default). PC listens on 0.0.0.0:5606.
  2. Start the program:
python mainProgram.py
  1. When you want to stop and export the captured data to JSON, type stop at the prompt. The program will write a file named like <timestamp>.json.

Note: the program listens on port 5606 by default. If you need a different port, modify the PCarsStreamReceiver(port=<your_port>) call in mainProgram.py.


Live display

To display live telemetry data as plots, you can use the LiveDisplay class in pcars2/extraModules.py. It is currently set up to plot the players world position.

What each file does

Top-level files

  • UDP_Definitions.hpp, projectcar1 UDP.hpp — C/C++ header dumps of UDP packet formats (reference only).
  • mainProgram.py — Example entrypoint. Starts the UDP listener, collects packets into a LatestData listener, and exports captured data to a JSON file when stopped.
  • extra info.txt — Links and references for related projects and packet specifications.

pcars2/ package

  • server.py — UDP server/receiver (class PCarsStreamReceiver). Listens on UDP, converts raw bytes into packet structures and dispatches them to listeners.
  • packets.pyctypes definitions of the raw packet binary structures (headers, telemetry, race, etc.).
  • digestion.py — Functions that transform ctypes raw structures into convenient Python objects/dicts.
  • enums.py — Enumerations for game/session/flag/tyre values used throughout the parser.
  • extraModules.py — Extra utilities (e.g., LiveDisplay for plotting telemetry using matplotlib, and removeObjects used to clean up data before JSON export).

Project CARS 1 UDP Telemetry Protocol

For information on the UDP telemetry protocol used by Project Cars 1, see projectcar1 UDP.hpp. I cant verify if the code or the data format in this repository works with Project Cars 1, but it should be possible with minor modifications.

For extra information on Project CARS 1 UDP telemetry, see:

Project CARS 2 UDP Telemetry Protocol

For information on the UDP telemetry protocol used by Project CARS 2, see UDP_Definitions.hpp. For extra information on Project CARS 2 UDP telemetry, see:

About

A program to extract telemetry date from project cars 2 and Automobilista 2

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published