beyond-all-reason / beyond-all-reason/RecoilEngine
Exiting skid results in an instantaneous stop regardless of last speed during skid
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 683
- Forks
- 293
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
This line in UpdateSkid()
https://github.com/beyond-all-reason/RecoilEngine/blob/506700f61701567b9fcd34805c1b37d3dfa22f60/rts/Sim/MoveTypes/GroundMoveType.cpp#L1641
Is supposed to update oldPos so there is no huge gap between startSkidding pos and stopSkidding pos.
But, right after stopSkidding, on the next Update(), OwnerMoved() is called with owner->pos - oldPos as args:
https://github.com/beyond-all-reason/RecoilEngine/blob/506700f61701567b9fcd34805c1b37d3dfa22f60/rts/Sim/MoveTypes/GroundMoveType.cpp#L745C2-L745C132
And it does this:
https://github.com/beyond-all-reason/RecoilEngine/blob/506700f61701567b9fcd34805c1b37d3dfa22f60/rts/Sim/MoveTypes/GroundMoveType.cpp#L580C1-L585C42
Since oldPos was updated after the last skid-called owner->Move(); owner->pos - oldPos on the next frame is almost always null, unless there was some collision that displaced unit in addition to our Move().
The speed on Update() is then always set to 0.
I would suggest to place oldPos = owner -> pos; right before we move the unit via owner->Move(spd, true);
This will ensure owner->pos - oldPos points to the p(f-1) -> p(f) displacement vector consistently.
This successfully removes the abrupt stop when finishing skid.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read rts/Sim/MoveTypes/GroundMoveType.cpp at UpdateSkid(), OwnerMoved(), and the linked Update() call path. Verify that exiting a skid preserves the displacement-derived speed on the following update and no longer causes an instantaneous stop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100