debugging CTD due to only xml changes?

davidlallen

Deity
Joined
Apr 28, 2008
Messages
4,743
Location
California
Sigh. I am getting a consistent crash to desktop in my total conversion. I have not done any SDK changes and I am not using any other mods which contains SDK changes. I have some python; but the CTD still occurs when I hide my python directory. So the only thing I have modded is my XML. Well, I have a mapscript too, but that isn't active when the game is running.

I do not have any SDK setup, and anyway, if I got a crash trace that pointed me into lines of the SDK code it wouldn't mean anything to me. I have logging and python exceptions enabled, but I don't have any local python going and none of the debug logs have anything helpful.

The CTD always happens, but not at the same place. I am able to play the game up until sometime around turn 100, during the other civs' turn.

I *suspect* but I have no way to prove, that the crash is coming because my tech tree is relatively short and some of the items have no visible reason for the AI to build. So I think the AI has run out of things to research, and crashes as a result.

I have read through several debugging threads including "HOW TO: isolate crashes" and TGA's Python tutorial.

Are there any other good sources of debugging tips?

I guess I am not quite good enough at using worldbuilder to understand Kael's instructions about the "little hammer". How do I delete players in worldbuilder? The erase button erases everything in a square, including terrain, and that is the only deletion tool I can find. The "little hammer" method sounds a little indirect but it is the only tip I can find to help me.

Any suggestions? No python involved, no SDK involved, no SDK debugger available.

EDIT: it isn't due to lack of interesting techs. I have an autosave from two turns before a crash, which is reproducible, and in worldbuilder I can see both of the AI players have techs which are useful, that they have not researched. Also I added a "sink" technology which has all flavors and gives +3 health, +3 happiness. Everybody should want this, and the cost is huge, so I know nobody can actually achieve it.

I hope somebody can point me at more threads to read for inspiration.
 
Hardpoint was a prerequisit for itself in the file I downloaded. Could that be the problem?
 
@jefmart1: yes, there were several problems in the promotions, including a comment! which caused some of the prereq's to be messed up in v0.1. I have fixed those so hardpoint no longer causes a loop. Glad to hear you have downloaded the alpha! I'm interested in any feedback you may have, even if there isn't much there yet.

@primordial: thanks for the suggestion. I have checked the units, promotions and techs for loops, and I can't find any problems. Sadly a CTD can be caused by almost anything.
 
New buttons, yes; but no new models or audio. I can try pulling all the dds files and just letting the pink squares show up; but the buttons are all displayed correctly at the start of the game.

This is a total conversion, which means all of my promo, units, buildings and tech XML files are highly customized. I can't conveniently pull any one of the files out, to find which one may be the cause; reading the standard bts file would cause hundreds of errors. I am hoping there is some tool, or debug technique, which will let me know the cause of the crash with less blind experimentation.
 
I like the tech and the promos, you need to get the models for the units in before anyone else will probably play the mod. I was disappointed that there was no Road Warrior promo...

If you want the Road Warrior feel though you need to limit guns, especially after the first movie ammunition was apparently hard to come by. Maybe add crossbow tech and flamethrower tech?
 
If anybody has suggestions, it'd really help. I could upload the xml and a save game which will reproducibly crash after 1-2 turns. I have modifed "quick" mode to make everything 10x faster, and now I am getting a crash on most new games by turn 5-10! No idea how to track down what is wrong.
 
I would be astonished if this CTD was due to art, but then I don't really have any idea what is causing it. Anyway if you could run your script that would be great. Please find the totally crashing test release here.
 
There aren't any problems with missing art. I do get a consistent CTD in 3938BC.

Thanks for the confirmation. My current theory is that if the AI starts near the ocean, without a good food source nearby, a crash happens because I removed workboats. Tonight I will try putting those back in.
 
Well, I learned more about debugging but still no solution.

The crash is highly related to AI cities near the ocean. As long as all the AI cities are inland there is no crash. If an AI starts on the coast it will crash in 2-3 turns. If an AI puts a new city on the coast it will crash within a few turns.

I have added back bWaterWork on one of the techs so water squares can be worked. I have added back work boats and the fish bonus. I have verified that I can work water squares and build work boats. Neither of these changes made any difference to the crash.

For debugging, I have now learned about ctrl-z in cheatmode, which displays everything. Now I can see a lot more about what the AI is doing, including what it's building, and what techs it has. I can't figure out how to see what tech it's researching. That makes me feel better but doesn't solve the problem.

I still don't have any good ideas about what to do next. I have put up my current files in a zip in case any kind soul wants to look; the link is three posts back.
 
Well, I do not have a smoking gun, but I have something which makes my mod ""much less likely"" to crash. In my mod, I have a super-quick mode, for testing purposes only, which almost always causes a crash within 10 turns if the AI starts on the coast. If the AI is not on the coast, there is usually a crash within 40 turns, which is usually when the AI founds a new city on the coast.

After long sessions of different experiments, which I won't bore you with the details of, I added a lighthouse and great lighthouse to my list of buildings. The crash is not "gone", but it never crashes in the first 10 turns and only seems to crash after the great lighthouse is built.

I don't have any idea why lack of lighthouse/great lighthouse is important; I guess an AI city on the coast may have some interest in building it, and maybe the AI devs forgot some kind of check in the case where there are no buildings to improve water yield.

I will keep testing to see how often CTD's happen in my mod with a lighthouse there. Maybe that is what I needed to get "over the hump". It's kind of ironic that lighthouses and a water economy are needed for a Mad Max, desert style mod.
 
This is so disappointing. In ten runs of 100 turns each, I am still getting crashes in 8 of them. In two cases it crashes within the first five turns. I have tried putting back in all the resources/improvements/buildings I had removed. I have tried taking out all the resources/improvements/buildings I had added. The only thing left is the techs. Of course I can take the techs out, but then what is the point of a mod?

Perhaps if I take a break from this for a few days then it will not seem so pointless.
 
I have created a much smaller set of files which still crashes 100% of the time in the first 100 turns.

I have not made any python or sdk changes and I am using BTS 3.13 with no mods. I have changed 7 XML files and there is no problem. But when I change one more XML file, I always get a crash within 120 turns. I have spent days removing and replacing bits of the XML to understand why, but this is totally the wrong way to go about it.

In case anybody wants to see the files and reproduce, here are the detailed instructions.

1. Download and unzip my file from this link into CustomAssets (96 Kb download).
2. Start a game with any settings you like. I use pangaea map, tiny size, everything else default
3. CyGame().setAIAutoPlay(120) in the console.
4. Crash!
5. In CustomAssets/xml/units, replace CIV4UnitInfos.xml with unit-noncrashing.txt
6. Run again with any settings as many times as you want.
7. No crash!

Here are details of the changes I made.

1. Stub out EventTriggerInfos, EventInfos, CorporationInfo, and ProjectInfo files
2. In BuildingInfos, remove all but 12 buildings.
3. In CivilizationInfos, remove all the UB and UU references.
4. In UnitInfos, remove the references to buildings I removed. (This creates file unit-noncrashing.xml above).
5. Strip down UnitArtStyleInfos so it only references settlers
6. At this point I can run the game many times and there is no crash.
7. In UnitInfos, remove all but about 12 units.
8. Now it is always crashing.

Putting in and taking out little bits of XML is a very tedious way to try to find the problem, and I am close to giving up on modding this game because of it. Can anybody suggest a more efficient way to develop?
 
Thanks for the suggestion. Many of the scenarios distributed with BTS, such as Charlemagne, have a stubbed out projectinfo file just like mine. Also, in my crashing example, adding back one project has no effect on the crash.
 
Back
Top Bottom