Hi all.
Forgiveness if this has been covered elsewhere, but it seems I see more questions on first strikes than on anything else. May as well focus that discussion Therefore, I went out to try and figure it out over the weekend.
I'm not one who digs into the codes to look at things, and I'm sure not about to dilute everythign down to a nice mathematical formula. I just play around and make observations.
Now, after a search, this is the best description I could find anyone attempt to make, from DeepO here:
And here:
After allot of playing around with drill promotions, this appears to be contrary to my own observations to what first strikes are doing.
The first thing I noticed was a wide range in the "5-7" first strikes listed in the calculator.
The same unit would one time list '2-7', next combat, it might list '5-7'. Clearly, there was something other than just a hard line chance of first strikes going on here.
Also, I have NEVER witnessed first strikes kill anyone despite the fact they mathematically SHOULD have.
Then I saw the one that seemed to answer it all for me: A "0-6" first strikes listing in the combat calculator.
What I believe is happening, based solely on observation, and I throw it out here to be torn to pieces by the real experts:
First strikes occur before battle, this is a given and known.
Chance of damage dealt occurs like normal combat. This is also known and given.
Now onto the speculation and somewhat educated guessing:
I believe the amount of damage you can deal to a unit via first strikes is capped, much like collateral damage. I also believe that damage to be 50% of a unit's base strength.
So, when a unit is listing '2-6' first strikes, you unit has 6 first strikes, but if the first 2 hit, you've reached the cap.
Whatever damage occurs via first strikes does appear to count in the regular combat rounds, ie, the weakened unit fights at the reduced numbers. Honestly, I'm a little confused as to whether DeepO was saying that above or not. A little to mathy for me, there, may as well be egyptian.
And finally, the AI does not recognize first strikes when determining the relative strength of units:
You have a str 4 unit with 6 first strikes, and a str 5 unit with nothing, the str 5 unit will absorb the first attack despite being a much weaker unit.
This would also seem to suggest the AI will not ever use Drill promotions, nor will it recognize first strikes as a threat when attacking.
Alright. Again, this is all just somewhat educated speculation based on more hours than I care to admit to playing, specifically using drill promotions and trying it out.
Feel free to point out how flawed it is now, but please, let's get this first strikes thing figured out by the end.
Forgiveness if this has been covered elsewhere, but it seems I see more questions on first strikes than on anything else. May as well focus that discussion Therefore, I went out to try and figure it out over the weekend.
I'm not one who digs into the codes to look at things, and I'm sure not about to dilute everythign down to a nice mathematical formula. I just play around and make observations.
Now, after a search, this is the best description I could find anyone attempt to make, from DeepO here:
So allow me to contribute:
How do first strikes work?
First, in order to determine how many first strikes a unit A actually got, you need to look at the combatting unit B. If B ignore first strikes, unit A will have 0 first strikes. (very important early on!) If both A and B have first strikes (say A has 3, B has 1) it's the difference that counts (A gets 2, B gets 0).
Once battle is fought, each first strike gives a free round of battle. That means that a round is fought normally, but in case A has a first strike, he can't lose the round. If B would be hit, he gets hit. If the result is negative, it is ignored.
Notice that the base strength of the units is unaffected: if A has a strength (or hp) of 4, first strikes of 2 after modifiers, and B has a modified strength of 6, the first 2 rounds still have a 4/(4+6)=0.4 chance of succeeding, taking 0.2*6*(3*4+6)/(3*6+4)= 0.98 off the strength of B each time they hit. B, however, has 6/(4+6)=.6 chance of succeeding, but instead of taking .2*6*(3*6+4)/(3*4+6)=1.46 off the strength of A, it doesn't hit anything.
Once first strikes are over, combat continues as usual. At most, B has been hit once (but it could be twice or not), which would mean its strength is now at 5. (the average would be a bit higher) A is still at 4. The numbers in the formula don't change, though, so B still has a .6 chance of winning the next round, while A only has .4. With those numbers, B is almost certainly going to win, even if he was hit a little during first strikes.
You would be tempted to think that first strikes are thus unimportant. Nothing is farther from the thruth, you only need to use them well. If the situation is reversed, and a unit C has 6 strength and 2 first strikes, while unit D has 4 strength, the results are very different.
C will hit D in 60% of the cases, and it will do 0.97 damage. D can hit C in 40% of the cases, and will do 0.8 damage. With those numbers, C will hit D once or twice, doing at least 0.97 damage and reducing D to 3.03. Another 4 hits and he's dead... C still needs 6/.98= 6.1 or 7 hits.
(due to roundings, this is a bad example. In reality the number of rounds left will be 3 for C and 6 for D)
If you compare the battle of C with one without first strikes, you would see that C has a much higher chance of not getting damaged, with a sligthly higher chance of actually winning. The bigger the difference in strengths between C and D, the extremer this effect. Adding 2 first strikes to a unit that is already twice as superiour will mean he will win most battles undamaged. As your damage directly affects your strength in the next battle it is very important to keep a good health.
OTOH, if the difference between the strengths decreases, first strikes give a small advantage. You can use that to win fights where e.g. you have a 10% disadvantage. Once the difference is too large, first strikes won't help you to win, though.
First strikes should be used for two different types of units: those that defend and the overwhelming attackers. As defenders are most likely stronger because of the bonusses, they are helped as they can fend of multiple attacks, still remaining strong. It's very annoying to have dozens of units attack a city, where one single defender just shrugs of the attacks.
For the overwhelming attackers, it can keep you going. This especially applies to pillagers: they will remain healthy long enough to pillage that resource far inside the foreign borders, where units with the same strength but no first strikes will get slowly damaged over time to a point where an older unit can win. A tank which is damaged to strength 1 will most definately lose from a spearman of modified strength 5.
DeepO
How do first strikes work?
First, in order to determine how many first strikes a unit A actually got, you need to look at the combatting unit B. If B ignore first strikes, unit A will have 0 first strikes. (very important early on!) If both A and B have first strikes (say A has 3, B has 1) it's the difference that counts (A gets 2, B gets 0).
Once battle is fought, each first strike gives a free round of battle. That means that a round is fought normally, but in case A has a first strike, he can't lose the round. If B would be hit, he gets hit. If the result is negative, it is ignored.
Notice that the base strength of the units is unaffected: if A has a strength (or hp) of 4, first strikes of 2 after modifiers, and B has a modified strength of 6, the first 2 rounds still have a 4/(4+6)=0.4 chance of succeeding, taking 0.2*6*(3*4+6)/(3*6+4)= 0.98 off the strength of B each time they hit. B, however, has 6/(4+6)=.6 chance of succeeding, but instead of taking .2*6*(3*6+4)/(3*4+6)=1.46 off the strength of A, it doesn't hit anything.
Once first strikes are over, combat continues as usual. At most, B has been hit once (but it could be twice or not), which would mean its strength is now at 5. (the average would be a bit higher) A is still at 4. The numbers in the formula don't change, though, so B still has a .6 chance of winning the next round, while A only has .4. With those numbers, B is almost certainly going to win, even if he was hit a little during first strikes.
You would be tempted to think that first strikes are thus unimportant. Nothing is farther from the thruth, you only need to use them well. If the situation is reversed, and a unit C has 6 strength and 2 first strikes, while unit D has 4 strength, the results are very different.
C will hit D in 60% of the cases, and it will do 0.97 damage. D can hit C in 40% of the cases, and will do 0.8 damage. With those numbers, C will hit D once or twice, doing at least 0.97 damage and reducing D to 3.03. Another 4 hits and he's dead... C still needs 6/.98= 6.1 or 7 hits.
(due to roundings, this is a bad example. In reality the number of rounds left will be 3 for C and 6 for D)
If you compare the battle of C with one without first strikes, you would see that C has a much higher chance of not getting damaged, with a sligthly higher chance of actually winning. The bigger the difference in strengths between C and D, the extremer this effect. Adding 2 first strikes to a unit that is already twice as superiour will mean he will win most battles undamaged. As your damage directly affects your strength in the next battle it is very important to keep a good health.
OTOH, if the difference between the strengths decreases, first strikes give a small advantage. You can use that to win fights where e.g. you have a 10% disadvantage. Once the difference is too large, first strikes won't help you to win, though.
First strikes should be used for two different types of units: those that defend and the overwhelming attackers. As defenders are most likely stronger because of the bonusses, they are helped as they can fend of multiple attacks, still remaining strong. It's very annoying to have dozens of units attack a city, where one single defender just shrugs of the attacks.
For the overwhelming attackers, it can keep you going. This especially applies to pillagers: they will remain healthy long enough to pillage that resource far inside the foreign borders, where units with the same strength but no first strikes will get slowly damaged over time to a point where an older unit can win. A tank which is damaged to strength 1 will most definately lose from a spearman of modified strength 5.
DeepO
How many first strikes does a unit get, when it says e.g. 5-7? (That would be Drill III or IV, depending on the unpromoted unit)
For every unit, there are actually 2 parameters: let's call them first_strikes, and extra_first_strikes. Some units start with first_strikes already, but normally these parameters are changed by promotion.
In the case of Drill IV, a unit that displays as 5-7 first strikes means he will have 5 sure first strikes (so first_strikes=5), and 2 more possible first strikes (so extra_first_strikes=2).
--------
Before battle is fought, each unit has a step where the number of first strikes is computed. This total for the battle is equal to
first_strikes_battle = first_strikes + chance(extra_first_strikes).
Basically, it means that for the battle, anywhere between 5 and 7 first strikes will be assigned to the Drill IV unit.
(Note that I don't kow what kind of randomizer is used for the chance distribution, meaning I can't tell if 5-7 would leadmore to 6 first strikes then it would to 5.)
---------------------
Once a battle is fought, the first thing to check is if the opponent has the immune-to-first-strikes property. If it doesn't, the total falls to 0.
Next, the two battle totals are compared, and the difference is taken. This difference is the number of first strikes the rest of the combat algorithm will use.
So, a Drill IV unit, attacking a Drill II unit, might get 6 first strikes initially (somewhere in between 5 and 7). It faces an opponent of 2 first strikes, which leads to a difference of 4 first strikes.
For every unit, there are actually 2 parameters: let's call them first_strikes, and extra_first_strikes. Some units start with first_strikes already, but normally these parameters are changed by promotion.
In the case of Drill IV, a unit that displays as 5-7 first strikes means he will have 5 sure first strikes (so first_strikes=5), and 2 more possible first strikes (so extra_first_strikes=2).
--------
Before battle is fought, each unit has a step where the number of first strikes is computed. This total for the battle is equal to
first_strikes_battle = first_strikes + chance(extra_first_strikes).
Basically, it means that for the battle, anywhere between 5 and 7 first strikes will be assigned to the Drill IV unit.
(Note that I don't kow what kind of randomizer is used for the chance distribution, meaning I can't tell if 5-7 would leadmore to 6 first strikes then it would to 5.)
---------------------
Once a battle is fought, the first thing to check is if the opponent has the immune-to-first-strikes property. If it doesn't, the total falls to 0.
Next, the two battle totals are compared, and the difference is taken. This difference is the number of first strikes the rest of the combat algorithm will use.
So, a Drill IV unit, attacking a Drill II unit, might get 6 first strikes initially (somewhere in between 5 and 7). It faces an opponent of 2 first strikes, which leads to a difference of 4 first strikes.
After allot of playing around with drill promotions, this appears to be contrary to my own observations to what first strikes are doing.
The first thing I noticed was a wide range in the "5-7" first strikes listed in the calculator.
The same unit would one time list '2-7', next combat, it might list '5-7'. Clearly, there was something other than just a hard line chance of first strikes going on here.
Also, I have NEVER witnessed first strikes kill anyone despite the fact they mathematically SHOULD have.
Then I saw the one that seemed to answer it all for me: A "0-6" first strikes listing in the combat calculator.
What I believe is happening, based solely on observation, and I throw it out here to be torn to pieces by the real experts:
First strikes occur before battle, this is a given and known.
Chance of damage dealt occurs like normal combat. This is also known and given.
Now onto the speculation and somewhat educated guessing:
I believe the amount of damage you can deal to a unit via first strikes is capped, much like collateral damage. I also believe that damage to be 50% of a unit's base strength.
So, when a unit is listing '2-6' first strikes, you unit has 6 first strikes, but if the first 2 hit, you've reached the cap.
Whatever damage occurs via first strikes does appear to count in the regular combat rounds, ie, the weakened unit fights at the reduced numbers. Honestly, I'm a little confused as to whether DeepO was saying that above or not. A little to mathy for me, there, may as well be egyptian.

And finally, the AI does not recognize first strikes when determining the relative strength of units:
You have a str 4 unit with 6 first strikes, and a str 5 unit with nothing, the str 5 unit will absorb the first attack despite being a much weaker unit.
This would also seem to suggest the AI will not ever use Drill promotions, nor will it recognize first strikes as a threat when attacking.
Alright. Again, this is all just somewhat educated speculation based on more hours than I care to admit to playing, specifically using drill promotions and trying it out.
Feel free to point out how flawed it is now, but please, let's get this first strikes thing figured out by the end.
Comment