Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traction Control Improvement #3188

Closed
whitespace-rebel opened this issue Oct 8, 2024 · 2 comments · Fixed by #3210
Closed

Traction Control Improvement #3188

whitespace-rebel opened this issue Oct 8, 2024 · 2 comments · Fixed by #3210

Comments

@whitespace-rebel
Copy link

Hi everyone,

I'm developing a high torque (660 Nm) RWD sports car, and it is really hard to drive with the keyboard even with traction control on.

The wheels push really hard especially in 3rd and 4th gear.
I looked into the code and realized that wheel slip is fixed at 25%, which is too high for this car.

In source/main/physics/BeamForcesEuler.cpp
you can see this: wheel_slip > 0.25f
It is used once for anti-lock braking and once for the traction control.

My suggestion is to make that 0.25 a variable.
In the .truck file we have the "TractionControl" settings where you can define the wheel slip, but currently it is unused.

Thank you!

@ohlidalp
Copy link
Member

ohlidalp commented Jan 9, 2025

Hi,

The docs link to specific commit which removed those, and it's by a programmer who was objectively good at tweaking the simulation for stability and reliability. I can't restore that slip parameter without potentially breaking older mods which have it but players rely on it being ignored. At the same time, there's multiple things that need research and tweaking (i.e. clutch calculation) and I'm not good with math and algorithms, so I need to figure out some flexible diagnostic/tweaking system.

TL;DR I will give you some means of changing that value, but not via truck format, that's too rigid, it will be via scripting.

ohlidalp added a commit to ohlidalp/rigs-of-rods that referenced this issue Jan 10, 2025
Allows advanced users to set physics settings directly, including some not accessible from rig-def file format.

In AngelScript, the actor (BeamClass) got 2 new methods:
```
    void setSimAttribute(ActorSimAttr attr, float val);
    float getSimAttribute(ActorSimAttr attr);
```
The set* function always logs _"[RoR|Actor] setSimAttribute: '{attr}' = {val}"_, where {attr} is the attribute name as string.

Currently, the available attributes only cover TractionControl:
```
    ACTORSIMATTR_TC_RATIO, //!< Regulating force, safe values: <1 - 20>
    ACTORSIMATTR_TC_PULSE_TIME, //!< Pulse duration in seconds, safe values <0.00005 - 1>
    ACTORSIMATTR_TC_WHEELSLIP_CONSTANT //!< Minimum wheel slip threshold, safe value = 0.25
```

Fixes RigsOfRods#3188 - The wheel slip constant was hardcoded since 57dfbba but now it's adjustable again. Note that this is possibly not the final solution and other wheelslip coefs may need to be added, i.e. ACTORSIMATTR_TC_WHEELSLIP_CURSPEED_RATIO which would emulate the way it worked in earlier versions. This is open for experimenting.
@whitespace-rebel
Copy link
Author

whitespace-rebel commented Jan 11, 2025

This is realy nice, I like this solution.

I also thought about this problem. The only solution I could come up with is a version parameter inside the .truck file.
So if VERSION >= 12345 then read the .truck file according to this version.

Will this patch land in the dev build? https://rigs-of-rods.itch.io/rigs-of-rods-dev
BTW the hash on that site doesn't correspond to any of the commits in the master branch. Is it up to date?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants