[GS] Zero means zero, not -4

Victoria

Regina
Supporter
Joined
Apr 11, 2011
Messages
11,901
Anyone explain why I die? It appears if I have 0 strength I lose 100 HP even though I am fighting at -4.. and when did amphibious become -10? I thought it was -6.
regardless it seems a bit silly, thoughts? Is it rabies?
upload_2019-11-16_21-23-27.png

upload_2019-11-16_21-21-48.png
 

Attachments

  • Scout V Scout.Civ6Save
    1.4 MB · Views: 146
Could be to deal with situations where 1 health combatants are duking it out. I mean, someone has to win.
 
It appears that this is due to a logical check if one of the strength values is precisely 0.
In the definition of the game table Units, "Combat" and "Ranged combat" default to 0 if they aren't defined, so this is probably how the game handles attacking anything where Ed Beach forgot to place a value.
We can see that the strength in the combat preview cannot show a value lower than zero, although negative numbers function normally:
Spoiler Attacking 0 str unit :

upload_2019-11-16_18-9-3.png


Spoiler Attacking -2 str unit :

upload_2019-11-16_18-9-32.png


Due to random noise in combat I cannot be exactly sure, but some quick firetuner testing showed damage values of 43,45,46,51,51,53, which appears to be centered on the predicted value of 30*exp(-12/25)= 48.5 rather than 44.7, which is what it would be if the calculation actually had a min input of 0 strength.
So, actually, if your scout was damaged enough to grant a penalty from damage and have negative strength, he would fight better :lol:
Edit: the other unit in this scenario still takes the minimum 1hp damage, though, so alternatively you could send in 100 brave scouts.
 
default to 0 if they aren't defined, so
So more crappy code. Full health scout wasted by near death scout because he did not trip over and hurt himself before the fight.
 
So more crappy code.
Well-intentioned code, I'm sure. It's all but impossible for it to affect any unit except scouts and slingers- unfavorable terrain+varu/toa aura+damage would only be -16, so it wouldn't even affect a warrior.
And you have to hit exactly zero. Still, I'm straining to think why this conditional check is in there for anything beyond bug testing, since no production release would ever have a 0 strength combat unit and even then, the game can already handle X strength vs 0 strength with the combat formula. Maybe a holdover from a time when they had relative strengths like past entries?
 
When strength is below 0 a unit instantly kills in combat, without doing any damage (maybe 1?) to its opponent.
This is also a strategy I usually use --- Let wounded barb slinger move into a marsh, if it have less than 75 HP and its strength being reduced to 0 or less it can be killed by anyone in one shot.

Not sure for the <0 case, I always kill them in one shot however it seems that it's just because you have a large strength difference to produce enough damage? Given that I don't build scouts the strength difference is at least 20+ so enough to kill <65 HP.
 
Last edited:
When strength is below 0 a unit instantly kills in combat, without doing any damage (maybe 1?) to its opponent.
This is also a strategy I usually use --- Let wounded barb slinger move into a marsh, if it have less than 75 HP and its strength being reduced to 0 or less it can be killed by anyone in one shot.

Not sure for the <0 case, I always kill them in one shot however it seems that it's just because you have a large strength difference to produce enough damage? Given that I don't build scouts the strength difference is at least 20+ so enough to kill <65 HP.
If you look at the second screenshot I posted - in the spoiler "Attacking -2str unit" you can see a -2 strength slinger is taking the appropriate amount of damage. It's only when the strength is exactly zero than you get this instant death behavior.
 
I think this is an optimization technique to bypass formula computation for unit combats (if _unit_cs = 0 then _dmg = 100 else _dmg = calc_dmg(_unit_cs, _rival_cs))... Still crappy that it doesn't count negative CS possibility.
 
Still crappy that it doesn't count negative CS possibility.
Negative values work, they just aren't displayed-actually, there are many things in this game where they have inconsistently rounded things to zero at different stages of the calculation. Some modifiers allow negative values, some default to zero, some more actually default to absolute value (all on modifiers which take integer arguments by design.)

Although, yes, doing the check for zero on the unit's database entry instead would have made more sense. Seems like a debugging thing that got left in somehow.
 
Top Bottom