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

Really...weird...ctd

Discussion in 'Civ4 - Creation & Customization' started by Merkava120, Jul 25, 2016.

  1. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    312
    Location:
    Not Turkey
    So, I have been fighting a ctd on the first city found for a few days now, and I finally isolated the thing that's causing it. I just have no idea why it would be.

    The crash happens when these two things happen:
    1. A civilization is given TECH_USA (a disabled dummy tech, given to the Americans in this mod). This can be a free tech, given through worldbuilder, researched, whatever - it causes the crash no matter which way they get it.
    2. The civ builds a city.

    If the civ has the tech, but doesn't build a city, the game goes along fine and dandy. If the civ doesn't have the tech, they can build a dozen cities and everything's fine and dandy. But if they have the tech, as soon as the first city is built, the game freezes and CTD.

    Nothing else causes the crash; I took out my python and DLL and ran it alone, and it still crashed with the tech and was fine without it.

    I am totally lost. :confused: Is there a way a technology can cause the game to crash, but only on the building of a city??

    The technology's xml is below in the spoiler.

    Spoiler :

    <TechInfo>
    <Type>TECH_USA</Type>
    <Description>Murica</Description>
    <Civilopedia>what's a civilopedia? like a wikipedia for civilians...???</Civilopedia>
    <Help/>
    <Strategy>Just a dummy tech for the US troops.</Strategy>
    <Advisor>ADVISOR_RELIGION</Advisor>
    <iAIWeight>0</iAIWeight>
    <iAITradeModifier>0</iAITradeModifier>
    <iCost>1</iCost>
    <iAdvancedStartCost>100000</iAdvancedStartCost>
    <iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
    <Era>ERA_ANCIENT</Era>
    <FirstFreeUnitClass>NONE</FirstFreeUnitClass>
    <iFeatureProductionModifier>0</iFeatureProductionModifier>
    <iWorkerSpeedModifier>0</iWorkerSpeedModifier>
    <iTradeRoutes>0</iTradeRoutes>
    <iHealth>0</iHealth>
    <iHappiness>0</iHappiness>
    <iFirstFreeTechs>0</iFirstFreeTechs>
    <iAsset>8</iAsset>
    <iPower>0</iPower>
    <bRepeat>0</bRepeat>
    <bTrade>0</bTrade>
    <bDisable>1</bDisable>
    <bGoodyTech>0</bGoodyTech>
    <bExtraWaterSeeFrom>0</bExtraWaterSeeFrom>
    <bMapCentering>0</bMapCentering>
    <bMapVisible>0</bMapVisible>
    <bMapTrading>0</bMapTrading>
    <bTechTrading>0</bTechTrading>
    <bGoldTrading>0</bGoldTrading>
    <bOpenBordersTrading>0</bOpenBordersTrading>
    <bDefensivePactTrading>0</bDefensivePactTrading>
    <bPermanentAllianceTrading>0</bPermanentAllianceTrading>
    <bVassalTrading>0</bVassalTrading>
    <bBridgeBuilding>0</bBridgeBuilding>
    <bIrrigation>0</bIrrigation>
    <bIgnoreIrrigation>0</bIgnoreIrrigation>
    <bWaterWork>0</bWaterWork>
    <iGridX>-1</iGridX>
    <iGridY>-1</iGridY>
    <DomainExtraMoves/>
    <CommerceFlexible/>
    <TerrainTrades/>
    <bRiverTrade>0</bRiverTrade>
    <Flavors>
    <Flavor>
    <FlavorType>FLAVOR_RELIGION</FlavorType>
    <iFlavor>9</iFlavor>
    </Flavor>
    <Flavor>
    <FlavorType>FLAVOR_GOLD</FlavorType>
    <iFlavor>1</iFlavor>
    </Flavor>
    <Flavor>
    <FlavorType>FLAVOR_CULTURE</FlavorType>
    <iFlavor>8</iFlavor>
    </Flavor>
    <Flavor>
    <FlavorType>FLAVOR_GROWTH</FlavorType>
    <iFlavor>2</iFlavor>
    </Flavor>
    </Flavors>
    <OrPreReqs/>
    <AndPreReqs/>
    <Quote>"This is not a researchable tech." - Merkava120</Quote>
    <Sound>AS2D_TECH_MYSTICISM</Sound>
    <SoundMP>AS2D_TECH_MP_MYSTICISM</SoundMP>
    <Button>,Art/Interface/Buttons/TechTree/Mysticism.dds,Art/Interface/Buttons/TechTree_Atlas.dds,4,11</Button>
    </TechInfo>
     
  2. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    312
    Location:
    Not Turkey
    Update: Just got weirder. I moved the tech to be at some random place besides -1,-1 in the tech display bar thing. Now it's crashing still, but sometimes it waits a turn after I build the city. I can't tell any difference between crashing on the city build and crashing one turn later.

    Don't know if it's relevant, but the one-turn-later crash happens after I build the first building (because it's currently the only thing to build besides a settler and takes 1 turn, so I build it every time to test it out). The building requires the TECH_USA.
     
  3. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Now that you mention a building depending on the tech, the crash doesn't look so weird. Just double check the art of the building and of its button, in particular the path of the button. Or of any other object depending on the tech. In itself, the tech is not the culprit.
     
  4. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    312
    Location:
    Not Turkey
    Interesting. I just removed the tech from the picture and removed the requirements for the building, and now it's still crashing. Seems that if a person can build that building they can't found a city.

    The building's art is just set to ART_DEF_BUILDING_BUNKER, so unless something's seriously wrong I don't think it's that - do you think could it be one of these other lines? I can't remember whether or not I touched any of them, but if I haven't then they're just copied over from the palace.
    Spoiler :

    <bCenterInCity>0</bCenterInCity>
    <iCost>1</iCost> (I did change this one)
    <iHurryCostModifier>50</iHurryCostModifier>
    <iAdvancedStartCost>-1</iAdvancedStartCost>
    <iMinAreaSize>-1</iMinAreaSize>
    <iMinLatitude>0</iMinLatitude>
    <iMaxLatitude>90</iMaxLatitude>
    <fVisibilityPriority>10000.0</fVisibilityPriority>
     
  5. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,457
    Location:
    israel
    hey buddy,
    try to replace the art tag.

    also, i dont recommend setting all the attributes to -1, just stick the tech away somewhere.
    i mostly mean the grid numbers.

    ctd is hard to track sometimes, do you use custom dll?

    &#1488;&#1514;&#1492; &#1497;&#1513;&#1512;&#1488;&#1500;&#1497; &#1504;&#1499;&#1493;&#1503;?
     
  6. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    312
    Location:
    Not Turkey
    Switched it to ART_DEF_BUILDING_CASTLE. Art showed up in game, game crashed after building the building.
    Evidently that's not the problem.
    (Unless you're meaning the tech's art define?)

    Sort of - currently using vincentz's range strike DLL found here.

    Nope sorry, the name "Merkava120" comes from this, not from this. The "120" is the caliber of the gun on the tank.
     
  7. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    312
    Location:
    Not Turkey
    (My apologies if anyone has actually been reading this. Up to this point, it's been a jumbled mess.)

    The current situation is this: I currently have all my techs, units, and buildings removed except for the palace, the settler, and one TECH_NONE which is used for making projects unbuildable without having to get rid of them.

    • If I add any other techs in, the game crashes about 1 out of 4 times I start it up, always after founding a city.
    • If I add any units in, the game crashes every time I found a city, no question.
    • If I add any buildings in, the game crashes every time I start it up, either on city found or when I build the building.

    No idea what's going on.

    Some things I do know:
    • It's not a missing art define; or if it is, it's Civ's missing art define and not mine.
    • Removing the DLL, Python and GlobalDefines.xml changes nothing.
    • If I don't build a city at all, the game works fine, even with absolutely everything added in.



    Spoiler :
    Okay, sorry for a really disorganized post, but here's the actual question: could having a bunch of techs all with the same artdefine mess anything up?

    Original story version in spoiler below.

    Sit rep: The game is crashing roughly 1 out of 4 times, and seems to be unaffected by the DLL or python. Currently, the techs I added are all active, but the units and buildings are not (except for my special settler, which is just a normal settler with warlord art and a different name).

    Update: After taking the above and commenting out all of the techs except TECH_NONE (a dummy tech to effectively get rid of almost everything, without actually deleting it all), I haven't gotten a crash. Tried it 4 times.

    I still don't really know what's going on, but it seems to have something to do with the techs.

    Spoiler :
    So, to update (mostly because this is a funny story, I doubt this can really be helped much anymore):

    I went through and started removing parts of the mod, to find out what specifically was causing the crash (because apparently it wasn't the tech).

    With the Python, DLL, GlobalDefines, units (except for settler, animals, and great people), techs (besides the few dummies I had), and the building I added all removed, the game worked great.

    The last thing I removed was techs; while trying to comment them out, the game got mad that I had quotation marks between the <Quote> tags, so I deleted everything between the quote tags, commented out the techs, and lo and behold, no crash.

    Assuming it was the techs, I put them back in (minus quotes), and...still no crash.

    So I uncommented the building I'd removed, and the game crashed upon building it.

    So I commented that out again, and uncommented the units I'd put back in. Crash on city build.

    So I removed everything back to not having units or buildings; no crash.

    So I stuck the Civ4GlobalDefines back in; no crash.

    All seeming good. So I stuck the Python back in; crash on city found.

    Took Python out, put DLL in - game crashed.

    Removed DLL. (At this point, I have all my XML modding in there, minus units and buildings.) Crash again - what the monkey?

    Tried it again, just to see what would happen. No crash...

    Put the DLL back in, then kept firing up the game over and over again to see if it crashed ever. It crashed on city build the first three times, and now it's not crashing again.

    So that's where it stands. DLL in; game not crashing, no idea what the bloody mary is going on.

    Edit: Just tried it a couple more times; one crash, one not. I think I've fired the game in its current state about 15 times and 4 have been crashes. 26% crash rate.

    Edit 2: Added back in the python; same crash rate.
     
  8. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,457
    Location:
    israel
    Hi, yup, i got it that its the tank :).

    Ok i think vips code is solid.

    Upload here your whole mod folder, add savegame b4 the ctd, if you got the version of vip you got exatly, upload it aswell.

    I will try to get the source of the ctd for you, no promises, im not a coder,, but got a lot of ctd hunting exp.

    Cheers.
     
  9. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    hmmm... I would try with a fVisibilityPriority of 1.0 (like the bunker) (to be sure).

    Try to run the game without the custom dll but with a debug dll (you can find it in CFC database) and see if you get any error message before a crash. Note that a debug dll makes the game significantly slower.
     
  10. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    312
    Location:
    Not Turkey
    (Throughout this, 'enable' means 'uncommented the thing and added it back into the game'.)

    I got this as soon as I started the game:

    Spoiler :
    Assert Failed

    File: CvXMLLoadUtilitySet.cpp
    Line: 1295
    Expression: bSuccess
    Message:

    Got it 5 times without enabling stuff, 3 times when I enabled the building.

    When I enabled a unit and the game crashed on building a city, I got this error:

    Spoiler :
    Assert Failed

    File: CvGlobals.cpp
    Line: 819
    Expression: e > -1
    Message:


    When I enabled the building and the game crashed, it froze so much I couldn't copy and paste, but said something about missing TECH_1943 in EspionageMissionInfo.

    So far I haven't been able to get it to crash with the techs enabled, but it did give me this message on startup, along with the ones from before:

    Spoiler :
    Assert Failed

    File: CvGlobals.cpp
    Line: 3493
    Expression: strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
    Message: info type BUILDING_USA_ENGINEER_BATTALION not found, Current XML file is: xml\Buildings/CIV4BuildingInfos.xml


    :woohoo: You're the first person to ask me if I'm Israeli that actually knows what a Merkava is! (Which surprised me a lot at first, but now that I think about it, not many Americans would be able to point out Abrams tanks either, so whatever :D)

    Ok! Attached the mod folder with vincentz's DLL. It's actually just his rangestrike mod, not the full VIP.
     

    Attached Files:

  11. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    312
    Location:
    Not Turkey
    Let me know if I need to explain how the mod works or anything, it could be pretty confusing at this point, because I haven't gotten too far yet :p
     
  12. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    I'm not versed enough in C++ to understand the error message.
    If you look in CvGlobals at line 819, you will see that it's about Advisors. It is very important to have an Advisor for every building/unit/tech enabled. I changed the Advisor of the UNIT_USA_BATTALION_COMMANDER from NONE to ADVISOR_MILITARY (whatever valid) and the game did not crash on me when I founded the 1st city - contrary to my first test.
    We might have to come back to this.
    This message is simply because you did not disable the building in the BuildingClassInfos file.

    I don't have time today to further explore your mod but do tell us of your progress. I don't know where this mod is going exactly (maybe you don't either! :D) but it sure looks intriguing!
     
  13. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    312
    Location:
    Not Turkey
    :thanx:
    Well, what do you know, that was the entire problem! It seems that every time a city tried to build a unit, if it wanted to put an advisor on there and there wasn't one, the game would crash.
    That explains all the different crashes - it would almost never put an advisor on the only buildable thing when the settler unit was the only thing available, so it never crashed then; but, if a tech, building, or anything else enabled other units, it'd try to advise on them and :vomit:

    So, now it's working totally fine. I'm 90% sure the EspionageMissionInfo errors were all related to the python I've added - building groups of units at the same time instead of individually. The bSuccess errors might have been related to the commenting - I had less of those errors the more stuff I enabled.

    Haha thanks! Will do. :thumbsup: I might start a thread about it eventually, when I get closer to uploading, because there are some things I need ideas for. Right now it's nowhere near finished though.
     
  14. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    I'm glad that it works for you now and that you can continue with your mod. :)

    The EspionageMissionInfo is the last file to load when you load a save game so it is wrongly referenced in the error message.

    You might be right about the bSuccess one.
     
  15. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    4,116
    Assert failures means some variables are outside the intended range. CvXMLLoadUtilitySet.cpp deals with loading xml files, meaning you have something set in xml, which isn't as the game expected. Basically it tells you that it might cause issues or behave differently from what you would expect, but it might work.

    The problem is that vanilla has some quite horrible assert messages when it comes to xml reading and it doesn't actually tell what went wrong, just that something went wrong. The way to figure out what went wrong is to use a debug DLL and run with a debugger attached and then examine the code/variables when the assert triggers. It's an ok approach for seasoned DLL modders, but it's not friendly towards xml modders.

    That's all I can say and I can't figure out more. I'm temporally without a debugger, meaning I can't even debug it for you to pinpoint which files/tags, which triggers this.
     

Share This Page