# LFS Replay Analyser

version 0.8
by Dick Alstein

## Introduction

LFS Replay Analyser (LRA) is a tool for analysing telemetry files from the Live For Speed racing simulator. It can help you to analyse your driving and your setup, and to compare your own laps with those of others. LRA can display all kinds of telemetry data, in several types of graph.

LRA is open source software, distributed under the GNU GPL.

### Features

Three graph types, multiple graphs
  You can open multiple graphs, to view several kinds of telemetry data in parallel. There are three types of graph:
  - Normal graphs plot their data against the car's distance in the lap. These graphs can not only plot the absolute values for each lap, but also the difference with some other lap. This is especially useful when you select "time" as data type: the time difference graph shows where you lose or gain time, compared to other laps.
  - XY plots allow you to select data types for both the X and the Y dimension. A well-known example of an XY plot is the traction circle, with the lateral G force in the X dimension and the longitudinal G in the Y dimension.
  - Histograms are the classical bar charts, with the range of data values in the X dimension. The graph also contains an indicator of the average value.
Track map
  The track map is the "radar" for the graphs. It shows which section of the lap is displayed in the graphs. A moving cursor reflects the position of the mouse, when it is above one of the graphs. This also works in the other direction: scrolling and zooming of the graphs can be changed by clicking or dragging the mouse inside the track map.
Driving line display
  A zoomable top-down map of the track shows the driving line for each loaded lap.
Synchronised selection of track section
  The graphs, the track map and the driving lines show data for a certain part of the track, which you can select by zooming the graphs. This selection is synchronised: the graphs and panes always show the same part of the track.
Custom "Open file" window
  The window presents a list of all your RAF files, and shows the main properties of each file: car, track, laptime, etc. You can also filter the list, so it shows only the files for a specific car and/or track.
Dashboard
  The "legend" pane not only shows the names of the laps you opened, it also contains the "dashboard": a set of gauges that show steer, pedals, gear and speed, for the point in the lap that is indicated by the track cursor.
Setup data retrieval
  Telemetry files contain several kinds of setup data, such as the settings for springs and dampers, and the gear ratios. LRA reads these settings, and displays them in the Properties pane.
Customisable panes
  The various panes - Legend, Track map, Driving line, and Properties - can be resized. You can also move them to another position inside the main window, by dragging its caption. You can even "float" them, i.e. detach them and place them in a separate window outside the main window.
Presets
  When you have positioned the graphs and panes to your liking, you can store them in a preset. Hotkeys and a toolbar enable you to switch quickly between the presets that you made.

## Getting started

### Installing

The easiest way to install LRA is by copying the ZIP file to a convenient folder on your hard disk, clicking the right mouse button on it, and selecting "Extract Here". This will unpack the program, the manual, and all other files. To start LRA, run the executable (lra.exe).

LRA needs the track data to display the track outline. This data is stored in PTH files, which must reside in subfolder "\data\smx" of your LFS installation. If you installed other analysers (AnalyseForSpeed or F1PerfView) you will already have these files. If not then you can download them from the main LFS site.

### Creating a RAF file

LRA reads the replay data from RAF files. To create a RAF file, watch a single player replay in LFS. (Analysing multiplayer replays is, unfortunately, not possible with LFS.) At any time during the lap before the lap you want to analyse, press Esc and click on "Output lap data", then type in a file name. LFS starts writing to the RAF file when the car enters the next lap; writing is completed when the car crosses the finish line. The filename is given the extension ".raf", and is stored in the folder "\data\raf" of the LFS installation.

### Opening the first RAF file

Select "Open" from the menu. In the dialog window that appears, click the "Folder" button to direct LRA to the "\data\raf" folder. After that, you will have a list of the RAF files that LFS wrote. Select one, and click the "Open" button.

### Uninstalling

To uninstall the program, remove the executable and the accompanying files. LRA stores the user preferences in the Windows registry, in key HKEY_CURRENT_USER\Software\LFS Replay Analyser. You can remove this data with a registry editor (e.g. regedit).

## Quick reference

### Telemetry data types

Name | Meaning
--- | ---
Speed | Car speed (in km/h or mph).
Time | Time since the start of the lap (in s). When you select this data type, the "Difference with" check-box is automatically switched on.
Rpm | Engine speed (in rpm).
Longitudinal G | Longitudinal acceleration (in g). A positive value means that the car is accelerating, with negative values the car is braking.
Lateral G | Lateral acceleration (in g). When the value is positive the car is turning right, when negative it is turning left.
Total G | Combined longitudinal and lateral acceleration (in g).
Slip angle | The angle between the direction of movement and the direction that the car's nose is pointing in (in degrees).
----- | -----
Steer | Steering input (in degrees).
Throttle | Throttle pedal (from 0 to 100%).
Brake | Braking pedal (from 0 to 100%).
Clutch | Clutch pedal (from 0 to 100%). Note: since S2 patch Y, the value has been inverted. Before this patch, a clutch value of 100 meant that the clutch was fully gripping, from patch Y on it means that the pedal is fully pressed (= not gripping at all.)
Gear | Gear (-1 = reverse, 0 = neutral, 1 = first, etc.)
----- | -----
Camber | Relative lean of the tyre to the road surface (in degrees).
Wheel angle | Steering angle of the wheel (in degrees), including Ackermann and toe.
Suspension travel remaining | Amount of vertical travel that is left before the wheel hits the bump stops (in mm).
Vertical wheel speed | Vertical speed (in mm/s). A positive value means that the suspension is being compressed, a negative value indicates a rebounding wheel.
Longitudinal tyre force | Force between tyre and road, in the driving direction (in N).
Lateral tyre force | Force between tyre and road, orthogonal to the driving direction (in N).
Tyre load | Vertical wheel force (in N). To be precise, this is the vertical force in the suspension, including the weight of the unsprung mass (see this forum post for an explanation).
Rotational wheel speed | The rotation velocity of the wheel, measured in km/h or mph.
Slip ratio | Relative difference between wheel speed and car speed. A value of -1 means that the wheel is blocked. A value above 0 indicates spinning wheels.
Power | The power dissipated at each wheel (in kW). This value will be positive for driven wheels, and negative under braking.

### Mouse operation

Window | Mouse action | Effect
--- | --- | ---
Graph | Click | Move track cursor (in Track map and in Driving line pane).
. | Drag | Select part of lap in X direction to zoom in on. (With Shift: in both X and Y direction.)
. | Double-click | Reset zoom.
. | Wheel | Scroll in X direction. (With Shift: in Y direction.)
. | Wheel + Ctrl | Zoom in/out in X direction. (With Shift: in Y direction.)
. | Wheel-click | Reset zoom.
Track map | Click | Move track cursor.
. | Drag | Select part of lap (= zoom graphs). (With Shift: modify current selection.)
. | Double-click | Select sector.
. | Wheel | Move selected part of lap (= scroll graphs).
. | Wheel-click | Reset zoom (= select whole lap).
Driving line | Click | Move track cursor. (With Ctrl: zoom in/out.)
. | Drag | Scroll view.
. | Double-click | Reset zoom (to default).
. | Wheel | Zoom in/out.
. | Wheel-click | Reset zoom.
Legend | Click | Show/hide this file.
. | Wheel-click | Show all files.

### Menus

Menu | Item | Effect
--- | --- | ---
File | Open | Close all currently loaded files, and open one or more new files.
. | Add | Add one or more files to the ones that are already loaded.
. | Add recent | Select a file to add, from a list of recently opened files.
. | Close all | Close all currently loaded files.
. | Exit | End the application.
View | Add graph | Add a graph (normal graph, XY plot, or histogram).
. | Panes | Show or hide a pane (legend, track map, driving line, properties, messages).
. | Crosshair | Show or hide a crosshair in graphs. The crosshair moves with the mouse pointer.
. | Reset | Reset zoom in all graphs.
. | Fit | Zoom and scroll the graphs so that the lap data that is shown uses the entire space.
. | Full screen | Toggle window size between normal and full-screen.
Presets | Save view as preset | Store the current configuration of graphs and panes as a preset. If you enter the name of an existing preset, you will be asked if you want to overwrite its definition with the current settings.
. | Delete preset | Delete an existing preset.
. | Show toolbar | Show or hide the presets toolbar.
Options | Units | Select the units to display speeds in (km/h or mph).
. | X rulers | Show or hide the rulers for the X axis.
. | Tooltips | Show tooltips on graphs, displaying the coordinates at the mouse pointer. The tooltips on the rulers show the units of measurement.
. | Status bar | Show or hide the status bar.
. | Restore session | At startup of LRA, re-load the graphs and files of the previous session.
. | Custom file dialog | Use the custom dialog for selecting RAF files, instead of the standard one.
. | Language | Select the language for the menus and screen texts in LRA.
Help | Manual | View this manual.
. | Visit LRA web page | Start the browser and go to the LRA thread on the LFS forum, to check for updates or to give feedback.
. | About | Show the application version.

## Known bugs and limitations

- LRA can not load RAF files from Autocross tracks.
- LRA can only find the track data for the tracks that currently exist (i.e. in LFS S2 patch X). If a later LFS version adds a new track or configuration, you will see the driving lines but not the track outline.
- Something similar holds for car codes (XFG, XRT, etc.): when a new LFS release adds a new car, you will see the name of the car type, but the car code will be "???".
- LRA can not show all setup data. The Properties pane contains all setup data that is present in the RAF file. LFS does not write the full setup to RAF files.

## Contact, license and other ramblings

- Updates to the program will be posted on the LFS forum.
- Constructive criticism, suggestions, bug reports etc. are much appreciated. You can post them on the LFS forum, send them to me by forum PM, or by e-mail.
- LRA is open source software, distributed under the GNU General Public License. A copy of the license is included with the distribution.
- LRA was programmed in C++, with the wxWidgets toolkit.

## Change log

### Version 0.8

New features:

- Editable track sectors. Sectors are saved for each track.
- Multiple languages possible. (Current distribution includes English and Dutch translations.)
- Hotkey F2 to hide/show all panes.
- Export lap data to CSV file (from context menu of legend).
- Export graph data to CSV file (from context menu of graphs).

Bugfixes:

- Tooltips on rulers were not switched by menu option.

### Version 0.7

New features:

- Buttons in the trackmap to select the track sectors. (These will be made user-editable in the next version.)
- Tooltips option shows the X and Y values in graphs, and the units in the X and Y axis.
- New data types: Wheel speed, Power.
- New wheel types: Delta F-R, Delta FL-FR, Delta RL-RR.
- Patch Y updates: recognises new car and track (Formula BMW FB02 and South City Chicane Route.
- When you add a new graph, the last graph is "cloned": the data type and other settings are copied to the new graph.

Bugfixes:

- Changing the data type often also changed the selected part of the track.
- "Open file" dialog also showed files from subfolders.

### Version 0.62

Bugfix: Application hangs after loading a file (under Vista).
Bugfix: Occasional crash when loading a file.
Choice of display names for files: filename, laptime, etc. Selectable from context menu in legend.

### Version 0.6

New features:

- Histograms.
- Dashboard.
- New data types: clutch, slip angle, vertical wheel speed.
- Presets toolbar. (Warning: old presets may not work anymore.)
- Menu items to move a graph up/down, and to make all graphs equal height.
- RAF file(s) can be loaded from the command line.
- Message log pane.

Modifications:

- Reorganised the listbox for data types.
- Changed keyboard shortcuts for presets to 0..9 (without the "Alt" key).
- Moved "auto-scroll" option to context menu of Driving Line pane.
- Removed menu items to zoom X in/out.

Bugfixes:

- Crash on RAF files from autocross.
- Loading files from different configurations of same track (e.g. BL1 + BL2) was allowed.
- Did not convert escape codes in player names.
- Incorrect storage of presets for "Suspension travel remaining".

### Version 0.5

XY plots (e.g. traction circle).
Resizeable graphs.
Button to rename RAF file in "Open file" dialog.
Added sector times to properties pane.
Scrollwheel-click in trackmap resets zoom.
Menu item to open manual in browser (only enabled if installed in same folder as lra.exe).
New data type: wheel angle.
Bugfix: Zoom was not reset when opening new files.

### Version 0.4

Custom "Open file" dialog.
New data types: lateral G, longitudinal G, and total G.
New wheel "types": average, min, and max.
Driving line pane is auto-scrolling (optional).
Distance-in-lap of crosshair is shown in trackmap.
Ctrl-click to zoom in/out in Driving line pane.
Bugfix: When adding graph, new graph is added at bottom. (NB: For existing presets this will reverse the order of the graphs.)
Bugfix: "Close others" function in legend didn't work correctly.

### Version 0.3

Presets added.
Legend displays values of graph at position of mouse pointer (if crosshair is switched on).
PTH files can still be found if RAF file not located in the standard folder (lfs\data\raf)
Bugfix: ratio of 7th gear of BF1 was incorrect (RAF files only contain gears 1 to 6).
Bugfix: gave an error message if PTH file was not found.

### Version 0.2

First released version.

### Version 0.1

Alpha preview version.