Game-Crash Troubleshooting

Article written by Lord_Fadawah
Originally published on 04-08-2004 ; updated on 08-17-2014
Tags: Troubleshooting

All designers, no matter what their skill level or graphics card, will invariably come across crashes at some point or other. Like death and taxes, they are a part of life. I have been waging a perpetual war against them these last few years, and I believe that I understand everything about them.

Ever been in the middle of some kick-@$$ campaign that is going knock flat everyone who plays it, and then at a certain point the THE GAME STARTS CRASHING?! It's not AoK's fault, and it's not your computer's fault. Most likely, it is your fault. I'm not flaming you, just saying that generally it is sloppy triggerwork that causes crashes.

If your scenario is crashing continually at one point in the game, then don't take it lightly. If it crashes for you, then it will certainly crash for anyone else who downloads and plays it. Find out what it's cause at once.

Part I -- Crash Causes

Common causes for game-crashes are:
a) Large numbers of triggers/effects firing at once
b) Issues with the map design
c) Issues with trigger layout

I will address each of these issues seperately.

A) Large numbers of triggers/effects firing at once. This is probably the most common reason. If you have 30+ effects in a single triggers you are almost certain to have a crash when the trigger in question is fired. Normally, you are safe with around 8-12 effects in each trigger. Any more is to tempt fate. If you need lots of effects, then "space" them out with multiple triggers. One trigger with a dozen effects fires, activates another trigger with a dozen more after 3 seconds, activates another one after that...etc.

B) Issues with map design. Sometimes it is not the actual triggers, but the map itself that is responsible. Large map copied areas are sometimes responsible, so use map copy sparingly. If you copy an area that is larger then, say 40x40 tiles, then it could be the problem. Sometimes the map size can contribute, although I have yet to see a scenario crash purely because it's on a gigantic map. Use units sparingly. Huge battles between thousands of units will almost guarantee a crash, aside from causing masses of lags. As if you need another reason to avoid designing such scenarios. :)

C) Issues with trigger layout. By this I mean problems or bugs with the triggers themselves. The three most notable culprits are the "Task Object" "Remove Object" and "Kill Object" effects. The reason these three are so deadly is that they can work "globally", affecting units all over the map. Say you are creating a trigger in which King Aelfric is tasked inside his capital city. When you are selecting King Aelfric, your fingers "trip" and you click the empty bit of grass beside him accidently. Now, since no real unit has been selected, when you test the scenario EVER UNIT ON THE MAP BELONGING TO THAT PLAYER will be tasked! If that doesn't cause a crash then nothing will! The problems are the same for "Remove Object" and "Kill Object", they have the potential of affecting every unit on the map, and not just the unit you wanted. So whenever you specify a particular unit with the above effects, be CERTAIN that you have clicked him. Afterwards, click the "Go To Object" button, just to make sure it is the unit you have selected. No harm in a pound of prevention.

So that is the basic ways that crashes can happen. Now we will look at the ways that they can be prevented.

Part II -- Crash Prevention

Let's say that your scenario is crashing, what can be done about it? It can be hard when you have over 100 triggers, and don't know which one is to blame.

1. Save the scenario under a different filename. It wouldn't even hurt if you save it under five or six -- the more, the better. You always want to have lots of "crash guinea pigs".

2. Open one of your crash guinea pigs (make sure it IS a crash guinea pig, and not something you really care about!) and disable all triggers. In most cases this will stop the crashes: but sometimes it won't. If this is the case, then scroll down to the postscript to find out what to do.

3. With the triggers disabled, reactivate them one by one, testing each time. If the game crashes after you activate a certain trigger, chances are you've found the culprit. Study the effects. If it has one of the three effects mentioned above, be suspicious. Remember, they can have a global effect, so most likely they are to blame.

The second way to hunt for crashes is even more ruthless. It is useful if you have loads of triggers and don't have the time to test them one by one.

1. Save under different filenames (if you haven't already). This time, five or six will be necessary.

2. Open one of your crash guinea pigs, and delete around half of the triggers (starting from the end of the list). Then, test it. If it crashes, you will know that the trigger causing the crashes must be in the remaining half. (If it doesn't crash, then skip down to no.3., otherwise just keep reading) Then, reload AoK and delete half of the remaining triggers. Keep on doing this, eliminating triggers until you find the one causing the problems.

3. OK, so the crashes stop. You know that the culprit must have been one of the triggers you deleted. Then, load one of your other crash guinea pigs (remember I told you to make multiple copies) and delete a quarter of the triggers. Keep on doing this until you find the crash-causer.

Hope that's been of use to people. :)