Hard Brake Detection Widget

Project Summary

The Assetto Corsa Hard Brake Detection tool is a mod for the Assetto Corsa racing simulator. The tool utilizes the Custom Shaders Patch modding platform to embed a UI widget into the game. When the widget is enabled, it hovers over the cockpit view of the driver and will detect if any of the brakes triggered by the driver were 'hard brakes'.

The widget can be installed through the Content Manager and accessed from the Widgets panel on the far-right side of the interface. Click the widget to enable it; it will then appear on the screen and display the hard-brake detection status.

This mod aids learner drivers to refine their braking in-between lessons or while access to a car is limited. It can also help experienced drivers to smooth out their braking in a safe low consequence environment, utilizing less energy for practice.

Development Highlights

  • Written the stream of telemetry state provided by the game to CSV for logging and offline test bed to probe the widget's algorithms without need for simulation to be up.

  • Built a CSV parser library in Lua for a batteries included no external dependency release.

  • Thoroughly tested every library added through LuaUnit.

  • Integrated the tool to utilise the Custom Shaders Patch (CSP) embedded Lua runtime rather than running the tool as a script adjacent to the simulation.

Technical Design and Constraint

The core flow here is:

  1. The plugin is installed and enabled to show on the game UI.
  2. Every frame that passes by the plugin checks for the brake being engaged.
  3. When brake is engaged, telemetry is sampled into the application state per frame until the driver releases the trigger on the brake.
  4. When the brake is released, we examine the telemetry sample to ascertain if it indicates a hard brake based on the speed drop, elapsed time, sample density, peak deceleration, and consecutive deceleration..
  5. The hard brake status is updated on the UI to show the result.

The plugin does require Custom Shaders Patch to be installed which provides the embedded Lua runtime, it cannot run on Assetto Corsa standalone without CSP installed.

Why did I write this mod?

My wife had begun learning how to drive and was taking up a few driving lessons in a week. In-between these lessons she would have time on her own to practice basic maneuvering and found it helpful to use the driving simulator setup we had installed at home.

Most driving sims lacked targeted small apps or features that would help learners in their journey as they were not designed with this intention. I thought to fill that gap and start by writing out a Lua widget that she could use to know if her braking is too harsh or not.

Braking isn't very properly portrayed by simulators as most of the feedback relies on having enough haptics installed into the seat and steering to convey the momentum shift in the vehicle. In simulators, it is almost purely just visual and not very telling, I leveraged in-game telemetry to determine when a brake is too harsh through physics instead which has proven to be of much benefit.

Demonstration

I have attached a demo video from the GitHub page below:

Current Progress

Current

AC-HardBrakeDetect can currently read telemetry samples from the simulation and provide prompt UI updates in realtime as well being able to enable debug logging to write telemetr samples down into CSV files providing a dataset for analysis and debugging in an offline environment.

Next Feature

Development has halted on this project but the next step is to provide a report of the driver's performance in a session after the game is exited, constructing detailed feedback for them to take to the next session and improve.