Make suspension damping independent of the tick rate - #342
Open
Sycatle wants to merge 1 commit into
Open
Conversation
lastSpringOffset - offset is a difference of positions between two calls, not a rate, so the damper force is missing a division by dt. The same suspension is therefore damped half as much at 66 tick as at 33, with nothing telling whoever tuned the vehicle. Dividing by dt and scaling back by a reference interval of 1/33 keeps the force exactly as it is today at the default tick rate, so every published springDamper value keeps its meaning, and only the dependence disappears.
Owner
|
Please note that the default tickrate in Gmod is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #341.
The change
with
DAMPER_REFERENCE_DT = 1 / 33.Dividing by
dtturns the position difference into a rate, which is what a damper needs. Multiplying by the reference interval scales the result back so that at 33 tick the force is exactly what it is today, and every existingspringDamperkeeps its meaning.What disappears is the dependence: a server at 66 tick now gets the same damping as one at 33, where before it got half.
Choosing the reference
33 is the GMod default and the rate almost every published vehicle was tuned against. Any other choice silently retunes the whole ecosystem, which is the outcome this PR exists to avoid. The constant is named rather than inlined so the decision stays visible — and so it is one edit if you disagree with the value.
How to see it
Drive a vehicle over the same bump at 33 and at 66 tick and compare the rebound. Before this change they differ; after it they should not. That difference is the clearest way to see the defect itself.
Known issues
I have not driven every vehicle class through this, and suspension feel is subjective — if any vehicle feels different at 33 tick after this patch, that is a bug in it and I would want to know.
Touches the same file as #336 and #340, so they will conflict textually if several are taken; they are independent in substance.