On this page
If you're reading this, you probably know that iRacing generates an incredible amount of data. From suspension travel to tyre carcass temperatures, the simulator models exactly what a real car would feel. But how do you actually get that data out of the game and into your own software?
At Sim RaceCenter, our AI Director relies entirely on this data to know when an overtake happens, when a pit stop goes wrong, or when a battle is brewing. In this post, we're opening the hood on our director-iracing extension to show you exactly how we read telemetry — and how you can do it too.
The Core Concept: Memory-Mapped Files
If you're a web developer, you might expect iRacing to expose a REST API or a WebSocket stream. It doesn't.
Instead, iRacing uses shared memory — specifically, memory-mapped files. When iRacing runs, it reserves a chunk of your computer's RAM and constantly overwrites it with the latest simulation data at 60Hz. Any other program running on the same PC can read that RAM address.
This is incredibly fast and uses almost zero CPU overhead, but it comes with a challenge: the data isn't neatly formatted JSON. It's raw binary C++ structs.
=======================================================================
THE SHARED MEMORY PIPELINE
=======================================================================
[ iRacing.exe ]
│ (Writes data 60 times a second)
▼
┌────────────────────────────────────────────────────────┐
│ Windows Shared Memory ("Local\\IRSDKMemMapFileName") │
│ │
│ ├── 1. Header (Tells you where the data is) │
│ ├── 2. SessionInfo (YAML text - Driver names, tracks) │
│ └── 3. Telemetry Buffers (Raw binary arrays) │
└────────────────────────────────────────────────────────┘
│ (Polls memory at 5Hz)
▼
[ Sim RaceCenter Director App (Node.js) ]
│
├── 1. Read Header Tick Counter
├── 2. koffi FFI parses C++ binary struct
└── 3. Convert to JavaScript Object
(e.g., { CarIdxPosition: [1, 4, 2...] })
Our Stack: Node.js and Koffi
Historically, reading iRacing telemetry in Node.js required writing C++ addons using node-gyp. This was a nightmare to maintain across different Windows versions and Node updates.
For the Director App, we use Koffi — a fast, pure-JavaScript FFI (Foreign Function Interface) module. Koffi allows us to define the C++ structs directly in TypeScript and pull the binary data out of memory without compiling any native code.
1. The Header and the "Tick"
Because iRacing is constantly overwriting the memory, you risk reading data right in the middle of an update, resulting in corrupted numbers. To solve this, iRacing maintains a tick counter in the memory header.
Our app reads the header, checks the tickCount, and if it has changed since our last read, we know fresh data is ready. We poll at 5Hz — five times a second — which is plenty fast for the AI Director to detect race events without burning unnecessary CPU cycles.
2. Session YAML vs. Live Telemetry
iRacing splits its data into two distinct parts:
| Part | Contents | Update frequency |
|---|---|---|
| SessionInfo | Track name, weather, driver names, car liveries — static or slow-changing | Only when session state changes |
| Live Telemetry | Speed, RPM, CarIdxPosition, CarIdxLastLapTime — the fast-changing binary arrays | 60Hz, indexed by CarIdx |
Our TelemetryReader parses the YAML once whenever the session changes, then maps the live binary telemetry arrays — indexed by CarIdx, which represents each car on track — to the driver names extracted from that YAML. The binary arrays and the session YAML are your join key.
3. Extracting What Matters
As we covered in our Publisher Integration post, iRacing outputs over 150 variables. To keep our memory footprint tiny, we only define the memory offsets for the 8 variables the AI actually cares about — position, pit road status, lap times, and flags.
By combining the YAML driver names with the binary CarIdxPosition array, we produce a clean, structured TelemetryFrame that feeds directly into the Event Detector.
Build Your Own: An LLM Prompt to Get Started
If you have any interest in software development, building your own iRacing telemetry tool is a great weekend project. You don't need to write FFI wrappers from scratch — the community has built excellent libraries, and LLMs are very good at wiring them together.
Copy and paste this prompt into ChatGPT, Claude, or Gemini:
I want to build a simple iRacing telemetry client. I will be running this
script on the same Windows PC that is running the iRacing simulator.
Please write a complete, runnable script using Python (with the pyirsdk
library) OR Node.js (with the node-irsdk-2021 library).
The script should connect to iRacing and print the player's current Gear,
RPM, and Speed to the console twice a second. Include instructions on how
to install the required libraries and how to run the code.
The LLM will generate a script that automatically connects to the memory-mapped file and handles the C++ struct unpacking for you. From there, you can tweak the code to save data to a CSV, trigger a Discord webhook when you win a race, or build a custom dashboard.
Happy hacking — see you on track.