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

Clamp or reject large heading-based unit defs

Open
#3,353 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

See the comments in #3342. Apparently a large enough value for defs that deal with heading (for example, turn rate) creates UB.

This is a pitfall for gamedevs who are going to input values like 99999 to get instant turning and be none the wiser, so it would be good to sanitize them somehow. Exactly how is up to debate.

Sounds best to clamp these to the effective maximum. The alternative of rejecting would require the game dev to figure out the maximum anyway, but it's not necessarily even constant since it's derived from other values like sim frame rate.

Contributor guide

Open the contributing guide

Research direction

Start with the comments in issue #3342 and trace the heading-based unit definitions, such as turn rate, that can produce undefined behavior for large values. Determine the effective maximum from the related simulation values and decide whether clamping or rejection fits the existing behavior. Done means large inputs no longer trigger UB and the chosen behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.