(6-CP) Remove Random Factor from Unit Capture

Status
Not open for further replies.

azum4roll

Lost the game
Joined
Jul 17, 2018
Messages
4,013
Location
Somewhere
Current unit capture mechanic:
If a melee attack kills an enemy of the same domain, and the attacker can capture units, and the defending plot only has one enemy unit that can defend (only possible to have more than one with a naval + land unit stack):
If defender cannot be captured (there's a promotion column for that), chance is 0.
Otherwise, chance = (10 + (attacker base CS / defender base CS) * 40)%, capped at 80% when attacker is 1.75x stronger.

Problems:
It's random where your melee attacker will end up in after dealing a killing blow. The human player always needs to account for both cases.
Sometimes it's better to NOT capture a unit and you want to advance the attacker (for Overrun or Blitz units), but this mechanic doesn't let you choose.
The AI doesn't know about unit capture at all, and will need to re-evaluate their tactical plan every time it happens since the attacker is not at the expected position.
You can prevent your naval units from being captured by putting a land unit on the same tile (Embark, Polder), and vice versa (ship in a Canal/Polder). It's a consistent way of blocking unit captures.

Proposed unit capture mechanic:
If a melee attack kills an enemy of the same domain, and the attacker can capture units:
Loop through all 6 tiles around the defender, count how many of them are enterable by the defender.
The function used is CvUnit::canEnterTerrain with MOVEFLAG_NO_EMBARK and MOVEFLAG_DESTINATION. Water is always considered unenterable for land defender in this case.​
Notably this blocks CS units from entering barbarian encampments, but it's uncommon that this would affect the capture result.​
Also disregards whose territory these tiles belong to, and if the tiles already have units.​
Count how many enemies are surrounding the defender.
The function used is CvPlot::GetNumEnemyUnitsAdjacent, which is also used in flanking. Exclude embarked units.​
Surround% = Number of surrounding enemies / Number of enterable adjacent tiles
If there's 1 military unit on the defending tile, the unit is captured if Surround% >= 50%.
If there are more than 1 military unit on the defending tile, the defending unit is captured if Surround% >= 50%. Other units on the tile are forced to retreat, or instantly killed if retreat isn't possible.
Rationale: if the other units can't retreat, they're very surrounded (or frail in the case of embarked) and would likely die anyway.​
Other changes:
The combat simulation UI is updated to show whether the defender will be captured when killed.
If possible, teach the AI about this.
AI already utilizes flanking + ZoC and likes to surround enemies, thus can easily trigger unit capture.​
Not relying on the RNG means AI can pre-simulate unit captures, which has the additional benefit of reducing the need of re-evaluations.​

Examples:
Defender is a land unit surrounded by 6 non-mountain land tiles. The attacker needs to surround it with 3+ units to capture it.
Defender is a non-Incan land unit surrounded by 2 mountain tiles and 4 normal land tiles. The attacker needs to surround it with 2+ units to capture it.
Defender is a Galley on a thin strip of coast tile. A Spearman (of the same player) is embarked underneath the Galley. Any melee killing blow would be able to capture the Galley. The Spearman would retreat to the other water tile if possible, or killed otherwise.

Scope: mainly DLL change plus a bit of UI
 
Last edited:
I like it, but it would be better to show it on some graphics instead of long texts. It could be better understandable then.
 
I've bolded the only important part. The others are special cases and implementation details.
 
I sponsor everything minus tactical AI improvements.

Note that it's highly unlikely to teach the AI about unit captures if the mechanic stays as is (random).
 
Tactical AI changes are not necessary to sponsor this.
 
Like this better than the proposal from last congress, but still prefer the random chance.
With this proposal having adjacent allied units is actually harmful, as they provide less room for escape.
 
Last edited:
Status
Not open for further replies.
Top Bottom