LEts count. 20% base defense reduction rom siege ram :
20 - (20*0.95) = 1%
I think 1% is a very small number. Lets put it to 80% and than we will have 4% defense reduction from each siege ram.
That's a siege ram and that sounds appropriate to be doing 1%. What would the comparison be on something MUCH larger, like say, a Rocket Artillery?
Mind... a Diminishing Return would fix it up pretty well anyhow so I might just do that.
Integer arithmetic always rounds down.
Ah... VERY nice to finally know that for sure! Thanks!
Do you mean, that for example my ballista elephant which had 5% bombing strength done no damage, but arsonist, which had to 5%, reduced the defense quite well? Or that, that those units with high bombing strength perform some damage or those with low do nothing?
I mean that there seems to be an unseen variable here that allows one 5% unit to perform differently on the same city as another 5% unit. It would suggest there's a differing ability on units to penetrate Bombard Defense. Is this actually taking place somewhere? And if not... shouldn't there be? lol
The second case makes sense with a flat % modifier taking place through Bombard Defense. But it wouldn't answer why there would be a variation between 5% unit A and 5% unit B.
Doesn't look so horrible, I've seen much worse. Maybe it was reorganized.

However, the code responsible for reducing city defense is quite amazing.
It's grown a bit since the original on that. The 2 types of minimum defense have to play a role there and it wasn't the easiest thing to work out. I'm sure a better organized coder could probably have achieved the same thing with a little more streamlined approach.
No, I was wrong. I thought the the protection against defense reduction was the value below which you can't reduce the defense. Like you can't reduce it with bombing below 10% (btw is it some const, or it si given by some building)
Ah... yeah, doesn't work like that at all.
This diminished return (strange name) is a little bit like multiplicative aggregation of a bonus. I think an example will be the best explain.
Lets have some buildings with the bombard defense bonus in a city (values are my imagination): walls (10%), high walls (20%) and castle (25%). Then we perform a bombardment with a siege ram (20% of bombardment strength). The attack hits the city and is firstly reduced by the castle (20 - 20*25% = 15), then what is left is reduced by the high walls (15 - 15*20% = 12) and then what is left is reduced by the walls (12 - 12*10% = 10.8). Now when we transform a little those evaluations we get the result to be 10.8 = 20(100%-25%)(100%-20%)(100%-10%).
While I get it I don't think it would process well to implement such a mechanism. Reason being that each time a bombard attack was made, we'd have to then go through and run through checking all the bombard defense value sources in the city independently when those sources are needed, such as during a bombard attack.
The way it works now is to compile defensive values from buildings onto a singular city variable each time a building processes 'in' or 'out' of the city. Thereafter,
where the particular volume of bombard defense level came from is irrelevant. So a call to get the bombard defense in the city asks for one static and currently defined variable's value.
The method you suggest would then require the code to cycle through all the buildings in the city, make sure those buildings have any contribution to bombard defense, then manipulate the bombard value being thrown at the city by stepping through each of those buildings and modifying (locally) the amount of bombard being used against the city by each building's defense value (in no particular order.) The processing on that would be horrendous. This complexity is eliminated by simply making the one Bombard Defense total tally in or out as a building is built or destroyed.
So what I'm suggesting is having any call to the Bombard Defense value return a value that has taken the ultimate total of Bombard Defense and filtered it through a diminishing return mechanism. Still adding a little processing with each call but nothing of the magnitude of looping through all building definitions.
Still the problem is, what if the strength of bombardment is reduced to something like 0.9, which will be downgraded by the integer arithmetic to 0.
The way I'd want to program the diminishing return function would never allow for 100% since the rounding down is the default. It would always come up with 99% at the highest possible value.
@
Koshling, if you have few minutes, can you tell me, what is this?
Code:
void CvCity::changeDefenseModifier(int iChange)
{
if (iChange != 0)
{
int iTotalDefense = getTotalDefense(false);
if (iTotalDefense > 0)
{
changeDefenseDamage(-(GC.getMAX_CITY_DEFENSE_DAMAGE() * iChange + (iChange > 0 ? iTotalDefense : -iTotalDefense)/2) / iTotalDefense);
}
}
}
[/quote]
I get really confused by these sorts of calculations. For example, what takes place first. Is it:
GC.getMAX_CITY_DEFENSE_DAMAGE() is multiplied with iChange THEN the adding of that total to (iChange > 0 ? iTotalDefense : -iTotalDefense)/2)
OR the adding of iChange to (iChange > 0 ? iTotalDefense : -iTotalDefense)/2) THEN that total multiplied with GC.getMAX_CITY_DEFENSE_DAMAGE()?
This kind of 'order of mathematical events' confusion leaves me wondering what the final result of an equation like this would really amount to.
Yep... this is the kind of thing that throws me completely.
This method is used by the bombardment. But I can not see, how can this work correctly. GC.getMAX_CITY_DEFENSE_DAMAGE() is set in the xml to 100, so for a siege ram and a city with defense 50%, we get changeDefenseDamage(40).
And one important thing, how to compile this thing? C2C (VS 2010).sln points to C2C (VS 2008).vcxproj, that does not exists and after changing it to C2C (VS 2010).vcproj, the VS 2012 can't cope the project file. Is C2C (VS 2008).vcproj up to data? I can also try to move it to Qt, but don't know does it have some dependent code.
Ride the Spiral was having extreme trouble with trying to compile too. I've not had trouble myself but I may not have been able to get setup to compile without problems if I was trying to start with C2C from scratch. I'm not sure right now what versions work, what don't, what can or can't be utilized. Definitely something Koshling will have to answer.