beyond-all-reason / beyond-all-reason/RecoilEngine
Builders making mobile units can get stucked in their build queue when the built unit was damaged and exited build range
- Dominant language
- C++
- Stars
- 679
- Forks
- 290
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
https://www.youtube.com/watch?v=5a5NkJTH0RQ
They want to repair, but don't want to leave their current position. They only add BP (repair) if the target is within range, and don't "FinishCommand" unless it is fully repaired.
https://github.com/beyond-all-reason/RecoilEngine/blob/0f6b0131e73bceb4eb312e67ee35d9976cec281a/rts/Sim/Units/UnitTypes/Builder.cpp#L357-L359
This makes the builder keep adding BP to a finished but not full hp unit, without relying on a different command.
But the target position, checked for build range, is still that of the initiale build cmd: the unit attempts to add bp at a different position, where the buildee isn't.
I figure there are multiple ways to dealing with that:
> use buildee->pos instead of cmd pos as soon as buildee was created as your move goal: a buildee moved mid build will be tracked by its builder (but followed to the edge of the world, so maybe add a leash?)
> don't change the goal pos; but add an escape method for buildProgress >= 1.0 AND hp < maxHP AND dist > buildRange3D that does FinishCommand()
> Finish command as soon as buildProgres >= 1.0, but spawn a repair command in front of queue, one which should not ever be repeated.
Contributor guide
Research direction
Start with rts/Sim/Units/UnitTypes/Builder.cpp at lines 357-359 and reproduce the build-queue scenario shown in the linked video. Compare the proposed handling for a completed but damaged buildee that has moved outside build range, then verify that the builder no longer remains stuck and its command queue progresses.
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
- 52/100