Modelling part-throttle torque curves in BeamNG.drive

PhysicsSpotlight

Greetings, motorists!

Today we wanted to share with you the evolution of the part-throttle torque curve calculation methods we developed over the years.

First of all, why is this topic important?

An accurately modeled torque curve has a significant impact on a vehicle’s handling characteristics and defines how the throttle inputs of the driver get translated into actual engine power and, as a result, offers players far more granular control over their vehicle. For instance, it assists players with handling of vehicles with very powerful engines when accelerating out of corners and delivers a more realistic response during low-speed maneuvers (leaving pit area, parking, etc.).

As most of you already know, the pursuit of realism is at the core of our development principles and we constantly work on implementing more advanced methods for calculating different aspects of the simulation. Back in 2016 we were able to achieve a model that better mimics the behavior of real-world engines, and we wanted to share our journey with everyone while we work on polishing this model. Our upcoming improvements were inspired by Niels Heusinkveld’s research into the topic, which he discussed in the following videos. We would like to thank Niels for his comprehensive investigation and valuable suggestions!

In essence, there are several approaches that videogames utilize for these calculations. Each method has its benefits and drawbacks. We’ll try to explain how they differ from one another and which ones we considered and ultimately chose to use. The goal of this article is to present a technical overview of how BeamNG models the torque response to partial throttle inputs and the expected outcomes of our methodology.

Pre-defined Method

Let’s start with the pre-defined approach. Within this method, game engine utilizes manually defined or precalculated LUTs (or look-up-tables) that map certain inputs to outputs instead of calculating the values in real-time. This can be used on various aspects of the game to perform required transformations on the data. In this article, we will explore how game developers apply this concept to implement torque curves and their correlation to throttle input.

In real-world situations, it is possible to collect empirical data of any given vehicle through dyno testing, road tests, or obtain it directly from the vehicle manufacturers or race engineering teams. Once this data has been gathered, it can be used to produce a LUT that will be used by the game’s powertrain subsystem to accurately replicate the performance of the corresponding vehicle. An important additional benefit of this method is that since the values are pre-computed and not calculated in real-time, it may result in faster and less resource-intensive outcomes, while being easier to implement on the programming side.

However, from the production perspective, this can be a very expensive and time consuming effort, as every table has to be hand-crafted and optimized for every vehicle, engine type, input value, and any interaction that may be present in a given simulation. Consequently, this strategy is not suitable for all games, not to mention that for some types of vehicles it is impossible to obtain such data. As we do not license real-life brands for our vehicle lineup, this would not be ideal for BeamNG either. We do, however, utilize empirical data and LUTs to model the fundamentals of our torque calculations, which we will discuss later.

Physics-based Modeling

In an ideal scenario, the game engine could be developed with an unlimited level of complexity, and the simulation of the vehicle engine would be intricately comprehensive, including not only basic attributes but also other elements such as engine specifications, fluid/air flow dynamics, aerodynamics, temperatures, and so on.

An interesting example of this sort of simulation is covered in AngeTheGreat’s video here:

In comparison to the previously discussed pre-defined methods, this provides for a far greater level of detail and flexibility, resulting in a more accurate and realistic driving experience. In such simulation the performance of the vehicle is no longer defined by static curves but rather takes into account the complex and dynamic interactions of real-world engine behavior.

Regrettably, we do not yet live in a post-scarcity society where everyone has the luxury of infinite hardware resources, so we must be mindful of how each aspect of the simulation will impact the game’s performance, and make compromises when appropriate.

Hybrid Approach

While we initially considered utilizing basic input LUTs in the early stages of BeamNG’s prototyping, and are still on the look-out for an optimal physics-based model, we ultimately decided on a hybrid approach.

As we mentioned earlier, at the fundamental level our torque curves are hardcoded into each vehicle’s data. If you take a look at a vehicle engine’s jbeam file, you can see for yourself the LUT that is used to determine the relationship between torque and RPM values at full throttle, such as:

    "torque":[
        ["rpm", "torque"],
        [0, 0],
        [500, 165],
        [1000, 295],
        [2000, 396],
        [3000, 435],
        [4000, 395],
        [5000, 338],
        [6000, 257],
        [7000, 200],
        [8000, 85],
    ],

During the development phase of the vehicle, we utilize some publicly available empirical data as a reference for these values, although we do not have direct collaboration with vehicle manufacturers.

As a starting point, we use this data and, like many other components of our simulation, we opted to model the resulting part-throttle torque curves for different throttle inputs as a real-time mathematical model. This allows us to balance the accuracy of the pre-defined method with the flexibility of a physics-based approach. On top of those calculations, we’ll then add various physically based calculations (such as turbo behavior, if present, or damage and wear based loss of torque, loss of power at altitude in mountain roads, and so on).

Evolution of the Model

Our initial model, developed back in 2013, was rather simplistic, and produced results that don’t really correlate with real-life vehicle performance. The model was basic in nature and consisted of merely scaling the entire torque curve by the throttle value.

In practice, this means that the vehicle is difficult to operate because of its unpredictable behavior. A driver may need to apply excessive throttle inputs to achieve a specific torque output, which in some cases may even result in the vehicle remaining still at very low throttle input values.

In 2016 we developed a new model that we call “constant power” model. The main objective of this approach was to allow the throttle pedal to scale the output of power rather than torque, with the aim of creating a more realistic part-throttle torque curve.

Within this method, the equation’s fundamental inputs are the maximum overall power of the engine, the max torque value at the current RPM, current RPM itself, and of course the throttle input value. The throttle controller then utilizes these values to maintain a steady power output, which improves the overall driveability by providing a more consistent and controlled acceleration. We should emphasize that the power output in this model is not exactly constant but rather a general approximation that will still vary, especially at higher throttle inputs, to keep the math performant enough.

In the upcoming version of BeamNG several more tweaks were implemented in this model which should improve the consistency and reduce sudden changes in engine behavior.

As a result of the transition to the new model in 2016 we were able to considerably improve the maximum attainable torque for a given throttle input. In real-world scenarios, the max torque curve is not linear and instead varies with the throttle input. Our 2013 model produced only a straight, linear curve in this context. The new model generates far more realistic results as well as an increased level of detail. This nuanced variation in torque output influences the vehicle’s behavior and performance, allowing the driver to carefully control its acceleration and overall speed.

We are continuously refining the simulation, and eagerly working towards polishing the model further to optimize the shape of the part-throttle curves and improve engine braking behavior. While we are making progress, it is important to note that we are taking a cautious approach and at this time, we cannot provide a specific timeline for these improvements. Stay tuned for further updates!

PhysicsSpotlight

BeamNG Major Updates

Sprouting Makeovers in BeamNG.drive v0.32
BeamNG.drive v0.32 release highlights
Festive Freight in BeamNG.drive v0.31
BeamNG.drive v0.31 release highlights
Gear Up for Fall Adventures in BeamNG.drive v0.30
BeamNG.drive v0.30 release highlights
Gambler 500 x BeamNG.drive - v0.29
BeamNG.drive v0.29 release highlights
Spring Renovations - BeamNG.drive v0.28
BeamNG.drive v0.28 release highlights
Conquer the desert in v0.27
BeamNG.drive v0.27 release highlights
BeamNG.drive v0.26 - Covet the Moment
BeamNG.drive v0.26 release highlights
BeamNG.drive v0.25 - Spark Your Passion
BeamNG.drive v0.25 release highlights
Festive Update v0.24.1 Released
BeamNG.drive v0.24.1 release highlights
The 2021 Winter Release – BeamNG.drive v0.24
BeamNG.drive v0.24 release highlights
The 2021 Summer Release – BeamNG.drive v0.23
BeamNG.drive v0.23 release highlights
The 2021 Spring Release – BeamNG.drive v0.22
BeamNG.drive v0.22 release notes
The 2020 Winter Release – BeamNG v0.21
BeamNG.drive v0.21 release notes
The 2020 Summer Release – BeamNG v0.20
BeamNG.drive v0.20 release notes
“La Vie à Toute Vitesse” – BeamNG.drive v0.19
BeamNG.drive v0.19 release notes
The 2019 Winter Release – BeamNG.drive v0.18
BeamNG.drive v0.18 release notes
Buckle up, heavy traffic ahead: Update 0.17 released
BeamNG.drive v0.17 release notes
Electrifying 0.16
BeamNG.drive v0.16 release notes
A Small Car on a Big Map – Version 0.15 released
BeamNG.drive v0.15 release notes
Light Runner – Version 0.14 Released
BeamNG.drive v0.14 release notes