Best Method to Troubleshoot CTD

sman1975

Emperor
Joined
Aug 27, 2016
Messages
1,375
Location
Dallas, TX
Hello,

Am working on an "omnibus" mod - one that combines several different mods into a single product. Had to do this because I play with a certain set of mods, but when I added a mod or two lately, there seem to be some conflicts between them.

Soooo.... After many long hours of building the mod, atlases, etc., I finally got to play all my favorites as a single mod. Worked beautifully. Until turn 200.... Fortunately, the autosave kicked in on that turn. When I pressed "Next turn", CTD. The usual "Access Violation" error.

Reloaded the Turn 200 game. CTD. Loaded the turn 198 autosave. On turn 200, CTD.

I had debug set, and reviewed the LUA, XML logs and had no errors.

I also went back to autosave on turn 150, then turned on LiveTuner for 22 turns - NO CTD.

I used IGE to add each of the 75 new buildings and they work fine. IGE'ed in the 25 new units and they work fine as well.

I have Visual Studio 2013 installed, but as I'm not using a custom DLL, I don't have any of the PDB files needed to use it properly (if I understand how it is used properly). I'd love to figure this out, but so far have not found any useful "step by step" instructions to get it working. I'm the kind of guy who needs this to nug through something complicated...

Question: When you're troubleshooting a mod and encounter a repeatable CTD, what are the steps you take to figure out how to fix it?

Appreciate any and all suggestions. Currently, I'm going through the process of removing "Actions" from the mod, rebuilding, then reloading. Unfortunately, I'm concerned that I still may not be able to isolate the fault this way as if I use the turn 200 save game, the problem will probably already have been introduced. Using the earlier game means it may not be introduced at all.
 
Ask yourself 1st what is happening at the time of the CTD? Are you entering the Renaissance? If so, are any new civs added to the game by the modpack you are creating? Are these mods actually stable in combination with each other in their native "non-packaged" form? Are any civs missing the needed Spy Names ? Has anyone stated "NONE" or "NULL" or "NIL" for either a Unit-Class or Building-Class default unit/building? Does any building have an espionage attribute but no valid <Description> tag? Is any wonder giving a FreeBuilding or FreeBuildingThisCity but stating a BUILDING_SOMETHING instead of a BUILDINGCLASS_SOMETHING ?

Also, eat the elephant in pieces. Start from a stable mod-pack and then add in the elements of new mods one mod at a time, test stringently, then rinse/repeat for as many mods as you want to add to the modpack. Adding a whole bunch of stuff at once and only then testing is a recipe for CTD.

Also re IGE: if any building has an lua-script associated with it that fires when the building is constructed, testing the building by directly adding it to a city from IGE will not work. In these and some other cases related to policy-selection, the lua-events and other game-engine code related to the Building-creation and Policy-selection do not fire.
 
Thanks, LeeS - good advice on how to not to get into my situation... :lol:

The mod using only original BNW civs, so it must be related to the new buildings, units, or techs. Most of these were stacked towards the end of the tech tree, so crashing around 500AD may limit the search a bit. I've ran a few more test games, and they all seem to die in the turn 180-210 time frame (Epic speed).

I'll relook the building/unit definitions, but I've tested them by adding every one of them to the game with IGE without incident. i don't think there are any lua-srcipts tied to new buildings, but I'll have to recheck to make sure.

If nothing obvious pops up, it's back to your advice of clearing out the Actions tab, then adding them back in one at a time, run a few 400 turn test games and see how it goes. All of the mods by themselves are stable, so hopefully this would clear up the problem. Fingers crossed!

EDIT: correct typos; found nothing glaring so far. So, it's back to adding the components in one at a time, test, rinse, repeat. And the B**** of it? I knew better beforehand, but simply combined it all anyways. Best practices only work if they're, uh, practiced... :nono:
 
Last edited:
Update: Using LeeS' advice, I was able to isolate the offending code. Luckily it was in the first mod component I reintroduced when starting from scratch. Odd little bugger:

Code:
<ArtDefine_UnitMemberInfos>
        <Update>
            <Where Type="ART_DEF_UNIT_MEMBER_PIKEMAN"/>
            <Set>
                <Model>true_pikeman.fxsxml</Model>
            </Set>
        </Update>
</ArtDefine_UnitMemberInfos>

The code looks quite ordinary - but when checking the debug database after the mod loads, the value of the "Model" element is "1" :crazyeye:

There's another block of code just after that performs the same function for a different Unit Member that works just fine.

I tried several approaches to fixing the command (renaming files, etc.) but it always resolved to "1" in the table. I could assign a different model name to the element and it would work like it's supposed to. Finally, I simply commented out that block (I'm good with the original Pikeman artwork), have ran a few 300 turn tests and everything works like it should.

Ugh.....
 
it's because of the way the xml-parser works

anything that starts with true is parsed as integer 1 in the sql database because there is no "true" or "false" in sql, there is only '1' and '0'.
 
ROTFLMAO..... Of course this explains it! Makes perfect sense, although in a bazillion years I never would have figured that out...

Odd how it works in The Crazy Scotsman's Omnibus mod, though - using XML. I guess it's not case sensitive, as I renamed the file "TruePikeman" and it still failed.

Thanks for clearing it up for me!
 
Back
Top Bottom