Mod crashes vs Vanilla crashes

gascooker

Chieftain
Joined
Apr 4, 2007
Messages
19
Location
London
Can anyone explain this:

Since patch [.275] I have managed to now play 12 vanilla games from start to finish without any crashes. I have played various maps, difficulty levels and civs, and it still has not crashed once! :)

My PC is quite high spec:
24Gb Ram, i7 2.30Ghz, ATI HD5800, windows 7, blah blah blah

But whenever I test my mod the game randomly crashes at un-repeatable random moments - sometimes after 100 turns, sometimes after 200 turns, sometimes after 50 turns. The modded game can be reloaded, but will crash again after about another 50 - 10 turns. This is how my vanilla game acted before the .275 patch.

Before anyone logically blames my Mod for this, should consider that this happens when my mod consists only of:

Spoiler :
<GameData>
<Language_en_US>
<Update>
<Where Tag="TXT_KEY_LEADER_MONTEZUMA"/>
<Set Text="Fiery Pants"/>
</Update>

</Language_en_US>

</GameData>



In a further test, to reduce the overwhelming complexity of my mod, my new mod consists only of this:

Spoiler :
<GameData>

<!-- the most awful mod of the century-->

</GameData>


Does this mean that even the simplest change to the game makes it unstable?

**BTW my actual real mod is very much more complex than above, but if changing just one TXT item, or just changing nothing in a new mod makes the game crash, how should I proceed??:confused:
 
I knew that mods crashed more often, and assumed it was dangling DB pointers of some bizarre sort or something, but if that's the case then it sounds worrying. I may mention it on the official forum's bug thread (as a second-hand report), in that case...
 
It's a bit worrying, especially if you spend ages making and testing a mod for errors, only to find out that there is perhaps something more mysterious at work than an XML typo...;)
 
Does this mean that even the simplest change to the game makes it unstable?

I hadn't thought to do that test, but it really isn't surprising to me now that you've done it. I'd been tracking down crashes in my own mod, and I long ago came to the conclusion that the crashes weren't direct consequences of my mod, but the result of some interaction with existing functions.

For instance, let me give a simple scenario. Random bit of grassland. You build a Trading Post on it. You reach the modern era, and find out that there's actually a Uranium on that tile. You move a worker onto the tile and tell it to replace the post with a mine.
This crashes the game on a regular basis.
Not all of the time, not even most of the time, but often enough that people who test my mod have spotted the pattern. Any removal of an existing Improvement seems to lead to crashes, even if I have no custom Lua code triggering off of SerialEventImprovementCreated or SerialEventImprovementDestroyed. And if the AI does it off-screen during its turn, you'll still crash anyway. Since AI worker behavior is probabilistic, this won't happen every turn, but will get steadily more likely as the game goes on.

So it looks like simply the fact that you're using a mod causes the conflict. Somewhere in there must be some flag about whether you're using mods at all or not, and that flag is causing some override in basic behavior. This is obviously not a good programming practice.
 
That's an interesting test! Especially when you can spend hours looking for crash reasons in a mod and don't find anything wrong and the game don't give you a clue to why it's crashing.

A flaw in the game would explain much unexplained crashes.

Any removal of an existing Improvement seems to lead to crashes,

I have experienced the same with my mod : removing a farm to make a trading post will sometime crash the game when you trigger it with your worker.

What's odd is that didn't touch those improvements in my mod and I didn't changed the workers abilities.

In the same field : sometime my mod will just crash while moving a unit near a foreign border (or I suppose a foreign unit). After some cleaning of the mod all units are working fine, I didn't touch the diplomatie and this crash still randomly happens.
 
What's odd is that didn't touch those improvements in my mod and I didn't changed the workers abilities.

In the same field : sometime my mod will just crash while moving a unit near a foreign border (or I suppose a foreign unit).

It makes more sense when you realize that both of these have one thing in common: the execution of multiple animation-based Serial Events simultaneously. In the case of replacing an improvement, it's triggering SerialEventImprovementDestroyed and SerialEventImprovementCreated at the same time; one removes the old improvement, the other adds a new one. In the case of moving near a border, the game is updating the terrain graphics and units for the tiles revealed by your movement, so it might be refreshing several different tiles at once. (Especially noticeable if you scouted an area in ancient times and then don't go back to take a closer look until the modern era.)

The crash, then, might be that it's trying to trigger multiple animations at once, especially multiple ones on the same tile/unit.

For instance, in my own mod someone just recently posted a log after a crash that showed something interesting happening during an AI turn. In my mod, I've got two combat events, one that triggers at the start of combat and one that triggers at the end. Each has a print statement to help me out.
At the time that one player's game crashed, there was one very interesting thing in the log: a single AI unit was being bombarded twice by cities belonging to another AI (meaning this happened between player turns). Each of these presumably involved an animation, as they were activating RunCombatSim. But the strange part was that the second combat started before the first had finished. That is, it started A, then started B, then ended A, then ended B. Since both of these combats involved the same unit defending, I can see why it would crash as a result. (B started and A ended on the same millisecond, so there wasn't much overlap, but they went into the log in that order so it's clearly not forcing the game to wait until the previous one finishes.)

So maybe they're having the game bypass certain timing-based checks while in modded mode, with those checks preventing two animations from activating simultaneously. (Since mods have additional overhead, it's understandable that you'd have to loosen these sorts of restrictions.) It's not good programming, but it'd explain what we're seeing.
 
I have now played 18 epic vanilla games with the new patch (.275) and it has not crashed once! Well done Fraxis - the patch works for me. Apart from the minor annoying reported glitches, it does not now crash.

But still, I can't even reach the middle ages with a simple MOD that changes just one text entry. :mad:

While I understand that the need to make the vanilla game at least work without crashes would be paramount, is it an oversight in programming that makes modded games crash, or an intentional plan until all of the DLC is exhausted?:crazyeye:

Or maybe it is me just being stupid. If anyone can spot anything wrong with the following MOD, then please put me out of my misery and tell me.

The entire mod is just this:

Spoiler :
<GameData>
<Language_en_US>
<Update>
<Where Tag="TXT_KEY_LEADER_MONTEZUMA"/>
<Set Text="Fiery Pants"/>
</Update>

</Language_en_US>

</GameData>


And, yes, I have loaded into ModBuddy correctly, and deleted the cache before launch, etc etc...
 
Back
Top Bottom