# rFactor 2

## Connection Method

**Shared Memory (Plugin)** — rFactor 2 uses the rFactor2SharedMemoryMapPlugin to write telemetry data to shared memory.

## Automatic Setup

1. Select **rFactor 2** as your source in DR Sim Manager.
2. Click the **Settings** icon (⚙) next to the source.
3. Click **Install rFactor 2 Telemetry Plugin** — this will automatically:
   * Copy the plugin DLL to rFactor 2's `Bin64\Plugins` folder
   * Create or update `CustomPluginVariables.JSON` with correct settings
4. Click **Check Installation** to verify everything is configured correctly.
5. Launch rFactor 2, go to **Settings > Plugins**, and enable **rFactor2SharedMemoryMapPlugin64**.
6. Restart rFactor 2.

## Manual Setup

DR Sim Manager uses the **rF2SharedMemoryMapPlugin** developed by The Iron Wolf:\
[GitHub Repository](https://github.com/TheIronWolfModding/rF2SharedMemoryMapPlugin)

The plugin DLL is packaged with DR Sim Manager.

### Installation Steps

1. **Copy the Plugin DLL**
   * Navigate to the DR Sim Manager plugins folder:

     ```
     C:\Users\UserName\AppData\Local\DRSimManager\Plugins\rFactor2
     ```
   * Copy the file:

     ```
     rFactor2SharedMemoryMapPlugin64.dll
     ```
   * Paste it into the rFactor 2 plugins folder:

     ```
     \rFactor 2\Bin64\Plugins\
     ```
   * For the Steam version, the default plugin path is:

     ```
     C:\Program Files (x86)\Steam\steamapps\common\rFactor 2\Bin64\Plugins\
     ```
2. **Enable the Plugin in rFactor 2**
   * Launch **rFactor 2**.
   * Go to **Settings**.
   * Under **Plugins**, enable the **rFactor2SharedMemoryMapPlugin64**.

Once enabled, DR Sim Manager should be able to read telemetry data from rFactor 2.

## Available Telemetry

rFactor 2 provides comprehensive telemetry through the shared memory plugin:

* **Orientation**: Pitch, Roll, Yaw
* **Acceleration**: Full 3-axis acceleration
* **Velocity**: Full 3-axis local velocity
* **Angular Velocity**: Full 3-axis rotation rates
* **Speed**: Vehicle speed
* **RPM**: Engine RPM
* **Gear**: Current gear
* **Suspension**: Multi-wheel suspension data
* **Vehicle Name**: Car name and class

### Telemetry Quality: ★★★★★

The rFactor2 shared memory plugin is one of the most mature and well-tested telemetry plugins available.

## Recommended Starting Settings

* **Primary Cue Gain**: 70–100%
* **Smoothing**: Low to medium
* **Washout**: Medium

## Known Quirks

* **Same plugin as Le Mans Ultimate**: rFactor 2 and Le Mans Ultimate both use the rFactor2SharedMemoryMapPlugin. If you play both games, install the plugin separately in each game's directory.
* **Must enable in Settings > Plugins**: Unlike some games, simply copying the DLL isn't enough. You must also enable the plugin inside rFactor 2's settings.
* **Mod content**: rFactor 2's extensive mod ecosystem means vehicle quality varies. Telemetry works with all content, but the quality of physics data depends on the mod's implementation.

## Troubleshooting

### No telemetry data

1. Verify the plugin DLL is in `rFactor 2\Bin64\Plugins\`.
2. Make sure the plugin is **enabled** in rFactor 2's Settings > Plugins.
3. Ensure you are driving on track (not in menus).
4. Use **Check Installation** in DR Sim Manager's settings to diagnose issues.
5. Restart both rFactor 2 and DR Sim Manager.

### Plugin not appearing in rFactor 2's Plugins list

* Make sure the DLL is in the `Bin64\Plugins\` folder (not `Plugins\` in the root directory).
* Some rFactor 2 installations may use a different path — verify your installation directory.

## Debugging the rFactor‑2/Le Mans Ultimate telemetry plug‑in

The *rFactor2SharedMemoryMap* plug‑in used by rFactor2 exposes a number of debugging switches via the `CustomPluginVariables.json` file (usually in `<SteamRoot>\steamapps\common\rFactor 2\UserData\player`). These control the amount of logging the plug‑in does and which parts of the game’s API it uses. The important flags are summarised below.

### Debug flags

* **`DebugOutputLevel`** – a bit‑mask specifying which severities are written to `UserData\Log\RF2SMMP_DebugOutput.txt`. The header defines the values: `Errors` (1), `CriticalInfo` (2), `DevInfo` (4), `Warnings` (8), `Synchronization` (16), `Perf` (32), `Timing` (64) and `Verbose` (128):contentReference\[oaicite:0]{index=0}. For example, a value of **15** (1 + 2 + 4 + 8) enables errors, critical info, developer info and warnings:contentReference\[oaicite:1]{index=1}. To capture only errors and warnings use **9** (1 + 8).
* **`DebugOutputSource`** – filters messages by origin. Each subsystem has a bit value: `General` = 1, `DMR` = 2, `Telemetry`/`MappedBuffer` = 4, `Scoring` = 8, `Rules` = 16, `MultiRules` = 32, `ForceFeedback` = 64, `Graphics` = 128, `Weather` = 256, `Extended` = 512, and input buffers (`HWControlInput` = 1024, `WeatherControlInput` = 2048, `RulesControlInput` = 4096, `PluginControlInput` = 8192):contentReference\[oaicite:2]{index=2}. Set this to the sum of the sources you need; `32767` enables all of them:contentReference\[oaicite:3]{index=3}.
* **`DebugISIInternals`** – when enabled, the plug‑in writes the raw `TelemInfoV01` and `ScoringInfoV01` structures to `UserData\Log\RF2SMMP_InternalsTelemetryOutput.txt` and `RF2SMMP_InternalsScoringOutput.txt`:contentReference\[oaicite:4]{index=4}. Useful for development, but the log files can be large.
* **`DedicatedServerMapGlobally`** – normally, shared‑memory buffers created on a dedicated server include the server process ID. Setting this to 1 causes the plug‑in to create its buffers in the global namespace so that clients running under other Windows accounts can access them. The server’s user account must have the “Create Global Objects” permission:contentReference\[oaicite:5]{index=5}.
* **`EnableDirectMemoryAccess`** – turns on the plug‑in’s *DMA* mode. When enabled the plug‑in reads additional state (message‑centre messages, global status, pit‑lane speed, etc.) directly from the game’s memory via `DirectMemoryReader`:contentReference\[oaicite:6]{index=6}:contentReference\[oaicite:7]{index=7}. It is off by default because memory scanning can be brittle; enable only if you need those extra fields.
* **`EnableHWControlInput`**, **`EnableWeatherControlInput`** and **`EnableRulesControlInput`** – these flags enable the corresponding input buffers.
  * `HWControl` lets external apps send limited control commands to the game (useful for pit‑menu interaction):contentReference\[oaicite:8]{index=8}.
  * `WeatherControl` allows an app to adjust the in‑game weather:contentReference\[oaicite:9]{index=9}.
  * `RulesControl` is experimental; it lets a client send rules inputs but may introduce timing issues:contentReference\[oaicite:10]{index=10}.\
    Only `HWControl` is enabled by default; the others must be set to 1 in the JSON file:contentReference\[oaicite:11]{index=11}.
* **`UnsubscribedBuffersMask`** – a bit‑mask that tells the plug‑in not to update certain output buffers. The values correspond to `Telemetry` = 1, `Scoring` = 2, `Rules` = 4, `MultiRules` = 8, `ForceFeedback` = 16, `Graphics` = 32, `PitInfo` = 64 and `Weather` = 128:contentReference\[oaicite:12]{index=12}. The default value of **160** (32 + 128) unsubscribes the Graphics and Weather buffers. Note that unsubscribing from `Scoring` disables the `PluginControl` input buffer:contentReference\[oaicite:13]{index=13}.

#### Recommended settings

For most users wanting to see **errors and warnings**, set:

```json
{
  "DebugOutputLevel": 9,
  "DebugOutputSource": 32767
}
```

This will log error and warning messages from all plug‑in components while avoiding verbose timing or performance data. Leave the other debug flags at their defaults unless you need the specialized functionality described above.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.departedreality.com/dr-sim-manager/general/sources/rfactor-2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
