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

CMoveMath::RangeHasExitOnly improvement

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

Description

I'm playing around with re-simulating demo files faster and made a benchmark loop where Claude generates promising engine patches and runs headless simulations to verify if there's a performance gain + whether unit states are the same.

I think one of them is worth submitting because it shows a significant improvement - 15% reduction in cpu instructions, measured on this 13min glitters game: https://www.beyondallreason.info/replays?gameId=4936896a8b258d038cbd28f55eb15ed2. I'm opening an issue first since that's what AI_POLICY asks for.

The idea:

RangeHasExitOnly scans a whole unit footprint for the EXIT_ONLY flag on every
collision query, but exit-only squares are written in exactly two places
(GroundBlockingObjectMap Add/RemoveGroundBlockingObject) and are therefore
sparse and clustered under factory yardmaps. Maintain a 16x16-square block grid
of exit-only counts in Set/ClearFlags and reject the scan fast when no
overlapping block holds one.

Let me know if I should open a PR with the changes

Contributor guide

Open the contributing guide

Research direction

Start by locating CMoveMath::RangeHasExitOnly and the two GroundBlockingObjectMap methods named in the issue; trace how EXIT_ONLY flags are set and cleared. Validate with the headless re-simulation benchmark, checking both the reported CPU-instruction reduction and unchanged unit states.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.