Skip to content

A builder guarding a factory is shown to help it build - #34

Merged
CubeB merged 1 commit into
revivalfrom
22-guard-assist-factory
Sep 11, 2026
Merged

CubeB merged 1 commit into
revivalfrom
22-guard-assist-factory

Conversation

@HectorBailey

Copy link
Copy Markdown
Collaborator

Closes #22.

What this is. The factory-build harness the issue asks for, in src/rwe/sim/guardassist.test.cpp: a plant with a build queue, a builder given a GuardOrder on it, ticked with the frame's buildTimeCompleted read each tick. Four cases:

  • the plant alone pays exactly its worker time, two points a tick, once the pad is open;
  • with the guard it pays five a tick, the guard's behaviourState is Building on the plant's frame, and the guard order is still standing afterwards;
  • the guarded build finishes in well under half the ticks of the unguarded one;
  • with two units queued, the guard is on the second frame after the first rolls off, and the second also goes up at five a tick.

Verdict on the report. Guard-assist works on the code path the report describes: handleGuardOrderbuildExistingUnitdeployBuildArm, which starts the guard's StartBuilding script like any other build job. No failing case found.

Two things worth knowing from writing it.

  • The fixture sets inBuildStance by hand on both units, since the empty COB script has no StartBuilding to set it. deployBuildArm does issue that thread on the guard route (line 4814), so a real builder gets it from its script.
  • The first draft stalled at 112 build points and looked, for a moment, exactly like the play-test report. Cause: updateResources recomputes a player's storage every second from the units that exist, and a yard with no commander and no storage is clamped to zero on the first second boundary. The plant in the fixture now carries storage and says why. If the original report came from a game with no commander left, that is a candidate explanation for what was seen.

Verified. rwe_test: all 556 test cases pass (71489 assertions), Linux gcc-14 Debug.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PJCbwC9MGZnM6erMDKptun

A play-test once said a guarding builder does not assist a factory, and
there was no fixture to ask. This is the fixture: a plant with a queue,
a builder guarding it, and the frame's progress counted tick by tick.
The plant alone pays its two points a tick; with the guard it pays five,
finishes in well under half the time, and the guard follows it on to
the next unit in the queue rather than standing idle once the first has
rolled off. No failing case was found.

The yard carries its own storage because the simulation recomputes a
player's capacity every second from the units that exist, and a yard
with no commander is clamped to nothing otherwise -- which stalls the
build and looks, for a moment, exactly like the report.

Issue: #22

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJCbwC9MGZnM6erMDKptun
@CubeB
CubeB merged commit 7ebea05 into revival Sep 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guard-assisting a factory build: no repro and no test

2 participants