Experimental Improved RPM Limiter: Build Boost on Two-Step

Discussion in 'Mods and Skins' started by MadDirtMonkey, Nov 28, 2020.

  1. MadDirtMonkey

    MadDirtMonkey
    Expand Collapse

    Joined:
    Oct 31, 2017
    Messages:
    10
    Improved RPM Limiter: Build Boost on Two-Step
    I made a few small tweaks to the games code so that turbochargers will build boost when on an ignition-cut rev limiter. It's super rough at the moment, but I have seen quite a few people asking for something like this so I thought I'd share it anyway.



    If you have a better understanding of the games Lua please have a look at what I've done and let me know if you have any suggestions - this was literally the first time I've ever looked at a Lua file ever. I am a software engineer by trade so I have a general idea of what I'm doing, but I probably spent less than an hour on this and most of that was just printing random variables to the console to figure out why the boost was dying in the first place.

    If you're unfamiliar with how RPM limiters work on real engines, they control the fuelling and/or the ignition of the engine in order to keep the RPM from exceeding a desired value.

    Soft-cut Limiters
    The RPM limiter you would find in most cars is usually referred to as a soft-cut limiter. These work by gradually removing fuel (and sometimes also retarding the ignition timing) as they approach the desired RPM. The result is a nice, smooth approach and once the target RPM is hit it remains there.



    Hard-cut Limiters
    Hard-cut limiters work slightly differently; when the target RPM is hit, they completely cut fuel or ignition until the RPM falls to a second, lower threshold, where it will then resume. If you stay on the throttle, this will cause the RPM to bounce off the limiter.

    Fuel vs Ignition Control
    Removing fuel from an engine means the air/fuel mixture is "leaner", and a lean mixture burns hotter. This is usually not too much of a problem, but with high-performance or modified engines that already get pretty hot it is often not desirable, so it is more common for them to instead control the ignition. This way, fuel is still injected into the cylinders regardless, which actually helps to cool the engine instead!

    The Problem
    Vehicles in BeamNG use various types of RPM limiters, but this mod only has any affect on one specific type - the hard-cut ignition limiter. You can identify this type of limiter by the popping and banging noise they make; this is the sound of unburnt fuel igniting after it has come into contact with the hot exhaust system.

    The game does a great job simulating all of this in almost every scenario, except for when a turbocharger is fitted.

    If you're not aware, turbochargers are a method of forced induction that use the exhaust gasses of an engine to spin a turbine, which is used to compresses air and force it into the cylinders. More air, bigger bang, more power.

    So, when you're sitting there bouncing off the limiter, explosions happening in the exhaust manifold and flames coming out of your exhaust pipe, what do you think the turbine inside the turbocharger should be doing? Well at the moment it just slows down, but what should really be happening is that those exhaust pulses from the unburnt fuel igniting should actually propel the turbine around, generating some boost even though the engine is under no load.

    Let's fix that.

    My Solution
    After a quick look through the games code I decided that the best approach would be to try to simulate the exhaust pulses that are caused by unburnt fuel igniting inside the exhaust manifold.

    In order to do this, I needed to add a new variable against the engine that I could use to store the magnitude of this exhaust pulse, and then use that when the "exhaust power" is being calculated.

    In real life, the amount of boost you build depends on how aggressive the limiter is (the ignition cut duration) and I wanted to try and simulate this too, so the magnitude of our exhaust pulse grows each time the ignition is cut by the limiter and we hear one of those pops, but it also naturally decays over time.

    Things I'm Unsure of (and would like people's thoughts on)
    There are three main pieces of information that I've just hardcoded in some rough numbers that seem to generally work for most vehicles, but I'm not sure if they should be fixed values like this, or calculated off of something else.​

    1. Pulse size (current value 4) - the size of each individual pulse, every time ignition is cut
    2. Decay rate (current value 0.1) - the rate that the exhaust manifold pressure decreases by over time
    3. Maximum cumulative exhaust pulse size (current value 40) - limits how big our theoretical exhaust pulse can get (should there even be a limit at all?)

    Installation and Updates
    1. Download the zip file attached to this post
    2. Copy it into your ..\Documents\BeamNG.drive\mods\ folder
    3. Enjoy!

    Changelog

    • Updated for v0.21
    • Updated for v0.22
    • Updated for v0.23
    • Updated for v0.24
     

    Attached Files:

    #1 MadDirtMonkey, Nov 28, 2020
    Last edited: Feb 25, 2022
    • Like Like x 15
    • Staff Pick Staff Pick x 1
  2. Brother_Dave

    Brother_Dave
    Expand Collapse

    Joined:
    Aug 16, 2012
    Messages:
    1,662
    Bruh, ive missed this so much. Here comes launches r us!! Btw, havent tried it yet since im not home..
     
  3. MadDirtMonkey

    MadDirtMonkey
    Expand Collapse

    Joined:
    Oct 31, 2017
    Messages:
    10
    I found out that I could package my mod up to be installed like any other mod (am big noob) so I have gone ahead and updated the attached .zip and installation instructions.

    I might see about trying to get it on the repo too at some point but I need to figure out if there's a clean way of handling compatibility issues. Because it replaces some standard game files, when the game is updated it would probably cause a load of issues if the mod isn't updated straight away too.
     
  4. SKB

    SKB
    Expand Collapse

    Joined:
    Apr 22, 2017
    Messages:
    1,964
    sorry if i bumped this but, it feels like the new update has this kind of system? i think. not sure tho
     
  5. Илья Каримов

    Илья Каримов
    Expand Collapse

    Joined:
    Apr 14, 2019
    Messages:
    41
    Good job! Simple, yet so useful.
     
  6. cheems_samurai

    cheems_samurai
    Expand Collapse

    Joined:
    Sep 28, 2020
    Messages:
    147
  7. Brother_Dave

    Brother_Dave
    Expand Collapse

    Joined:
    Aug 16, 2012
    Messages:
    1,662
    Anyone successfully used this in 0.21? I definitely need this in my life but couldnt get it to work by copying the zip to the mods filder.
     
  8. MadDirtMonkey

    MadDirtMonkey
    Expand Collapse

    Joined:
    Oct 31, 2017
    Messages:
    10
    Not yet sadly :(

    It has been updated for 0.21 and I've just double checked it is still working fine. What vehicle, ECU and RPM Limit Cut Time are you using? It could be that some of those values that I've guessed don't play nice with your particular setup.
     
    • Like Like x 2
  9. Brother_Dave

    Brother_Dave
    Expand Collapse

    Joined:
    Aug 16, 2012
    Messages:
    1,662
    I was using the track version of the sunburst :) Ill give it another try, mightve messed smthn up on my end too. Need this in my life.
     
  10. Cecaka

    Cecaka
    Expand Collapse

    Joined:
    Mar 9, 2021
    Messages:
    1
    for its not working when i spawn a car its says that i have corrupted mods(data) or something else. so idk
     
  11. SKB

    SKB
    Expand Collapse

    Joined:
    Apr 22, 2017
    Messages:
    1,964
    ... probably means that you have corrupted mod files. /s

    you might want to check for any conflicting mods, or redownload the file and try again. :)
     
  12. MadDirtMonkey

    MadDirtMonkey
    Expand Collapse

    Joined:
    Oct 31, 2017
    Messages:
    10
    I've just double checked, currently this mod still works fine so it must be something else you've got installed, sorry I can't be more help!
     
  13. default0.0player

    default0.0player
    Expand Collapse

    Joined:
    Nov 30, 2018
    Messages:
    1,926
    Interestingly, before the vivace update, all DCTs could and would build boost when launching. The update where the devs said that it improves the stall prevention, and they disabled the launch logic by adding this in "shiftLogic-dctGearbox.lua" in line 578 to 580
    Code:
      if (M.throttle > 0 and M.brake > 0 and electrics.values.wheelspeed < 2) or gearbox.lockCoef < 1 then
        dctClutchRatio = 0
      end
    Delete it, then you can launch at full boost
    The launching logic is always there at line 558~ 567, the vivace update simply added another logic(above code) to override it
    Code:
      local dctClutchRatio = 0
      if abs(gearIndex) == 1 and M.throttle > 0 then
        local ratio = max((engine.outputAV1 - clutchHandling.clutchLaunchStartAV * (1 + M.throttle)) / (clutchHandling.clutchLaunchTargetAV * (1 + clutchHandling.clutchLaunchIFactor)), 0)
        clutchHandling.clutchLaunchIFactor = min(clutchHandling.clutchLaunchIFactor + dt * 0.5, 1)
        dctClutchRatio = min(max(ratio * ratio, 0), 1)
      else
        if gearbox.outputAV1 * gearbox.gearRatios[gearIndex] * engine.outputAV1 >= 0 then
          dctClutchRatio = 1
        end
        clutchHandling.clutchLaunchIFactor = 0
      end
     
  14. MadDirtMonkey

    MadDirtMonkey
    Expand Collapse

    Joined:
    Oct 31, 2017
    Messages:
    10
    Updated for v0.22
     
  15. MadDirtMonkey

    MadDirtMonkey
    Expand Collapse

    Joined:
    Oct 31, 2017
    Messages:
    10
    Updated for v0.23, please redownload and replace the zip with the newest version.
     
  16. smokes071212

    smokes071212
    Expand Collapse

    Joined:
    Mar 15, 2023
    Messages:
    1
    has anybody looked into changing the how the 2step is used like instead of using the brake and the gas possibly using the transbrake and gas instead? anh info would be appreciated
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice