1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Single Player bugs and crashes - After the 13th of August 2013

Discussion in 'Bugs and Crashes' started by Dancing Hoskuld, Aug 13, 2013.

  1. n47

    n47 Chieftain

    Joined:
    Aug 20, 2013
    Messages:
    352
    Location:
    Amsterdam
    I can't say for sure, but I performed bombing with more then 100 ballista elephants and there was no change in the defense of a city I attacked, so it does not look like this. I'm afraid, that at least a part of the problem may involve the python code, so it can take more time fix.

    @Thunderbrd, I have a feeling, that there may be two problems. One may be, the evaluation is done on integer numbers not on floating-point, so if a bombing strength would be for example 0.4, it will be in this case 0. The second thing is, I've noticed, that strength of bombings is downgraded by some factor. When I bombed one city with the defense something between 100-200%, ballista elephants was making some damage (1 or 2% if I remember correctly). When after few turns, I bombed a city with ~240%, they did nothing. But this is certainly not the matter of the protection against defense reduction, as siege rams performed still a damage.

    The second can explain everything, if the factor is additive, not multiplicative, as the elephants may have bombing strength reduced to 0 then.

    BTW, isn't it, that someone is too eager in implementing new formulas here?
     
  2. stachnie

    stachnie Theorist

    Joined:
    Jan 3, 2002
    Messages:
    501
    Gender:
    Male
    Location:
    Not far from Krakow, Poland
    [ Stonehenghe and In(something)suk ]

    O.K. It seems that it is done in such a way that Stonehenghe "builds" Monuments (required for the second GW) in almost all cities and disables it in the city with Stonehenghe (it does not appear in the list of buildings), so it is a different mechanism than for some other wonders excluding each other.

    S.
     
  3. n47

    n47 Chieftain

    Joined:
    Aug 20, 2013
    Messages:
    352
    Location:
    Amsterdam
    @Koshling, if you can tell, where to or how to find the code responsible for evaluating bombardment together with the parameters for it, I can look at it.
     
  4. Nimek

    Nimek Chieftain

    Joined:
    Jul 7, 2010
    Messages:
    1,179
    Gender:
    Male
    @TB

    I tweaked castle bombarddefense from 20 to 0 and now my siege ram do 3% defense reduction each. So we should tweak castle and pus it to svn and also put variable max_bombard_defense and set it to 80% to avoid that kind of problems in future

    CAstle is placed in towers hydro directory
     
  5. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    It will be somewhere in CvUnit.cpp, but until I get back to my PC I cannot be more precise. As I recall, the effectiveness of bombardment even as a percentage, is reduced by greater bombardment defense, so the defense acts in a squared manner. Rounding can also be an issue - during the calculatons it multiplies up by a fairly large factor, to avoid integer truncation issues when dividing, and then divides back down b the same factor at the end of the calculation. However, the resulting defense that is left after a unit bombards is still an integer percentage (I.e. - the displayed number), so if the unit will reduce by less than 1% (or possibly 0.5%, I don't remember the exact rounding calculation) it will have no effect. We could (should?) replace this with some sort of stochastic mechanism, where the calculation becomes a probability of reduction, so that a result of one quarter (say) would be a 1 in 4 chance of reduction by 1.
     
  6. n47

    n47 Chieftain

    Joined:
    Aug 20, 2013
    Messages:
    352
    Location:
    Amsterdam
    Ow! Gooood morning Mr Visual. With what new problem will you amaze me today? Ow, you can't read a project file from Visual 2010? What delightful.

    @Koshling, but seriously. There is something fishy about the project file. Shouldn't it be .vcxproj for VS2010?

    edit
    BTW, is there any place for a technical discussion on this forum?
     
  7. Nimek

    Nimek Chieftain

    Joined:
    Jul 7, 2010
    Messages:
    1,179
    Gender:
    Male
    And i have big BUG. latest svn

    I wait 30 minutes but this turn is endless...
     

    Attached Files:

  8. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,314
    Gender:
    Male
    Location:
    MN
    @Hydro

    Just going through this and found that you have Dene and Navajo Bonuses. They are the same tribe, just different names.

    ie: The Navajo (Navajo: Diné or Naabeehó), pls use Navajo thx.
     
  9. n47

    n47 Chieftain

    Joined:
    Aug 20, 2013
    Messages:
    352
    Location:
    Amsterdam
    @Nimek, I've checked the code. Yep, you are right, the bombarddefence parameter probably sums from all buildings into some big value. But it is not the case of the castle, but of all buildings with this bonus. Temporarily, you may try scale it down to lower the value, but maybe a better long time solution would be to make this bonus multiplicative.

    @Thunderbrd, there is MAX_BOMBARD_DEFENSE field in Assets\XML\A_New_Dawn_GlobalDefines.xml .
     
  10. climat

    climat Chieftain

    Joined:
    Mar 29, 2009
    Messages:
    734
    The Dene in the game is http://en.wikipedia.org/wiki/Dene. So they are very different tribes. ;)
     
  11. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Actually they are diffrent ...

    Navajo
    http://en.wikipedia.org/wiki/Navajo_Nation
    Dene
    http://en.wikipedia.org/wiki/Dene
    In short they speak the similar root language but are completely different groups.

    Diné (Navajo) vs Dené

    I know it can be confusing. Basically the Navajo are a Desert people and the Dene are an Arctic people. And from the root language similarity looks like the Navajo came from the Dene and migrated south to the American Southwest.
     
  12. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,314
    Gender:
    Male
    Location:
    MN
    My bad:blush:, funny how 1 letter makes a difference that much, HUH?? Even with the same accent.

    Diné vs Dené
     
  13. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Here we go ...

    http://en.wikipedia.org/wiki/Navajo_people
    So around 1400 CE the Athabaskans split off and migrated south to the southwest and become the Navajo and Apache.

    Thus they are now significantly different cultures. Such as the difference between the USA, Canada, South Africa and Australia. All speak "English" and have origins as being part of the British Empire but have since become their own cultures with their own accents/spellings.
     
  14. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    25,205
    Gender:
    Male
    Location:
    Las Vegas
    The maximum defense has been shown to be 100%. What now confuses me until I try to read the code further is how we are getting not all units that bombard having their bombard ability reduced to nothing, no matter how 'strong' their bombard ability actually is. It makes me wonder if there's some kind of 'counter' like a 'puncture' that works from the unit to reduce the defense itself when encountered. It would be helpful to identify what that unit 'ability' is tagged as.

    hmm... I could take a look at the code but I'm working on some other things here and every time I've looked into bombarding to try to understand it I come up with the opinion that its terribly overcomplicated in its programming because I get lost somewhere along the calculation path. Then again... its been a while since I really looked into it.

    As stated above, perhaps its that the strength of bombings gets around defense differently by a less visible variable on particular units.

    That person actually isn't me. This is an Afforess design issue where bombardment is concerned I believe. It's behaving with all the same nearly bug-like concerns I've had since I played AND and I just haven't really tried to sort it all out (though I have interacted with some of the codes in places I think...)

    I had THOUGHT I'd read that Koshling had resolved all this but apparently I must've misunderstood what he was saying he'd done with bombardment defense a while back.

    I'd actually suggest to put it at 95% for now. HOWEVER, what I'd REALLY like to do is NOT change it all that much. Instead, I'd like to make it have a diminishing return mechanism applied to it. A while back, ls612 and I put a diminishing return (not sure if we completed this project) on withdrawal and I came up with an idea as to how we could generate this sort of thing on any value quite easily. I think the total Bombard Defense should apply to a diminishing return.

    What this would mean is that after it exceeds 50%, the next points thereafter are half as valuable. So it takes a total of 100% to reach 75%. At that point, the value of additional points is 1/2 again (1/4) as valuable. Thus you reach something like 87(.5) with 150%. Then the next 50 pts are half again as valuable. Thus the next 50 pts gets you to 93.75 (reached at 200%) and it continues as such, never actually reaching 100% until fractions of a point over 99% make it impossible not to at an astronomically high actual % pt value.

    We really shouldn't have to cap it at this point.

    I thought that a fraction of an integer would ALWAYS round up in C++? Thus .1 = 1 if converted to INT? Is this inaccurate? Does it always round down instead?

    (Please define multiplicative in this context. I'm not quite following you on that. Surprisingly enough, I'm not well educated on mathematical terminology but have been learning a lot here in that realm.)

    Yeah, I looked at that field and kinda think its insane to have it set at 100% - I suggest 95% as a quick fix for now.
     
  15. Nimek

    Nimek Chieftain

    Joined:
    Jul 7, 2010
    Messages:
    1,179
    Gender:
    Male
    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.
     
  16. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    Integer arithmetic always rounds down.
     
  17. Mutasir

    Mutasir Chieftain

    Joined:
    Apr 18, 2012
    Messages:
    20
    Skiteiget leaderhead's icon is terribly oversized, which makes spiritual and financial traits leader list look awful and difficult to read (I am reporting it because I haven't played the mod for a few versions and that bug is still there).
     
  18. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,314
    Gender:
    Male
    Location:
    MN
    Which civ is that?
     
  19. Mutasir

    Mutasir Chieftain

    Joined:
    Apr 18, 2012
    Messages:
    20
    The Haida Empire.
     
  20. n47

    n47 Chieftain

    Joined:
    Aug 20, 2013
    Messages:
    352
    Location:
    Amsterdam
    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?

    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.

    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)

    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%).

    This too can't reduce the bombing strength totally to 0, if only bombard defense bonuses are < 100%.

    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.

    @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);
    		}
    	}
    }
    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). :crazyeye:

    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.
     

Share This Page