Weird crash

Civciv5

Grand Emperor
Joined
Aug 14, 2011
Messages
2,111
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.
 
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?
 
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
 
-Any unit with the promotion City Raider I crashes the game if it attacks a city with walls
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.
 
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.
 
Do you still have the entry for ART_DEF_UNIT_SIEGE_TOWER in the CIV4ArtDefines_Unit.xml file?
 
Do you still have the entry for ART_DEF_UNIT_SIEGE_TOWER in the CIV4ArtDefines_Unit.xml file?
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.
 
I'll try adding the siege tower art.
Where is the source code for the DLL?
You mean all the files you used to compile the DLL? Or including all the BtS files?
 
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.

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
 
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
 
Why is it even defined in the DLL?
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.
 
Stupid question, don't art defines in mods fall back to the base game if missing?
 
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.
 
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.
 
Okay, I guess it makes sense that you don't want a mod to load a bunch of unneeded graphics.
 
Back
Top Bottom