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. Alex_

    Alex_ Chieftain

    Joined:
    Aug 23, 2013
    Messages:
    1
    Hello

    Game runs fine, but my savegames are faulty.
    When the error occurs,all following savgames have an errror,and
    game chrashes to desktop while loading the savegame.

    I have the latest (from 13.08.2013) version of C2C.
    Here I have a functioning savegame and a few round later created faulty savegame.
    I hope someone knows what is going wrong here.

    View attachment savegame.zip

    Mfg Alex
     
  2. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    25,218
    Gender:
    Male
    Location:
    Las Vegas
    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.

    Ah... VERY nice to finally know that for sure! Thanks!

    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.


    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.


    Ah... yeah, doesn't work like that at all.




    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.

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

    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.
     
  3. Talin2009

    Talin2009 Chieftain

    Joined:
    Jul 12, 2009
    Messages:
    604
  4. n47

    n47 Chieftain

    Joined:
    Aug 20, 2013
    Messages:
    352
    Location:
    Amsterdam
    @Thunderbrd, ok, so we want to build a base on Mars, but we don't know how to add and multiply. ... Hmm... :crazyeye:

    Primary arithmetic: you perform operations from left to right, but multiplication and division always goes before addition and subtraction. So
    Code:
    a + b + c * d + e + f / g * h  =  
    a + b + (c * d) + e + (f / g * h)  =  
    (((a + b) + (c * d)) + e) + ((f / g) * h)
    The education in the US is one of the biggest horrors of this world. :(

    No. The "(100%-25%)(100%-20%)(100%-10%)" part can be stored in a field like it is now. At the beginning the field has value 100%, and when a building is built the value is multiplied by (100% - the bonus). When a building is destroyed the value is divided by (100% - the bonus). -- It is even faster then the diminishing return.

    It doesn't fix the problem in this case. -- An arsonist have 5% of bombing strength, then if the factor is even 85%, then the result bombing strength is 0.75.



    Btw, one more thing. I can improve getCommander() function and move most of the evaluation in the place when a commander ends his move. This would also fix the mechanism of caching the best general, which is not correct. Probably there will be far less commanders' moves, then callings of getCommander(), so the performance can quite improve, if this function is really called millions of times.

    But in exchange, you will have to sacrifice your first-born children to me. :devil:
    Or Thunderbrd will need to learn the arithmetic.
     
  5. Taxman66

    Taxman66 Chieftain

    Joined:
    Aug 3, 2012
    Messages:
    872
    Gender:
    Male
    Location:
    Columbia, Maryland USA
    V32

    In the 'pedia the Windhorse promotions are associated/shown on the scientology page (I know it's a wacky religion but that's not right), and don't show on Tengrii page. Additionally the new Tengrii promos don't show on Tengrii page either.
     
  6. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    25,218
    Gender:
    Male
    Location:
    Las Vegas
    Ah... I was only ever shown:
    Maybe it was the fault of the education and maybe it was that I never felt I would have use for it so was bored to tears trying to learn something I figured wouldn't be useful to learn. It could also be that I spent a lot of time NOT using any of it until now where I have to try to dredge up knowledge long ago labeled useless in my mind. No longer do I feel it's useless so I'm likely to remember now. Thanks for the explanation... that's going to make a reading this coding a lot easier.

    I'm sorta following you here. That would then mean that the defense is expressed as 100% = 0% actual defense level right?

    Oh now don't blame me for even a portion of THAT mess. I believe Koshling did pretty good to put a quick patch on a big problem we stepped into there. But it would be interesting to see what you'd do with it.

    I have no problem with units without enough bombard strength being muted to the point of being unable to damage the defenses of the city. It's when it doesn't seem to make rational sense that it's bothersome. A city with THAT high a bombard defense being something such a ram would encounter in a war against an opponent of a like-tech level brings to mind the possibility that perhaps the ram isn't set to do enough damage in the first place.

    However, it's not tough to get a number to round up if you wish... simply add one (or better yet .99) to the division result.


    On a side note, while you're not hesitant to be a touch caustic (;) ) I do appreciate your input a great deal. It makes me wonder how much you could contribute to helping us with debugging and basic coding improvements overall. It sounds like you know what you're doing at the level Koshling and AIAndy operate at - quite advanced.

    Keep in mind that for me personally, I'm more of a game designer struggling to learn how to program while Koshling and AIAndy are programmers applying themselves to game design in their off time. I personally haven't programmed in C++ before this venture and as a result, although I may do a lot, I try to keep it absolutely simple what I do. So I pick up some knowledge as I go (and so far I've picked up a lot from where I started) but Koshling and AIAndy I think have taught each other a great deal in their meetings of the minds and I have a feeling you'd be right in there with 'em. I'm sure we could all use your help as much as you're willing to provide it.
     
  7. n47

    n47 Chieftain

    Joined:
    Aug 20, 2013
    Messages:
    352
    Location:
    Amsterdam
    It is reasonable. I've been thinking about this too. Just wanted to mark the diminish return does not influence this case. :)

    Yup.

    Not one hundred percent sure, what that means. But if it is what I think, yes, I am not. I terribly dislike to make people feel bad. But if I do not use harsh words, many will not mark them. Or even if, they will be like "ow, there is a problem ... but who cares". And then people are wondering, from where this climate change, why 25% of Americans will probably have a cancer and why does those Arabians hate us so much? :eekdance:

    This is the fault of flying pink elephants, which are flying all over the world and hypnotize children to not learn. :D Surprisingly, it can be not so far from the reality. In many countries, the level of the education falls and one quite possible reason is, that some fat pink elephants, like politicians and rich guys with power, reached some conclusion about, which people are easier to control. -- It may be unclear, but school is far more then just knowledge gaining, as by gaining this knowledge you learn to reason, analyze and make conclusions. -- Which society would you say, is better to control? With this abilities or without?

    Ow great, again the politics. Maybe I should take some pink elephant safari to let off some steam. :sniper:

    I am quite sure, you are able to learn it with your intelligence. Still with your current abilities, it may hurt the project. Even a simple code can generate serious bugs. Look
    Code:
    int x = 4 * (1 / 2)
    You could mention to multiply four by one half. But this code will cause a division by zero.

    From the other hand participating in such projects is a great possibility to learn. Maybe you could post the code you write on the forum before you commit, so somebody could look at it first?

    Not to much. I do not think the C2C is too reasonable in these days. But don't take me wrong. C2C is a great project, but the engine of Civ4 is far too weak for it. C2C should have its own signed engine to perform correctly. Besides, it would need enormous amount of very skilled men to make a reasonable AI for a such complex game. I think it is out of the scope of even the greatest game developers. Probably the only hope in this case would be a well developed multiplayer, which again needs another engine. So it does not make too much sense. I can contribute a little as I like this mod, but I want to use the most of the time that I have left for something more reasonable. But if you would want to make C2C stand alone, hmm, maybe I could recalculate my time. :smoke:
     
  8. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    If you think you can improve it please post said improvement. It get called about 10^8 times in large game turns, mostly for units that have no commander (hence the first level of caching). The second level of caching has to reflect the target unit's movement during the turn (which can be between calls to getCommander) as WELL AS the commander' own movement however, so you cannot assume that if the commander has not moved then the unit is sill in command range.

    With current optimizations this method is not very significant on profiles however, so don't spend too much effort here.
     
  9. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    It's not FOR VS2010! It's for VS2008. Feel free to create a VS2010 one (or VS2012 even) if you wish.
     
  10. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    Minidump reveals obvious bug - fix will be on the SVN sometime later today.
     
  11. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    Turn completes ok for me with ranged bombardment on. Maybe it's an interaction with other option settings...I have opportunity fire on, archer bombard off. Could you give me the full set of settings for that panel that you are getting hangs with please on this save.
     
  12. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    Terminated fine for me after circa 1 minute. Reproducible for you by just loading the save and hitting end turn? Any unusual game options? Viewports in use or not? Got a BBAI log?
     
  13. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    Working fine for me with default (40X40) viewport. What viewport settings are you using? Do you have a minidump?
     
  14. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    This one reproduces for me - working on it now...

    Edit (@DH et al):

    The cause is that the DLL didn't cope with an unusual inconsistency (?) in he XML. The building BUILDING_SUMARIAN_ZIGGURAT has the following XML:
    Code:
    		<BuildingInfo>
    			<BuildingClass>BUILDINGCLASS_SUMERIAN_ZIGGURAT</BuildingClass>
    			<Type>BUILDING_SUMERIAN_ZIGGURAT</Type>
    			<AndDependencyTypes>
                 	<DependencyType>RELIGION_MESO</DependencyType>
     			</AndDependencyTypes>
    			<SpecialBuildingType>NONE</SpecialBuildingType>
    			<Description>TXT_KEY_BUILDING_SUMERIAN_ZIGGURAT</Description>
    			<Civilopedia>TXT_KEY_BUILDING_SUMERIAN_ZIGGURAT_PEDIA</Civilopedia>
    			<Strategy>TXT_KEY_BUILDING_SUMERIAN_ZIGGURAT_STRATEGY</Strategy>
    			<Advisor>ADVISOR_ECONOMY</Advisor>
    			<ArtDefineTag>ART_DEF_BUILDING_SUMERIAN_ZIGGURAT</ArtDefineTag>
    			<MovieDefineTag>NONE</MovieDefineTag>
    			<HolyCity>NONE</HolyCity>
    			<ReligionType>NONE</ReligionType>
    			<StateReligion>NONE</StateReligion>
    			<bStateReligion>0</bStateReligion>
    			<PrereqReligion>RELIGION_MESO</PrereqReligion>                   
                 ...
    
    The combination of having a <PrereqReligion> religion but NOT a <ReligionType> causes this crash under certain circumstances. This is due to something of an internal inconsistency in the DLL code (which I'll fix), but the XML itself seems somewhat inconsistent - what is the intention of a building having a religious preReq but not being a religious building?
     
  15. n47

    n47 Chieftain

    Joined:
    Aug 20, 2013
    Messages:
    352
    Location:
    Amsterdam
    However it is wrong. -- When a new general will come in the range of a unit and the unit have already cached a general, the old one will be used, even if it has worse experience, then the new one. And I can not see this mechanism can be easy fixed, as there is no way for a unit to be aware of new generals coming in the range, except scanning each time the whole range, which I believe is out of the question.

    What do I have in my mind
    - remove the cached general mechanism from the unit
    - add a field with a list of generals which are in the range to the plot class
    - add a field with the best general to the plot class
    - add to the move method the following
    Code:
    when the move is done:
        if the moved unit is a general,
           remove the general from the lists in the plots from the previous range 
           and correct the best generals fields for them
           add the general to the lists in the plots from the new range
           and correct the best generals fields for them
    - correct tryUseCommender to update the best general field in a plot, when it has no more CP
    - change getCommander to:
    Code:
    if the plot has non-empty best general field, then return it
    else return null
    If the compiler is wise enough, getCommander should work with performance of the current first if. :) But if there is a problem I didn't think out, please correct me.

    Unfortunately, from what I can see the VS2012 is out of the scope, as its libraries conflicts with boost 1.32 . -- Microsoft - always cares about the best standards ... of their wallets. -- I wanted to switch to Qt with mingw, but I checked its performance and they do not look too optimistic. So I guess I'm convicted to VS2008 or 2010. ... Let's pray. :deadhorse:
     
  16. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    In regard to the proposed change - I accept that this would result in more functionally correct behaviour BUT I'm concerned that the memory scaling would not justify it - even empty lists on plots are expensive (CvPlot is the one class we really want to keep small [well CvUnit too really]) because there are a LOT of them. HOWEVER, we may be able to fix things a slightly different way without (much) performance hit and without any memory scaling:

    When moving a general (ONLY) scan all in-range plots and simply clear the commander caches of any units in them. Leave the actual getCommander code as it is. Since general moves are extremely rare (elative to the number of calls to getCommander), this should not have much of a performance hit, but should address the bug you have identified, without requiring any more persistent state to be maintained (32-bit processes suck).

    In regard to VS2012 - WHATEVER VS you use (as your visual editor) you MUST set the paths up for the makefile (which I ultimately invokes) to use the VS2005 express libraries and compiler, which BTS was built with. If you do no do that the runtimes and (potentially) calling conventions between the DLL, the game EXE, and the Python libraries will not align correctly and crashes result. About a year ago I spent a considerable amount of time (a couple of weeks) trying to isolate the runtime dependencies via an interface layer, in order to enable the DLL to be built with more modern compiler/libraries (because AVX optimization using an INTEL compiler was found to be a significant gain) but was unable to get I working, because Microsoft have changed some exception handling conventions in their complier/runtimes since the 2005 version, which I couldn't get around.

    Using VS2012 as your editing/debugging environment should work fine, provided that the paths in makefilepaths are set up correctly and the project file is just invoking the makefile (not trying to build directly itself)
     
  17. God-Emperor

    God-Emperor Chieftain

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    It looks like the Modiki is wrong about what the ReligionType tag is for. It says "If set, the Building can only be constructed if the specified Religion type is present in a city within the Civilization (though not necessarily in the city where it is being constructed)." However, this setting is never checked in the canConstruct code. It is referenced in several other places, like which buildings are associated with the state religion for purposes of getting the gold from the Spiral Minaret. So it is used for associating the building with a religion, not for determining if it can be constructed.

    BTW, as long as I am talking about religion related tags, the bPrereqReligion tag in the building XML is misnamed (or the way it works is backwards). If you set it the building can only be built if there is no religion in the city (as per the check of kBuilding.isPrereqReligion() in CvCity::canConstructInternal, where it returns false if the religion count is > 0). So based on what it does it should really be named "bPrereqNoReligion". This "it doesn't do what it sounds like it should do" issue is probably why nothing uses it either in BTS or C2C. I think it also works the same anti-intuitive way for the same tag in the unit info.
     
  18. n47

    n47 Chieftain

    Joined:
    Aug 20, 2013
    Messages:
    352
    Location:
    Amsterdam
    Ha ha, something close to this was my first idea. And I also considered the size of the map and I thought, it will be not so painful to add amortized 5 bytes for a plot. If the map would even have something like 2000x1000 it gives 10MB. In compare with what C2C devours now, it's invisible. Or maybe maps can be bigger? :mischief: If it indeed is a problem, I still may have a better solution. If only successful moves is significantly less then few millions.

    Already figured that out. Well, if it is so used to 2005, I believe gcc was a dream from the beginning. :rolleyes: Btw, I do not care about the IDE , I am worried about MS compilers. :scared:
     
  19. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    Paths 1 and 2 are correct because:

    1) Apothecary takes path 1 because it has 2 movement points and will arrive in the same turn, with this path leaving it the maximum unused movement

    2) Axeman only has 1 movement point and cannot get there in one turn, so it chooses the path that leaves it on best defensive territory between moves. One could certainly argue the merits of this, given it's inside its own territory, but it's behaving as intended

    Path (3) however, is clearly a bug - I am able to reproduce it, and am looking into it now...
     
  20. n47

    n47 Chieftain

    Joined:
    Aug 20, 2013
    Messages:
    352
    Location:
    Amsterdam
    You are wrong my friend. The axeman indeed can't get there in one turn, but if he would go with the road, in the next turn he would still have 1/2 of move, but if he will go like it is at the pic, in the next turn he will have 0.

    edit
    About the tool chain, you've said about VS2005, but the linker fails with it. In the makefile it was 2003. Have you misspelled?
     

Share This Page