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

What needs fixing before we release V34

Discussion in 'Civ4 - Caveman 2 Cosmos' started by Dancing Hoskuld, Dec 23, 2013.

  1. JosEPh_II

    JosEPh_II TBS WarLord

    Joined:
    Jun 20, 2007
    Messages:
    15,911
    Gender:
    Male
    Location:
    Western IL. cornfields
    Looks like I'll stick with Win 7 Pro 64 for awhile longer. This comp is still using win XP Pro 64 and I rarely have problems with it's OS. They just want to push everyone into this "Cloud" business and eliminate your choices for individuality. Or even owning your own PC. MSoft just wants you to "rent" an OS not own one anymore.

    JosEPh
     
  2. Jonius7

    Jonius7 Chieftain

    Joined:
    Aug 27, 2012
    Messages:
    89
    Windows 7 is a pretty good and stable choice, especially since it improved on Vista.

    I need to ask, what is happening with the Pedia routes page?
     
  3. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,925
    Gender:
    Male
    Location:
    Las Vegas
    DH is still trying to get it to properly interface with the new widget for it. I'm 90% sure the widget is currently setup correctly though there IS that 10%. I've just gone over it 3 or 4 times to make sure is all.

    Not sure what's making it difficult and since I think he's not sure either it sits as is.


    If we must wait for a few weeks, I'd like to ask AIAndy and/or Alberts to look into the BEST way to fix the integer overload situation we get on property values that sets in around the modern era. We COULD change it from an int to a long long but not only will that take up a lot more memory, it will also probably be eventually overwhelmed again during the galactic era so I'm hoping we can come up with something of a better method to resolving this problem. It's really the only truly major bug I'm currently aware of needing fixed.

    That and... who's court would it be in to take a look at adjusting the research times? They are coming in a bit too fast in general but particularly in the earliest stage of the game. I'm not terribly aware of which large scale modifiers should be used to adjust this back to balance so I didn't want to touch it myself.
     
  4. 0100010

    0100010 Prince

    Joined:
    Mar 31, 2008
    Messages:
    428

    Which properties is this overload affecting, and why are their values rising so high to cause this to happen?
     
  5. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,925
    Gender:
    Male
    Location:
    Las Vegas
    Pretty much all of them from what's being reported. Levels are rising so high because the property change values are rising so high by those eras. Supposedly anyhow.
     
  6. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,538
    Gender:
    Male
    Location:
    MN
    DH is away from his main PC with his Mum. And probably wont be back for 2-3 weeks.
     
  7. 0100010

    0100010 Prince

    Joined:
    Mar 31, 2008
    Messages:
    428
    Your telling me that pollution, disease, crime, etc. are reaching 2147483647, or -2147483647 (I assume your talking about a signed int), by the late era? That is really insane. There should be minimum and maximum caps at much lower values than that. But even more than that, how can the increase rates be that horrendously bad to begin with? Compounding additions? It sounds like you have things that or getting counted/added in more than once, or all the increment numbers need to be divided by 100.

    The simplest fix though should be going to the spots that update the raw property value and inserting min and max checks.
    set { if ( _property + value > maxvalue) _property = maxvalue; else _property += value; ..and similar for a minimum if needed... }

    Other example. What is the maximum number of turns on Eternity?

    If I have an active volcano that has existed since turn 1, upping it +10 smog plot value every turn, what value is that going to be at on the last turn? Now Why should it ever need to be that high? Of course your probably talking about cities, but I'd just say the same thing.

    2nd point. Does negative pollution, crime, disease, etc make any sense? (I do not mean negative adjustments but a negative final value.) I recall seeing negative pollution values on plots with positive features, and don't really see the point in it. If you change your base properties from int to uint (and prevent negative numbers from being assigned) you can double your positive range of valid values and keep the memory size the same.
     
  8. Faustmouse

    Faustmouse Deity

    Joined:
    Jan 31, 2012
    Messages:
    3,508
    Negative values for properties were discussed in the electrical power mod discussion. For me, they don't make sense (as you can't have less then no crime etc), but TB said that it was the tendency that people consider crimes so it can go negative. I still don't get it and think from a logical point there is no reason why they should get negative, but it is nice to see if you had -1 or - 1000 for example, just for planning. But good ideas though. No need to have Pollution higher then 2000. I think the main problem here is that the + Pollution per turn can get so high that it gets negative. Therefore, it might be better if you had no Rangers in your city then having 100 of them :crazyeye:
     
  9. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,925
    Gender:
    Male
    Location:
    Las Vegas
    Absolute maximums and minimums have been something I wanted to setup to help with the Electricity property too so that's probably the way to go actually.
     
  10. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,409
    Absolute maximums and minimums without adequate changes to the propagators risk making the mathematical model unstable. They also introduce a luck dependency on the order in which the property manipulators are processed.
    The same is true for making the ints unsigned.
    64 bit ints are considerably slower than 32 bit ints in 32 bit programs, especially division. Hard to say how much that would slow down all the property solving.

    How high do the sources get at that time?
     
  11. Pef

    Pef Chieftain

    Joined:
    Jul 2, 2009
    Messages:
    84
    also gold tends to go insanely high once world bank is built
    then it caps and goes negative around 2 bil gold.
     
  12. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,925
    Gender:
    Male
    Location:
    Las Vegas
    The problem, never addressed since, was discussed in depth here among other places harder to locate.

    So... what would we need to do to make absolute max and min values for property volumes on specified game objects safe for the mathematical model? That discussion goes beyond the needs of bugfixing but also relates greatly to the Electricity property.
     
  13. alberts2

    alberts2 Emperor

    Joined:
    Aug 16, 2012
    Messages:
    1,943
    Gender:
    Male
    Location:
    Germany
    I think not the actual values(properties and possibly commerce) cause overflows but possibly some calculations do. If the resulting values of the properties become to high in later eras they are probably just not balanced right. Commerce values are different because they can only reach MAX_INT/100 e.g. we already had some problems with Culture after MrAzure added those CultureLevels.
     
  14. 0100010

    0100010 Prince

    Joined:
    Mar 31, 2008
    Messages:
    428
    Why is this so, what would make it unstable? Is propagation dependent on the source value changing, or is propagation triggered merely by an attempt to change the value regardless of whether it has or not? (such as being at the max/min) Why would luck be involved in the order of property manipulator processing? Is it not the same order each time? Are you using multiple thread that make race conditions on who gets to change the value first? (that's my first though as to how luck might come into play)

    Does it really matter who gets to change the value first, so long as all of them get the chance to change it? If the base property value is already so close to the maximum that 2 out of three upward adjustments result in no change, how harmful is that?

    If perchance the above happen, and then a downward adjustment happen, you have a lower base value at the end of processing the 4 adjustors. Whereas, if the downward adjustment happen first, followed by the 3 upwards adjustments, the base value could well hit the maximum again. However, in this case, won't it self correct within the next turn or two? While this might lead to some odd, unreliable delta trends when at the maximum (or minimum) if the maximum is sufficiently above the target value of the "worse case" (example pollution at 2000?) weird turn to turn deltas deriving purely from variable process order, that don't dip it back below 2000, won't matter much.

    Finally, how do you gather all your adjustor deltas before applying them to the base property value? Do you allow each potential adjustor to access and change the property directly or do you sum up all of the possible positive and negative adjustors to get a final adjustment value and apply that to the base value only once (for a given turn). If the latter case, processing order should not alter the final adjustment value.
     
  15. JanusTalaiini

    JanusTalaiini Prince

    Joined:
    Dec 12, 2005
    Messages:
    340
    Yep, can confirm. I run into this every single game.
     
  16. alberts2

    alberts2 Emperor

    Joined:
    Aug 16, 2012
    Messages:
    1,943
    Gender:
    Male
    Location:
    Germany
    A save from before this happen could help to fix this.
     
  17. Stormwind

    Stormwind King

    Joined:
    Dec 7, 2008
    Messages:
    697
    World Bank adds a (hidden?) x% (I think it was 5%) interest per turn on gold in the bank. At one point interest gets higher than any spending and that snowballs until gold reaches 32bit integer and goes to 0.
     
  18. Sparth

    Sparth C2C Team Member

    Joined:
    Oct 6, 2013
    Messages:
    2,311
    Gold imbalance was adressed in past few months and need serious look. I think when I end with EDU (its almost ended) Ill try to create serious raport about gold income and Ill try to find solution for this problem.
     
  19. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,477
    Gender:
    Male
    Location:
    Canberra, Australia
    I may not be at my modding computer but I found two pieces of code missing from the pedia for routes. Unfortunately it is still not working. I get the following error.

    Code:
    Traceback (most recent call last):
    
      File "CvScreensInterface", line 443, in pediaMain
    
      File "SevoPediaMain", line 314, in pediaJump
    
      File "SevoPediaMain", line 399, in showContents
    
      File "SevoPediaMain", line 796, in placeRoutes
    
      File "SevoPediaMain", line 1013, in placeItems
    
    RuntimeError: unidentifiable C++ exception
    ERR: Python function pediaMain failed, module CvScreensInterface
    @Thunderbrd can you have a look at this. Last time the wigets were in the wrong order and part of the problem this time was I was using the wrong one.
     
  20. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,409
    We currently have constant sources that add or remove from the system total, decay that removes a percentage of the system total each turn and moves it towards 0 as total sum and diffusion which does nothing to the total sum (it just distributes it different). When no further sources and drains are added, it moves towards a state of flow balance.
    If it is calculated well, that is (which it currently is not good enough but I will get to that later). A strict limit in the values can disturb that. Of course there is the possibility to have some weaker limits like a stronger decay on negative values.

    The dynamic properties are solved once per turn, regardless if they changed or not.

    Multiple threads are indeed used. Propagators and sources are split among the threads.

    Order only matters in regards to percentage based manipulators like diffusion and decay. The order of the constant sources does not matter at all. It might well be that a cut after all property calculations once per turn works well. Depends on a try. But it definitely has to be considered where exactly to apply it.

    All property manipulators compute their delta on all properties on all objects. This is then summed up on each object and afterwards all property manipulators get a chance to revise their delta. The result is then summed up again and actually applied.

    After careful consideration I don't actually think that we have a case of integer overflow as the cause. It can happen as a result but the amount of sources needed for it to be the prime cause would be excessive (anything up to 5 million per turn added in a single city should still work and what would be the point of it with only up to around 1000 having a real effect).
    My prime suspect is the diffusion propagator on trade routes. The problem is that trade routes are not symmetric and neither is the diffusion propagator. A single application of it only works in one direction. So we get a maze of one way diffusions with some cities being the target of a huge amount of trade routes.
    If that city is then very low on crime while the other cities are not, the difference causes a moderate flow of crime from each of those cities which sums up to a number that rivals the difference in the first place. The revising step is not strong enough to counter that so the city ends up with high crime after a single turn. The net effect is that crime is now more concentrated than before and some strong trade cities will start to oscillate between high and low crime.

    For now I'd suggest to remove the diffusion to trade cities until some counter measures are made. It did not make sense in the first place for properties like pollution anyway.
     

Share This Page