1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.35 Bug Reporting thread
    Solutions and more information may already be available.

Engine Braking Calculations wrong?

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by DrWachoperro, Oct 12, 2023.

  1. DrWachoperro

    DrWachoperro
    Expand Collapse

    Joined:
    Apr 21, 2021
    Messages:
    1
    Hello! I'm trying to make an F1-style hybrid system, and it's mostly working, except the throttle mapping is a little bit broken because of the engine braking.
    I feel like that's actually one of the last things i have to fix to get it ready for release. I hope someone can help me, or tell me where to report this

    Setting the engine's maxPowerThrottleMap to 0 gives a 1:1 torque map, but the maths for engine braking have a weird behaviour.

    The maths in combustionEngine.lua are like this:
    engineMaxTorque = torqueCurve[rpm] - friction
    requestedTorque = torqueCurve[rpm] x throttle
    engineLoad = max( requestedTorque / engineMaxTorque, 1 )
    engineBraking = engineBrakeTorque x (1-engineLoad)

    That causes a problem because now the engine can reach 100% load before getting to 100% torque, because it is dividing torque over torque minus friction
    https://www.desmos.com/calculator/8n6hadq43q <- Here i plugged the data for a stock Sunburst engine @ 5000rpm aprox, and added the "fixed" version of the engineLoad calculation without the friction

    If i change line 712 from combustionEngine.lua to not substract the engine friction on the load calculation, then the throttle map is fully linear, and it works perfectly, but i would reeeealy prefer to not step over a main game lua file on my mod

    Is this expected behaviour? Should i not b*tch about a ~1% delta in my throttle mapping? Or should i actually try to invert all those equations to make a throttle map manually without touching the maxPowerThrottleMap?

    Thank you!
     
  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