Resource icon

[SDK] Lead from Behind 2016-10-05

(Now updated to version 1.2)

At the core, this mod is about trying to keep valuable units safe (or at least safer ...). The standard algorithm would pick units to attack or defend based on their relative strengths. This would lead to more valuable units being picked even when it's a 'suicide mission'. It also meant that Great General's got used as healer's since otherwise they could easily be killed when moving around (even if part of a large stack).

This mod tries to make the unit choice a little more intelligent, factoring in the 'value' of the unit. Value in this context is roughly equivalent to 'rare' - units that you wouldn't generally have a lot of, so would really hate to lose.

Changes in this mod:

-Best Defender code is modified to use the actual combat odds to determine the best defender. It also evaluates the value of a unit and uses that to 'adjust' the odds to come up with a defender ranking (making them more likely to defend if they have an excellent chance of winning - less likely otherwise). The amount of the adjustment depends on the value of the unit.

-Likewise, the Best Attacker code uses combat odds and adjusts based on value.

-Some speed improvements to combat in general, and combat odds in particular. Most notably, use of a cache to store partial combat odds to reduce the computations needed. Even with the use of combat odds, stack combat (1 large stack attacking another large stack) now takes roughly half the time.

The criteria for what makes one unit 'more valuable' than another is based on: are they led by a great general? how much experience do they have? are they a unit that's limited in the number that can be produced? do they have the ability to heal? (This last one is a bit different from the others in that you can easily create a lot of healers ... but generally you'd rather leave that to a few units, seeing as only one healer/stack will actually do anything).

Source code is included under CvGameCoreDLL - just search for UncutDragon to find my changes. You can also check the readme file for information on some config settings.

This is for BtS v 3.19 - just unzip in the Mods folder

Updated to v1.1 - changes:

- Fixed a bug that was causing a python exception in the best attacker code when there was no defender (only appeared if you had python exceptions enabled)

- Changed the experience valuation to use tiers (instead of 25% more than the other unit)

- Changed the odds adjustment to use the value (instead of only adjusting when more valuable) and use difference from 99% (instead of 85%)

Updated to v1.2 - changes:

- Changed value adjustment to (odds-990)*(value*numerator/denominator)^2 - numerator/denominator are config settings with a default of 1/3

- Changed best defender code to ignore value adjustment when attacker has a limit to the damage it can deal (e.g: siege engines)

- Changed best attacker code to factor in chance of withdrawing

(Basically the last two changes are to base the value adjustment on chance of living through the battle instead of chance of winning)
Author
UncutDragon
Downloads
372
Views
372
First release
Last update
Rating
4.00 star(s) 2 ratings
Top Bottom