# LFS Replay Analyser

version 1.1
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.
Get hotlaps from LFS World
  You can download RAF files from the hotlaps that are on LFS World, to compare them with your own. You can also download the replays; LRA will start up LFS to view them.
Replay of laps
  You can replay the laps in real time, inside LRA. Additionally, LRA checks if there is an SPR replay that contains the lap. If one is found, you can let LRA start up LFS to view the replay.
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 the 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. The recent versions of LFS include these files. If your installation seems to miss any, you can download them from the main LFS site.

To display the map of the track in the driving line pane, you need to download the bitmap images of the tracks from the LFS site (or by directly clicking this link). After downloading, copy the image files to the subfolder "bitmaps" of the LRA installation.

### 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.

### Downloading hotlaps from LFS World

In the "Open" dialog, go to the "LFS World" tab, select the desired car and track and click "Get List". You will first be asked for your LFSW Ident-key. This is an identification that LFSW requires. To get one, log in to LFSW and go to this page, follow the instructions, and copy the Ident-key to LRA. The key is stored with the LRA configuration data, so you normally need to enter it only once.

After LRA has retrieved the list, you can select one or more hotlaps and click "Open". The RAF files will be downloaded from LFS World, stored in the local RAF folder, and loaded by LRA.

### 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).
Drift angle | The angle between the direction of movement and the direction that the car's nose is pointing in (in degrees).
Elevation | Vertical position of the car (in m).
----- | -----
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.)
Handbrake | Handbrake input (from 0 to 100%).
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.
Replay | Play/Pause | Start or resume replaying.
. | Slower | Decrease the replay speed.
. | Faster | Increase the replay speed.
. | Reset speed | Reset the replay speed to 1.0.
. | Show toolbar | Show or hide the replay toolbar.
. | Auto-scroll | Automatically scroll when the replay reaches the end of the track selection.
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.
. | Language | Select the language for the menus and screen texts in LRA.
. | LFS World ID | Opens a dialog to enter the Ident-key, which you need for retrieving hotlaps from LFS World.
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.
- The player name sometimes contains weird characters. The changes in LFS to support more languages (patch Z) introduced a new encoding that has not (yet) been documented.
- LRA can not show all setup data. The Properties pane contains all setup data that is available 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 1.1

New features:

- Driving line pane can show a bitmap image of the track. (Read the installation instructions.)
- CSV export options.
- "Open file" window shows more attributes of laps.

### Version 1.0

New features:

- List the hotlaps on LFS World, and download the RAF files.
- Start LFS to view a replay. If needed, download them first from LFS World.
- Can read the cars and tracks from a configuration file.
- Properties pane shows sampling frequency of file. (RAF files from LFS World have 10Hz, RAF files you created in LFS have 100Hz.)

Bugfixes:

- Reversing the sort order in the "Open file" window only worked once.
- Renamed data type "Slip angle" to "Drift angle".

The option for the custom file dialog is now obsolete.

### Version 0.9

New features:

- Replay of laps.
- New data types: Handbrake, Elevation.

Bugfixes:

- Crashed when loading an incomplete lap.
- Now correctly loads RAF files from LFSW Hotlap Analyser (which have a different sample frequency).
- Now reads the ratio of the 7th gear from the RAF file.

### 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 F12 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.
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.