Add stranded soldier return-search addon#1929
Conversation
|
Thinking about this, would it make sense to make the time also dependent on the range? So they first search in the default range (until they would die) then they search in the 2x range (until they would die again) and then in the 4x range (but this time they die). |
|
Good point. I made the option names explicit and added a reduced 0.5x (range 7) setting. Default remains the first option, so the current behavior is unchanged unless a different option is selected. Validation passed locally with clang-format 10.0.0, AttackSuite, and BuildingSuite. I also agree with the staged search idea. The current update only makes the fixed options clearer and adds the 0.5x setting. I’ll take another look at changing the larger-range behavior into a progressive search instead: start with the default range first, then escalate to 2x and 4x before the soldier finally dies. That seems like the better gameplay behavior than applying the larger radius immediately. |
Done. I changed the larger options to staged escalation instead of applying the larger radius immediately.
The reduced |
25cf29a to
1810a42
Compare
|
@Spikeone fine with the current solution? |
Sounds good to me - sadly no 0x option, but that idea may have been a bit over the top, so 👍 |
Like "die immediately"? Yeah, too much for me too ;-) |
1810a42 to
50b3573
Compare
|
Done, I cleaned up the staged search logic without changing behavior. The selection values now have names, and the 1x/2x/4x escalation cases have short comments. I also moved the helper documentation to the header and clarified that normal worker wandering is unaffected. I have not tested this manually in a real game yet, only through the targeted regression tests and affected integration suites. Validation:
|
Summary
This adds an optional
STRANDED_SOLDIER_RETURN_SEARCHaddon.The addon controls the fallback search behavior used by stranded soldiers when they are wandering and looking for a reachable own flag with a warehouse connection.
Default behavior is unchanged.
Motivation
When soldiers lose their target or warehouse route, they may start wandering and eventually die if they do not find a reachable own flag with a warehouse connection.
This addon provides optional control over that fallback search behavior:
The change is limited to stranded soldiers. Workers and normal routing behavior are not affected.
Options
The addon keeps four explicit options:
Default search range (1x): keep the existing soldier search radius and normal soldier try countReduced search range (0.5x): use a smaller fixed search radius for a stricter/harder settingExtended search range (2x): first search with the default range, then escalate up to 2x before dyingVery large search range (4x): first search with the default range, then 2x, then escalate up to 4x before dyingThe default option remains the first option, so existing gameplay behavior is preserved unless another option is selected.
Implementation details
This PR adds a new addon:
AddonStrandedSoldierReturnSearchAddonId::STRANDED_SOLDIER_RETURN_SEARCH = 0x01100001011 DevOpsOfChaosThe selected option is treated as the maximum stranded-soldier return-search escalation stage:
0: 6 tries, fixed radiusWANDER_RADIUS_SOLDIERS1: 6 tries, fixed radiusWANDER_RADIUS_SOLDIERS / 22: 12 tries totalWANDER_RADIUS_SOLDIERS2 * WANDER_RADIUS_SOLDIERS3: 18 tries totalWANDER_RADIUS_SOLDIERS2 * WANDER_RADIUS_SOLDIERS4 * WANDER_RADIUS_SOLDIERSThe radius is only used when soldiers are already in the wandering fallback state and are searching for an own flag that can lead back to a warehouse.
The staged behavior uses the existing
wander_tryingsstate. No new serialized fields are added.Scope / safety notes
This PR intentionally keeps the behavior limited:
A stranded soldier still has to find:
The addon only changes the local search radius and number of wandering search attempts used for this fallback situation.
Validation
Built locally with Visual Studio 2022 / Debug:
cmake --build .\build-vs-x64-debug-local --config Debug --target Test_integrationRan targeted validation:
Test_integration.exe --run_test=FigureTests/StrandedSoldierReturnSearch* --report_level=shortTest_integration.exe --run_test=AttackSuite --report_level=shortTest_integration.exe --run_test=BuildingSuite --report_level=shortRan full integration ctest:
ctest --test-dir .\build-vs-x64-debug-local -C Debug -R "^Test_integration$" --output-on-failureStyle / whitespace validation:
git diff --check