You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Five military flavors for operations and Tactical AI
Hi folks,
This is a proposal to add five flavors into VP, gated by a modmod flag (or not?), to give grand/military/economic strategies more room to steer campaign-level (i.e., operation and tactical zone) and tactical-level (combat simulator) AI. It does not create any AI impact on its own, but rather creates room for modmods to experiment with them. For example, we can make a civilization under EmpireDefenseCritical (i.e., the homeland is significantly under threat) a major bonus on choosing defensive tactics and on holding cities, while reducing their tendency to launch any (likely fruitless) attack. Or we can make a nearly bankrupt civilization a major debuff on sacrificing units, as that only adds to their economic burden.
Below is an AI-written proposal (with my light revisions).
The five flavors
Flavor
Higher value
Lower value
FLAVOR_RISK
Prefer caution and avoid losses
Accept losses and exposure to press an advantage
FLAVOR_OCCUPATION
Get cities
Leave cities for other objectives
FLAVOR_ATTRITION
Kill enemy units
Give less priority to killing enemy units
FLAVOR_HOLD_CITY
Hold cities
Yield cities
FLAVOR_HOLD_GROUND
Hold territory and field position, resisting yielded ground
Yield territory when useful
The implemented capture baseline uses a fixed u8[5] array in the order RISK, OCCUPATION, ATTRITION, HOLD_CITY, HOLD_GROUND. Values range from 0 through 100, with 50 neutral. Risk is captured as the inverse of clamped stock offense, 100 - 10 * clamp(FLAVOR_OFFENSE, 0, 10); the other four slots are 50. The campaign carries a global vector and an empty masked per-civ override section, and each request carries its final vector. New tactical scoring remains future work.
Future values use signed contributions from active strategies, through the same mechanism as AIEconomicStrategy_Player_Flavors and AIMilitaryStrategy_Player_Flavors. Preserve whether risk was assigned, including an explicit zero, then resolve the contributions into the final 0 through 100 scale with 50 neutral. Explicit-versus-unset risk resolution and the other strategy producers remain future work.
How the values flow
Currently, with one exception (Offense), military AI is not impacted by flavors. We propose to add the flavors into the following subsystems. The baseline preserves existing behavior while the future producers and consumers are defined.
flowchart LR
GS[Grand strategy<br/>flavor modifiers] --> SUM
ES[Active economic strategies<br/>Player_Flavors] --> SUM
MS[Active military strategies<br/>Player_Flavors] --> SUM
LP[Leader personality] -. excluded .-> SUM
CS[City strategies] -. excluded .-> SUM
SUM[Future strategy contributions]
SUM --> OPS[Operations<br/>CvMilitaryAI]
SUM --> POST[Zone posture<br/>CvTacticalDominanceZone]
SUM --> RES[DLL tactical intent resolution]
STOCK[Stock offense] -->|baseline risk capture| RES
RES --> SIM[Combat simulator<br/>TacticalAIHelpers]
Loading
Proposed flavors tilt discretionary decisions
Operations (CvMilitaryAI::UpdateOperations)
flowchart LR
A[RISK] --> D1[Start an offensive?<br/>DoCityAttacks reserve and war-state gate]
A --> D4[Abort on losses<br/>UnitWasRemoved half-slot rule<br/>offensive ops only]
A --> D5[New: abandon an unpromising offensive<br/>next to the mechanical aborts]
O[OCCUPATION] --> D2[City attack vs pillage<br/>RequestCityAttack / RequestPillageAttack]
O --> D3[Target ranking<br/>ScoreAttackTarget]
H[HOLD_CITY] --> D3
Loading
Zone posture (SelectPostureSingleZone, then SelectPostureMultiZone)
Posture is currently chosen from territory type, overall and ranged dominance, melee balance, counterattack danger, and whether the zone city is in danger of falling. Flavors shift the thresholds for each stance. Below are AI generated examples, and I think more (programmatic) tweaking might be necessary.
flowchart LR
A[RISK] --> P1[caution ↔ hold position ↔ accept exposure<br/>withdraw over counterattack]
O[OCCUPATION] --> P2[surgical city strike]
H[HOLD_CITY] --> P3[hold cities and resist withdraw<br/>incl. multi-zone 'support a neighbor' override]
F[HOLD_GROUND] --> P4[resistance to yielding territory and field position]
T[ATTRITION] -. future enemy-unit destruction posture .-> P0[ ]
All five values are passed in explicitly, as the simulator does not read global flavor state.
flowchart LR
A[RISK] --> S1[unit-loss threshold, min HP to simulate,<br/>captured baseline preserves stock offense behavior]
O[OCCUPATION] --> S2[city damage and capture weights]
T[ATTRITION] --> S3[unit damage and kill weights]
H[HOLD_CITY] --> S4[value of holding cities]
F[HOLD_GROUND] --> S5[value of holding territory and field position]
Loading
Selected risk baseline
The baseline captures risk before calling the tactical simulator. It derives the existing loss and minimum-health thresholds from the stock FLAVOR_OFFENSE value through the inverse risk formula, preserving current behavior. Future explicit risk resolution and new scoring are deferred.
The other four baseline slots are neutral at 50. Future per-civ overrides retain presence masks so individual slots can inherit global values.
Minor Notes
Consider deterministic A* tie-breaking in CvAStarNode.h. Preserve total-cost and heuristic priorities, then define stable coordinate and stop-layer ordering shared by the DLL and simulator. Otherwise, the offline simulator cannot reproduce exact behaviors.
1. Mod version
5.4.6
2. Installed Components
Vox Populi with EUI
3. Additional mods used
N/A
4. Describe the Issue
Five military flavors for operations and Tactical AI
Hi folks,
This is a proposal to add five flavors into VP, gated by a modmod flag (or not?), to give grand/military/economic strategies more room to steer campaign-level (i.e., operation and tactical zone) and tactical-level (combat simulator) AI. It does not create any AI impact on its own, but rather creates room for modmods to experiment with them. For example, we can make a civilization under EmpireDefenseCritical (i.e., the homeland is significantly under threat) a major bonus on choosing defensive tactics and on holding cities, while reducing their tendency to launch any (likely fruitless) attack. Or we can make a nearly bankrupt civilization a major debuff on sacrificing units, as that only adds to their economic burden.
Below is an AI-written proposal (with my light revisions).
The five flavors
FLAVOR_RISKFLAVOR_OCCUPATIONFLAVOR_ATTRITIONFLAVOR_HOLD_CITYFLAVOR_HOLD_GROUNDThe implemented capture baseline uses a fixed
u8[5]array in the order RISK, OCCUPATION, ATTRITION, HOLD_CITY, HOLD_GROUND. Values range from 0 through 100, with 50 neutral. Risk is captured as the inverse of clamped stock offense,100 - 10 * clamp(FLAVOR_OFFENSE, 0, 10); the other four slots are 50. The campaign carries a global vector and an empty masked per-civ override section, and each request carries its final vector. New tactical scoring remains future work.Future values use signed contributions from active strategies, through the same mechanism as
AIEconomicStrategy_Player_FlavorsandAIMilitaryStrategy_Player_Flavors. Preserve whether risk was assigned, including an explicit zero, then resolve the contributions into the final 0 through 100 scale with 50 neutral. Explicit-versus-unset risk resolution and the other strategy producers remain future work.How the values flow
Currently, with one exception (Offense), military AI is not impacted by flavors. We propose to add the flavors into the following subsystems. The baseline preserves existing behavior while the future producers and consumers are defined.
Proposed flavors tilt discretionary decisions
Operations (
CvMilitaryAI::UpdateOperations)Zone posture (
SelectPostureSingleZone, thenSelectPostureMultiZone)Posture is currently chosen from territory type, overall and ranged dominance, melee balance, counterattack danger, and whether the zone city is in danger of falling. Flavors shift the thresholds for each stance. Below are AI generated examples, and I think more (programmatic) tweaking might be necessary.
Combat simulator (
TacticalAIHelpers::FindBestUnitAssignments)All five values are passed in explicitly, as the simulator does not read global flavor state.
Selected risk baseline
The baseline captures risk before calling the tactical simulator. It derives the existing loss and minimum-health thresholds from the stock
FLAVOR_OFFENSEvalue through the inverse risk formula, preserving current behavior. Future explicit risk resolution and new scoring are deferred.The other four baseline slots are neutral at 50. Future per-civ overrides retain presence masks so individual slots can inherit global values.
Minor Notes
CvAStarNode.h. Preserve total-cost and heuristic priorities, then define stable coordinate and stop-layer ordering shared by the DLL and simulator. Otherwise, the offline simulator cannot reproduce exact behaviors.