xienwolf
Deity
Well, I've got a bit of a "Secret Project" which I am working on for a mod-mod which I am certain quite a few of the other Mods will decide to use, and I am hoping that the main mod will incorporate. For now, I'll only say 2 things about it: 1) It's fun, 2) The AI doesn't understand it so well.
In light of #2, I am pausing the project and working on the AI for a bit of it. Unfortunately before I touch too much of the AI directly dealing with what I am creating, I need to polish up the current. First step is Combat Odds, and I am seeking input.
The following is the list of what I am thinking for the initial setup. Let me know if anything else affects how you think about Combat (makes you more/less willing to take risks).
Any time that the AI is facing potential Combat, I want to have it call a function to get the unit in the Stack which it is most willing to lose, according to the following formula (The AI will at the end attack using the lowest Acceptable Risk Rate):
I haven't figured out precisely how yet, but I also intend to have this effect what level of risk the AI is willing to take with the Combat Odds, in addition to the order in which the units will attack. The ideal will be to cap it so that the AI is willing ot risk almost any unit at 95% win chance, standard units around 75% chance, and summons at absolutely any chances. So most likely I will just run the numbers for a variety of units and come up with a normalizing function which will balance out to around that point. Anytime that a Unit has a 98% Chance to win, it will be checked against other units with the same odds and the one with the highest XP will make the attack, regardless of the list for Minimum Risk
In light of #2, I am pausing the project and working on the AI for a bit of it. Unfortunately before I touch too much of the AI directly dealing with what I am creating, I need to polish up the current. First step is Combat Odds, and I am seeking input.
The following is the list of what I am thinking for the initial setup. Let me know if anything else affects how you think about Combat (makes you more/less willing to take risks).
Any time that the AI is facing potential Combat, I want to have it call a function to get the unit in the Stack which it is most willing to lose, according to the following formula (The AI will at the end attack using the lowest Acceptable Risk Rate):
AIgetMinCombatOdds said:
- -Combat Odds
- If the unit is pretty likely to die, I don't want to attack with it
- -300 + (50 * Duration)
- If Duration > 0 (Summoned Unit -->Probably Always first choice, at any odds)[*]If possible, will also have a hook to catch Permanent Summons (maybe also Planar Gate Summons) and assign them a -100 (more likely than "real" units, but still expendable)
- +100
- If Duration From Combat > 0
- -75
- If Immortal
- + iTier * 5
- The Tier of a unit is how early it comes in the Tech Tree. Thus if you have a Warrior (Tier 1) and an Axeman (Tier 2), you'd be a bit more willing to risk the Warrior
- +20
- If any of the Potential Upgrades for the Unit has a Minimum Level Requirement (primarily Adepts & Priests)
- +20
- If the Unit is a World Limited Unit (Hero)
- +10
- If the Unit is Carrying Equipment
- -Withdrawal Chance / 2
- If the Unit might survive even through Defeat
- -Net Number of First Strikes * 2
- Might already be a part of calculating the Combat Odds, if so, won't use it
- -10
- If the Unit will Abandon me on Change of Civic/Religion (since the AI is pretty likely going to do one or the other eventually)
- -1 per Unit owned
- If the AI has a stack of 20 Scouts, then each one is pretty much not that important
- -2 * Number of Targets allowed with Collateral Damage, + Collateral Damage Limit / 5, + Collateral Strength / 10
- This makes the Computer more willing to attack early with a Unit that can do lots of Collateral Damage to weaken the stack
I haven't figured out precisely how yet, but I also intend to have this effect what level of risk the AI is willing to take with the Combat Odds, in addition to the order in which the units will attack. The ideal will be to cap it so that the AI is willing ot risk almost any unit at 95% win chance, standard units around 75% chance, and summons at absolutely any chances. So most likely I will just run the numbers for a variety of units and come up with a normalizing function which will balance out to around that point. Anytime that a Unit has a 98% Chance to win, it will be checked against other units with the same odds and the one with the highest XP will make the attack, regardless of the list for Minimum Risk