Removing the randomness

Imagine you fight with a strength 4 unit against a 4.1
You would inflict 19/ 20 damage
The problem with integers and limiting the damage is that everything gets rounded down:
So instead of doing 19 you wouldn't inflict 1,9 but only 1.
If you fight against a unit that would inflict 20 damage you would inflict 2 damage.
So instead of a 36% for the strength 4 unit you would get much, much less.

However if you multiplier they hp with 10 you would get a better chance with they 4.1 unit but still 33% for the slightly less weaker.
 
Maybe this is a horrendously stupid idea, but how about changing the combat system entirely?

I guess I don't understand why Firaxis made it so complicated with partial strengths etc. Bringing it in line with how I remember Civ2 (could be wrong), units had four combat stats:

Attack Strength
Defense Strength
Hit Points
"Firepower" (damage dealt per round)

IIRC, strength was unmodified by hit points, which always seemed balanced to me given that a weakened unit could therefore sustain less hits before death. However, strengths only went up to 6 (? maybe 8), so the ratios were less extreme.

Implementing variable HP/Firepower & fixed strengths on units would allow spells to do real, scaled damage instead of percentages (I hate the 100HP system in civ4), and (i think) reduce the randomness of combat as intended. In addition, the designers get some more flexibility when designing units.

Not sure how it'd work without testing. Has anyone tried modding this type of combat into civ4 before? Or does anyone know why Firaxis changed the system to how it is atm?
 
Cvi 4 combat system went through a couple changes early on, iirc, first where str did not effect damage, then where it did. I think in the end it is somewhere in the middle.
Reducing randomness a bit might be a good change, but radical changes to the combat system... you'd have to test it alot first to convince me to try it, anyway.
 
I just worked my way through the 15 pages of Combat Explained (Sorry it isn't a link, that's back in post 40) and it seems that both the change to scale of HPs and to base damage would be problematic for first strikes.

They'd still work, but if you're increasing the combat length (from a few rounds to a few tens of rounds) then getting in one, two, or a few rounds when your opponent can't hit back (which seems to be the way first strikes work) becomes much less meaningful.

It looks to me like shifting the base damage down is a trouble spot, but not because of 'randomness' issues so much as because the 'worth' of the combats odds ratio doesn't follow a nice smooth curve. Instead, there are a few points where a small change in 'odds' has a disproportionately big change in %chance of success. One of the effects of the wider spread of randomly determined damage per round was to partially smooth out these jumps. I had implemented Xanaqui's micro mod, but in light of the aforesaid 15pgs (Which are about Vanilla, but the core combat determinations haven't changed for FfH, have they?) I'm going to look at a mix of both approaches.

So, my suggestion is more HPs overall, which means adjust the healing rates, and number of first strikes & first strike chances in each of the promotions that grant them then look at the spells just in case, in order to dilute the effect of a really good roll or two, -and- Increase the base damage slightly, so that the variable range there is widened and the discontinuous jumps in effectiveness are further reduced.

Actually, the real answer seems to be to have an entire graduate level class analyze the combat system for exhaustive statistical balancing of the many units and promotions, and then rewrite the core code to produce a system which lets players choose the 'diceness' level on a game-by-game basis. That's not all that likely to happen, although there are classrooms of students immersed in the right studies if only we can tap in to one or two of them.


:)
 
it would be really nice if you get an option:
multiplier for HP& firststrikes& stoneskin& anything else we might forget right now
where you could determinate the randomness of a game at startup.
I dont know if thats possible at all but it would be nice to set your own "im feeling lucky today" seting without changing every single unit again and again.
 
Combat Odds is insanely skewed by the amount of damage you do each round. For example, if you do 19 damage you need 6 successful hit to kill your target instead of 5, a MASSIVE increase in %. If you lower the damage range to 2 instead of 20 you would increase this skewyness by a ALOT. Someone doing 1 damage would need 50 more rounds than someone doing 2 damage, 66 more rounds than someone doing 3 damage.
There is a reason why HP can currently change the odds alot.

Currently, if the ratio between two units is 1.01 vs 0.99 in strengths and they are somehow of full HP, the 0.99 unit has 38% to win, cause he does 19 damage per round and the 1.01 unit does 21.

I'm trying to emulate the effect of changing to 1000 HP via combat damage. As far as I can tell, multiplying all HP numbers by 10 is nearly the same as dividing all damage/hit numbers by 10; it's the HP/damage ratio that gives you the number of rounds of combat (both minimum, and average). The nice thing is that the engine seems to handle changing the combat damage better than the HP. The number of First Strikes (and Stoneskin) would still need to be changed to get roughly the same effect - note that if this was done with a C++ change, it could be limited to a tiny number of functions. However, Healing would not need to be touched.

Basically, the peak of the curve increases as the number of rounds go up (sacrificing probability from the extremes). That means that someone with a marginal advantage at a ratio of 5:1 (HP:damage) has a larger advantage as the ratio increases, and a smaller advantage as it decreases.

Personally, I think that if people really like this approach, we should see if Snarko would be willing to put it into his options mod- something like:
Combat Randomness:
High (50 damage/hit)
Vanilla (20 damage/hit)
Low (10 damage/hit)
Very Low (5 damage/hit)
Extremely Low (1 damage/hit)
The damage each round isn't always 20, its a variation from 6-60, and replacing 20 with 2 would make that range from 1-6, now that is a bit extreme don't you think?

Combat Explained
I'm not familiar with the text you cite; I'm basing my investigation on CvUnit::updateCombat.

There is no randomness to the damage calculation; merely to the number of rounds.

Damage Calculation 1 (Defender does damage):
Spoiler :
Code:
						iDamage = max(1, ((GC.getDefineINT("COMBAT_DAMAGE") * (iDefenderFirepower + iStrengthFactor)) / (iAttackerFirepower + iStrengthFactor)));
Damage Calculation 2 (Attacker does damage):
Spoiler :
Code:
						iDamage = max(1, ((GC.getDefineINT("COMBAT_DAMAGE") * (iAttackerFirepower + iStrengthFactor)) / (iDefenderFirepower + iStrengthFactor)));

When you look at the basis of these numbers,
Firepower is the (Max strength + the current strength + 1) /2
and
iStrengthFactor is the (Attacker's firepower + the Defender's firepower + 1) / 2.

So, for an extreme example, a strength 80 vs strength 1 unit (both at max HP, no terrain mods) would do:
Firepower of Str 80 = 80
Firepower of Str 1 = 1
iStrengthFactor = 41

So if the strength 80 unit hits using the vanilla combat damage:
max(1,(20 * (80 + 41))/(1 + 41)) = max (1,(20*121)/42) = max (1,(2420/41)) = max(1,59) = 59 points of damage
If the Str 1 unit hits:
max(1,(20 * (1 + 41))/(80 + 41)) = max (1,(20*42)/121) = max (1,(840/121)) = max(1,6) = 6 points of damage

Conversely, using 2 for the combat damage:
max(1,(2 * (80 + 41))/(1 + 41)) = max (1,(2*121)/42) = max (1,(242/41)) = max(1,5) = 5 points of damage
If the Str 1 unit hits:
max(1,(2 * (1 + 41))/(80 + 41)) = max (1,(2*42)/121) = max (1,(84/121)) = max(1,0) = 1 points of damage

This means that the weak unit is relatively a bit stronger, on a per round basis, using 2 as combat damage than the strong unit because it does more relative damage/hit (20% of the damage of the strong unit, instead of roughly 9%). however, the 10-fold increase in average combat rounds more than offsets this; in the first case, the weak unit would need to hit 17 times before being hit twice; in the second case, the weak unit would need to hit 100 times before being hit 20 times.

So, no, I don't think that lowering the range of combat damage is a bad thing; it's merely different. Unless it's a death, it's not like you notice the difference between 4 points of damage and 5 points of damage much, anyway. The combat odds/round are still the same (and essentially calculated in the same way as Civ I)

So I guess the end result of this discussion is that I'd suggest you try changing the COMBAT_DAMAGE, try a few combats via a world-builder setup, and see if you like the results (note that just changing COMBAT_DAMAGE means that First Strikes and Stoneskin are far weaker- unless they're also changed). It seems to me that what will happen (if you adjust it downward) is that the stronger unit will win far more frequently than the weaker unit, but the weaker unit is much more likely to damage the stronger unit.
 
it would be really nice if you get an option:
multiplier for HP& firststrikes& stoneskin& anything else we might forget right now
where you could determinate the randomness of a game at startup.
I dont know if thats possible at all but it would be nice to set your own "im feeling lucky today" seting without changing every single unit again and again.
There's no intrinsic reason why this couldn't be done.
 
Xanaqui
The problem with limiting combat damage is that it would doom a unit thats only slightly weaker to death.
See post 41 on top of this page.

Oh and:
Unless it's a death, it's not like you notice the difference between 4 points of damage and 5 points of damage much
whether you need 25 or 20 hits (25% more hits!) makes a big difference.
 
I'm not familiar with the text you cite; I'm basing my investigation on CvUnit::updateCombat.

There is no randomness to the damage calculation; merely to the number of rounds.

I didn't say there were a randomness. I only said you don't always do 20 damage. If you are weaker you do less, if you are stronger you do more.

If that base is 2, weaker would do 1, stronger would do 3 or more. Now, 19 vs 21 isnt a big difference. but 1 vs 3 is a huge difference.

And as Chip said, amount of damage per round affects odds tremendously. 1 damage down means 1 extra round, thats 20% more rounds you need to win. (6 instead of 5)
 
This little one point damage down (19 instead of 20) decreases your chances from 50% to 36%.
 
This little one point damage down (19 instead of 20) decreases your chances from 50% to 36%.

I know, that was what I said in the last section of my post.

But going from 2 to 1 damage per round would be a much bigger difference in odds to win.
 
I wrote that only to point out how big the difference is (so that other readers better understand it, since you didn't write down the odds).
Just a little addition to your post :)

Edit:
I just calculated the odds in case of damage limitation for the 4 vs 4.1 example:

In case of rounding down (which is done by civ 4):
1 damage instead of 19 (weaker unit) and 2 damage instead of 20 (stronger unit)/.
You need to win 50 (stronger unit)/100 (weaker unit) rounds.
The odds are 0,000092% to win for the weaker strength 4 unit.

Would civ4 use float numbers instead of integers it would be:
1.9 damage instead of 19 (weaker unit) and 2 damage instead of 20 (stronger unit)/.
You need to win 50 (stronger unit)/53 (weaker unit) rounds.
The odds are 33,658 % to win for the weaker strength 4 unit.
 
I wrote that only to point out how big the difference is (so that other readers better understand it, since you didn't write down the odds).
Just a little addition to your post :)

Edit:
I just calculated the odds in case of damage limitation for the 4 vs 4.1 example:

In case of rounding down (which is done by civ 4):
1 damage instead of 19 (weaker unit) and 2 damage instead of 20 (stronger unit)/.
You need to win 50 (stronger unit)/100 (weaker unit) rounds.
The odds are 0,000092% to win for the weaker strength 4 unit.

Would civ4 use float numbers instead of integers it would be:
1.9 damage instead of 19 (weaker unit) and 2 damage instead of 20 (stronger unit)/.
You need to win 50 (stronger unit)/53 (weaker unit) rounds.
The odds are 33,658 % to win for the weaker strength 4 unit.
Good post; it took me a while to figure out what you were getting at, but this makes it crystal clear. Another way that I'd phrase it is that in the first instance, the stronger unit takes an average of roughly 50 points of damage. In the second instance, the stronger unit takes an average of roughly 95 points of damage. In either case, a second Strength 4 unit will demolish the wounded Strength 4.1 unit.

So if the objective is just to make the combat results closer to the mean (as opposed to merely more strongly favoring the stronger unit), there are a few possible solutions:

1) Change the relevant functions to float (or, even better, integer with a reasonable denominator) math.
2) Change the functions so that additional HP will work.
 
Good post; it took me a while to figure out what you were getting at, but this makes it crystal clear. Another way that I'd phrase it is that in the first instance, the stronger unit takes an average of roughly 50 points of damage. In the second instance, the stronger unit takes an average of roughly 95 points of damage. In either case, a second Strength 4 unit will demolish the wounded Strength 4.1 unit.

So if the objective is just to make the combat results closer to the mean (as opposed to merely more strongly favoring the stronger unit), there are a few possible solutions:

1) Change the relevant functions to float (or, even better, integer with a reasonable denominator) math.
2) Change the functions so that additional HP will work.

Here's an alternate idea:
Add a few XML variables:
1) denominator (for int-based math)
2) First_Strike_Factor (multiplier for first strikes)
3) Stoneskin_Factor (multipier for stoneskin)

Then, using denominator-based math, and altered average combat damage, one could emulate anything from roughly 100 HP through, say 1,000,000+ HP, although the final HP of the unit would need to be rounded at the end of the combat (I'd assume up).
 
why would you want to get rid of the randomness? i mean life isn't like a chess game. The lion doesnt always feed. The cheetah doesnt always catch its prey. A man with a fire bomb can take out a tank. i think randomness makes it more like real life
 
if you believe that a swordsman can sucessfully defend against a helicopter...
I dont and I have had that happen in civ4.
And we dont remove it we try to make it more likly to win with a superior unit against one weaker and less likly against an army of weaker units
 
One trick that I've found helps when an apparently absurd combat result shows up, is to remember that the obvious battlefield is not the only one. Although there are no graphics for it, perhaps the swordsman got a job delivering pizza and murdered the pilot and repair crew after sneaking on to their base. I too find it a bit tricky to imagine hiding a sword in a pizza, but perhaps it was a gladius. ;)
 
Then how the hell did the pilot fly to the battlefield if he already got murdered before ?:)

But back to topic:
I think it would be a good thing to write a little summary so that people who don’t understand everything that has been written so far get a change to tell us their opinion.
If you already know how things work you can skip these spoilers.

How does combat work in Vanilla civ4:
Spoiler :

Every unit has a strength value.
Promotions like combat 1-5 add to the value of the owning unit
The same is true for terrain bonuses.
Promotion against certain unit types (shock, cover, etc…) however are a malus for the opposing unit.
The final strength affects to things:
Your hit change and your damage
Combat consist of rounds:
In every round one of those two units wins and deals damage to the other.
There are NO rounds in which no one or both deal damage.

Here are the formulas with which you can calculate your odds:
Spoiler :

Hit changes:
A/(A+D) for the attacker
D/(A+D) for the defender
A…Strength of attacker
D…Strength of defender

Damage dealt (always rounded down):
20*(3*A+D)/(3*D+A) for the attacker
20*(3*D+A)/(3*A+D) fort he defender
A…Strength of attacker
D…Strength of defender
However there is a maximum of 60 points and a minimum of 6.

Rounds needed for a win (always rounded up):
HP/dam
HP… Hitpoints of the enemy
Dam…damage your unit deals

Changes to win:
For the attacking unit:

a… rounds the attacking unit needs to win
d… rounds the defending unit needs to win
P(A) hit changes of the attacker
P(D) hit changes of the defender
i… Every number between 0 and d-1 (including 0 & d-1)

For the defender:
1-p(a)
p(a)… changes to win of the attacker
Or you could use the harder way and change the formula above.

Some examples:
Spoiler :
A strength 4 melee unit attacks a strength 5 archer unit.
Both unpromoted, at full health and in flat terrain
Spoiler :

Hit changes are:
4/ (4+5) = 0,4444 for the melee unit
5/ (4+5) = 0,5555 for the archer unit

Damage dealt each won round:
20*(3*4+5)/(3*5+4)= 17,895 rounded down to 17 for the melee unit
20*(3*5+4)/(3*4+5)=22,35 rounded down to 22 for the archer

Rounds needed:
So the melee unit would need 100/17=5,88 rounded up to 6 victorious rounds to win.
And the archer unit would need 100/22=4,54 rounded up to 5 victorious rounds to win.

Chances:
For the attacker:

For the defender:
1-0,2496=0,7503

A strength 4 melee unit attacks a strength 5 archer unit.
Melee unit combat 1 and cover 1 and archer in a wood, both at full health
Spoiler :

Strength values are:
4*(1+0,1)= 4,4 for the melee (+0,1 for combat 1)
5*(1+0,5-0,25)=6,25 for the archer (+0,5 for wood, -0,25 for cover 1)

Hit changes are:
4,4/ (4,4+6,25) = 0,4131 for the melee unit
6,25/ (4,4+6,25) = 0,5868 for the archer unit

Damage dealt each won round:
20*(3*4,4+6,25)/(3*6,25+4,4)= 16,803 rounded down to 16 for the melee unit
20*(3*6,25+4,4)/(3*4,4+6,25)=23,846 rounded down to 23 for the archer

Rounds needed:
So the melee unit would need 100/16=6,25 rounded up to 7 victorious rounds to win.
And the archer unit would need 100/23=4,34 rounded up to 5 victorious rounds to win.

Chances:
For the attacker:

For the defender:
1-0,116=0,883

One last example
Because it gets even harder:
A strength 4 melee unit attacks a strength 5 archer unit.
Melee unit combat 2 and cover 1, at 90hp and archer in flat terrain with 100hp
Spoiler :
Strength values are (Here it gets harder):
4*(1+0,2)*0,9=4,32 for the attacker (+0,2 combat 2, *0,9 because of 90% HP)
5/ (1+0.25)=4 for the defender (in the case of stronger negative than positive modifiers)

Hit changes are:
4,32/ (4,32+4) = 0,5192 for the melee unit
4/ (4,32+4) = 0,4807 for the archer unit

Damage dealt each won round (And now it gets even more fun):
20*(3*4,32+4)/(3*4 +4,32)=20,78 rounded down to 20 for the melee
However it would inflict more damage if at full health:
20*(3*4,8+4)/(3*4+48)=21.905 rounded down to 21
These two are added and divided through 2:
(20+21)/2= 20,5 rounded to 20 ( so in this case it doesn’t matter)

20*(3*4+4,32)/(3*4,32+4)=19,245 rounded down to19 for the archer
However it would deal less damage against a healed enemy:
20*(3*4+4,8)/(3*4,8+4)=18,26 rounded down to 18
These two are added and divided through 2:
(19+18)/2= 18,5 rounded to 18 ( so it’s really not the best example but you get the point)

Rounds needed:
So the melee unit would need 100/20=5 victorious rounds to win.
And the archer unit would need 100/18=5,55 rounded up to 6 victorious rounds to win.

Chances:
For the attacker:

For the defender:
1-0,669=0,331


Here what happens if we multiply the HP with 10:
Spoiler :

A strength 4 unit against a 4.1
Normally the strength 4 would inflict 19 damage and the 4.1 would inflict 20 damage
So the 4.0 would need 6 victorious rounds and the 4.1 only 5 rounds.
The hit chances would be 0,4938 for the weaker 4.0 and 0,506 for the 4.1 unit.
This would result in a 36% win chance for the 4.0 unit.
The 4.1 would have a 3,32% to take no damage
The average remaining hp of the 4.1 unit are : 43.03/100

Would you multiplier the hp with 10 it would look like this:
The strength 4 would inflict 19 damage and the 4.1 would inflict 20 damage
The hit chances would be 0,4938 for the weaker 4.0 and 0,506 for the 4.1 unit.
But the 4.0 would need 53 rounds and the 4.1 would need 50
This would result in a 33,658% win chance for the 4.0 unit.
However the chance that the 4.1 unit takes no hit is only 1,62*10^-13 % (almost non existent)
The average remaining hp of the 4.1 unit are: 177.70/1000

To summarize:
You get better chances with a stronger unit against a single weaker but since you get more damage on average you are less likely to win against more weaker units.
However you would have not only to adjust the hp of every unit but also first strikes, healing rates, and stoneskin.


And now what happens if we limit the damage per round by dividing it through 10:
Spoiler :

A strength 4 unit against a 4.1
Normally the strength 4 would inflict 19 damage and the 4.1 would inflict 20 damage
So the 4.0 would need 6 victorious rounds and the 4.1 only 5 rounds.
The hit chances would be 0,4938 for the weaker 4.0 and 0,506 for the 4.1 unit.
This would result in a 36% win chance for the 4.0 unit.

The problem with limiting the damage by dividing it through 10 is that everything gets rounded down since civ4 uses integers:
So instead of doing 19 you wouldn't inflict 1,9 but only 1 and instead of 20 damage you would inflict 2 damage.
Now the 4.0 would need 100 rounds and the 4.1 only 50!
The hit chances stay the same (0,4938 for the weaker 4.0 and 0,506 for the 4.1 unit)
This results in a 0,000092% chance to win for the weaker strength 4 unit.


The big problem here:
A limitation of damage would doom every weaker (even if it is only by 0,001 strength point) to death in a 1vs1.

Would civ4 use float numbers instead of integers it would be:
1.9 damage instead of 19 (weaker 4.0 unit) and 2 damage instead of 20 (stronger 4.1 unit).
Now the 4.0 would need 53 rounds and the 4.1 would need 50.
The hit chances stay the same (0,4938 for the weaker 4.0 and 0,506 for the 4.1 unit)
The odds are now 33,658 % to win for the weaker strength 4 unit.
The average remaining hp of the 4.1 unit are: 17.77/100

The same odds as if you had multiplied the HP with 10 (oh wonder!).
In this case you would have almost the same advantages and almost the same disadvantages as in case of hp multiplication except in how to program it
 
Every unit has a strength value.
Promotions like combat 1-5 add to the value of the owning unit
The same is true for terrain bonuses.
Promotion against certain unit types (shock, cover, etc…) however are a malus for the opposing unit.
Just a quick clarification:
The attacker gets Combat promotions as bonuses to STR. Every other promotion on the attacker is a penalty for the defender's STR. Every promotion the defender has is a bonus to its STR.
(your examples follow this rule properly)

I like the idea of reducing randomness. However, I also like having randomness (I come from a RPG-heavy background, afterall). I might be willing to try out the changes proposed in this thread, but I think a 10x change is too much.

I think the idea of reducing randomness for heroes is great. Or, perhaps, have a promotion (available with Combat V or Spell Extension II) that allows the unit to reduce the randomness in combat (i.e., the unit is so skilled that it can control a fight well enough to make the outcome almost guaranteed).
 
Back
Top Bottom