beyond-all-reason / beyond-all-reason/RecoilEngine

Turn acceleration causes units to overshoot their heading

Open
#2,647 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 2h
Merged PRs (30d)
40

Description

Turn acceleration was added some time around 2014, back in the era when static unitdef keys were going out of fashion. I say this because you won't fine it in unitdefs, you need to do `Spring.SetGroundMoveTypeData(unitID, "turnAccel", turnAccel)`.

ZK removed turn acceleration as soon as it was added by setting turn acceleration to `1.2*turnRate` (experimentally determined). But I've started experimenting with it again and found that it causes units to overshoot their heading. This could be solved in a backwards compatible way via a key for decelleration, eg `turnDeccel`. Or perhaps it would be beneficial to have units start decelerating before they hit their desired heading. I have also observed units wiggle back and forth.

Here is a video demonstrating the issue. I dropped a gadget that makes units 20x longer into BAR to make it easier to capture: https://www.youtube.com/watch?v=6ZKFXe2YTr0

[unit_model_rescale.txt](https://github.com/user-attachments/files/23605290/unit_model_rescale.txt)

The video is with 2025.04.06, as the gadget stopped working in 2025.06.10. I was looking at BAR to check whether a game that has been using the feature had come up with a solution. I think there should be a solution that solves the extreme case, but my practical concern is that it was noticeable and outputting when I was playing around with reasonable values that I might otherwise want to use.

Here is reproduction with ZK shipheavyarty on 2025.06.10. The new animation interpolation features may be helping somewhat, but it is still noticeable.
Image

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by reproducing the overshoot and back-and-forth behavior with SetGroundMoveTypeData using turnAccel, then trace the unit turning and deceleration behavior; done means a reasonable turn-acceleration value no longer causes noticeable heading overshoot or oscillation while preserving existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.