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

Units on MOVESTATE_HOLDPOS are bad at chasing manually attacked targets.

Open
#978 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 1h
Merged PRs (30d)
38

Description

https://github.com/beyond-all-reason/spring/blob/587058587e0fe908070382d25ad5a9fdff2ce572/rts/Sim/Units/CommandAI/MobileCAI.cpp#L719

When a unit on MOVESTATE_HOLDPOS is told to attack a moving target, `StopMove()` is called as soon as a weapon is in range. However, the target is continuing to move, and moves out of range immediately.
This causes undesirable stop and go behavior when a unit is told to attack a similar speed unit.
The player expected behavior is for the unit to maintain speed with the target when given an explicit attack command.
`const bool canChaseTarget = (!owner->unitDef->stopToAttack) && (!tempOrder || (owner->moveState != MOVESTATE_HOLDPOS))`

Adding an additional check for `tempOrder` ensures that a user given attack command will cause a unit to properly pursue a target, while auto-acquired targets while in `MOVESTATE_HOLDPOS` are not chased.

Contributor guide

Open the contributing guide

Research direction

Start in rts/Sim/Units/CommandAI/MobileCAI.cpp around line 719 and trace how MOVESTATE_HOLDPOS, tempOrder, canChaseTarget, and StopMove() interact during an explicit attack. Confirm that manually ordered attacks keep pursuing moving targets while auto-acquired targets in hold position still stop; the issue is done when this behavior is preserved without unwanted chasing.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.