Add stranded soldier return-search addon#1929
Add stranded soldier return-search addon#1929DevOpsOfChaos wants to merge 4 commits intoReturn-To-The-Roots:masterfrom
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
| switch(ggs.getSelection(AddonId::STRANDED_SOLDIER_RETURN_SEARCH)) | ||
| { | ||
| case 1: return STRANDED_SOLDIER_RETURN_SEARCH_RADIUS_REDUCED; | ||
| case 2: return wanderTriesLeft > WANDER_TRYINGS_SOLDIERS ? WANDER_RADIUS_SOLDIERS : 2 * WANDER_RADIUS_SOLDIERS; |
There was a problem hiding this comment.
Can you add short comments for each case? The reason here is not clear.
Maybe add a (file-local) enum for the values instead of using 1,2,3
Logic is correct though: 2==double the attempts --> tries left = (1x, 2x] then normal radius, [0,1x] then double radius
Or I guess named values (e.g. enum) for the cases and a short description would help here. I.e. what was discussed: first default number of attempts use default radius, then doubles with each full attempt/try cycle.
| } | ||
|
|
||
| /// Radius used only for stranded soldiers looking for a return path to an own warehouse. | ||
| /// Normal worker wandering and non-soldier fallback behavior keep using WANDER_RADIUS. |
There was a problem hiding this comment.
Move the docstrings to the header please. Also what is "non-soldier fallback behavior" (opposed to "Normal worker wandering")?
|
@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 ;-) |
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