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

Weird crash

Discussion in 'Civ4 - Creation & Customization' started by Civciv5, Mar 31, 2016.

  1. Civciv5

    Civciv5 Grand Emperor

    Joined:
    Aug 14, 2011
    Messages:
    2,103
    Location:
    Nergenshuizen, Belgium
    In one of my mods the game crashes for an extremely weird reason.
    -I have a catapult with 3xp (lvl 2) and City Raider I promotion
    -This catapult attacks a city on a custom map
    -I have researched 50% of the tech tree I have made yet
    -This doesn't happen in the early game, catapults with all characteristics mentioned here can attack cities fine during the early game
    -The catapult can attack other units fine
    -I can conquer the city with other units
    -Happens with many cities accross the map
    -Catapult without promotion can attack city without crashing

    That problem isn't the only one.
    When I'm progressing to 235 AD, it also crashes. I can reach the year 235, but the game then crashes the my turn is complete.

    Anyone get some advice? I really need to solve this, or I might quit modding alltogether.
     
  2. Civciv5

    Civciv5 Grand Emperor

    Joined:
    Aug 14, 2011
    Messages:
    2,103
    Location:
    Nergenshuizen, Belgium
    I've isolated the cause.
    -Any unit with the promotion City Raider I crashes the game if it attacks a city with walls
    Please help?
     
  3. Civciv5

    Civciv5 Grand Emperor

    Joined:
    Aug 14, 2011
    Messages:
    2,103
    Location:
    Nergenshuizen, Belgium
    I've also discovered that the problem is caused by XML.
    -Removing the python folder doesn't help
    -Replacing the DLL doesn't help
    -It's not caused by the CIV4PromotionInfos

    Here is a link to my mod in progress, if anyone could help me locate the problem
     
  4. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,562
    That seems quite odd. My best guess is some xml value(s), which somehow triggers a divide by 0 crash, though that isn't really specific enough to fix the problem :think:

    I started downloading, but it appears to take a while. Once I get the chance, I will see if I can get the debugger to tell what goes wrong and hopefully trace it back to which xml setting is behind this.

    This might lead to a bugfix modcomp. Ideally the game will warn about poor settings, not just crash without any hint of what went wrong. Quite a lot of code checks for possible crashes and if it will crash, it just use some default value or similar. Not ideal, but still much better than a crash.
     
  5. Civciv5

    Civciv5 Grand Emperor

    Joined:
    Aug 14, 2011
    Messages:
    2,103
    Location:
    Nergenshuizen, Belgium
    It seems this happens with any defensive building. If I just add this little code:
    Code:
    			<iDefense>50</iDefense>
    			<iBombardDefense>50</iBombardDefense>
    To the granary building, any unit with the city raider I promotion also crashes the game.
     
  6. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,562
  7. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Do you still have the entry for ART_DEF_UNIT_SIEGE_TOWER in the CIV4ArtDefines_Unit.xml file?
     
  8. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,562
    ART_DEF_UNIT_SIEGE_TOWER is not present in any xml file. In fact searching for SIEGE indicates this could be a very overlooked part of your mod. Only a single unit has UNITCOMBAT_SIEGE. Lack of siege units shouldn't crash the game though, just alter balance significantly.

    I'm not sure about ART_DEF_UNIT_SIEGE_TOWER. If it's missing and needs to be used, then it will cause problems, but since it's not mentioned at all, will it be used anyway? I can't see anything going wrong with adding the vanilla code for ART_DEF_UNIT_SIEGE_TOWER though. If it is used, it fixes the problem. If it isn't used, it will not change anything and then we know that's not the problem.
     
  9. Civciv5

    Civciv5 Grand Emperor

    Joined:
    Aug 14, 2011
    Messages:
    2,103
    Location:
    Nergenshuizen, Belgium
    I'll try adding the siege tower art.
    You mean all the files you used to compile the DLL? Or including all the BtS files?
     
  10. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Lesson n°1 in Civ4 modding: do not delete the ART_DEF_UNIT_SIEGE_TOWER reference!

    It is the only one that is called directly by the dll. If you delete it without modifying the dll => CtD! :D
     
  11. Civciv5

    Civciv5 Grand Emperor

    Joined:
    Aug 14, 2011
    Messages:
    2,103
    Location:
    Nergenshuizen, Belgium
    Really? That's awesome!
    Why is it even defined in the DLL?
    Also, now that this is solved, can someone help me solve the question I asked in the Quick Modding Questions Thread?

    And of course thanks to both you! :D
     
  12. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,562
    Gremlins put it there. That got to be the reason as those are the only ones known to cause technical problems for their own amusement. Gremlin wannabes are usually referred to as trolls though.

    It's not in the DLL, but rather the exe. This difference means nobody in the modding community can answer the question without "I think/my guess". Most likely the real answer is that whoever placed it there thought of vanilla and didn't consider mods where it could be removed.

    The strings called from the exe has the benefit of being written in plain text if you open the exe in a hex editor. I just did and can confirm that ART_DEF_UNIT_SIEGE_TOWER is indeed present. At the same time it is the only place ART_DEF_ is used, meaning this one string is unique.

    The exe is full of TXT_KEY_s though. It might be a good idea to make a list of the strings present in that file once and for all.
     
  13. Leoreth

    Leoreth Prince of Blood Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,956
    Gender:
    Male
    Location:
    House of Hades
    Stupid question, don't art defines in mods fall back to the base game if missing?
     
  14. Civciv5

    Civciv5 Grand Emperor

    Joined:
    Aug 14, 2011
    Messages:
    2,103
    Location:
    Nergenshuizen, Belgium
    Apparently they don't.
     
  15. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    No, they don't. The file in the mod entirely replaces the BtS file, just like any other XML/Python file except for Text ones.
     
  16. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,562
    If you look at the file, the layout is like this:
    Code:
    <[B]Civ4ArtDefines[/B] xmlns="x-schema:CIV4ArtDefinesSchema.xml">
    	<UnitArtInfos>
    		<[B]UnitArtInfo[/B]>
    			<Type>ART_DEF_UNIT_LION</Type>
    			<Button>,Art/Interface/Buttons/Units/Lion.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,6,5</Button>
    			<fScale>0.61</fScale>
    			...
    		</UnitArtInfo>
    We are talking about a missing UnitArtInfo. However the game loads one Civ4ArtDefines and since there is one in the mod, it will not read the vanilla one. This mean the entire file is replaced, with missing types or whatever the modder can come up with. This is how most xml files work.

    Text xml files are different as it always reads the vanilla ones and then overwrite with those from the mod, effectively creating a hybrid where the mod version is used in case of name clashes.
     
  17. Leoreth

    Leoreth Prince of Blood Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,956
    Gender:
    Male
    Location:
    House of Hades
    Okay, I guess it makes sense that you don't want a mod to load a bunch of unneeded graphics.
     

Share This Page