ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Internal Error

From ModEnc
Revision as of 18:02, 20 May 2007 by Bachsau (talk | contribs) (→‎Figuring out your IE from Except.txt: Figured out a new code. :))
Jump to navigation Jump to search
Tiberian Sun's Internal Error
Red Alert 2's Internal Error
Yuri Revenge's Internal Error
RockPatch's Internal Error

The Internal Error (commonly known as IE) is a general error returned by the Tiberian Sun engine and its derivates. The message itself is rather ambiguous, giving no information what went wrong, and leaving it to the modder to know what could have caused the error and to find this cause in his code.

If you experience an Internal Error, the best course of action is to think whether a distinctive event immediately preceeded the crash (e.g. a unit being built, a weapon being fired...), or, if this is not the case (or not the cause), to tripple-check your latest code modification(s) - at best with the help of a diff between the current rules set and a previous, working one (for this reason, and in case you mess up your code beyond repair, you should always keep recent backups of working code).

Note that, the more code you add at the same time, the more likely it is to introduce multiple bugs and causes for crashes. Just because you found one mistake in your code, doesn't mean there can't be another one, also causing an IE (or being the one that caused the IE in the first place).

Except.txt

If your game crashes through an IE, a file called except.txt is generated in your game folder. This file is a dump of certain runtime-data from the game at the point of crash, and could potentially tell you exactly what went wrong - if you knew the engine code.
pd has, every once in a while, found a pattern he recognized, and could, for example, tell when an except referenced the voxel loading routines, thereby pinpointing the IE to a voxel issue.

However, more often than not even pd can't help - without the source code or in-depth knowledge of the game code, the file is rather useless to one. (cp. SYNCx.txt)

According to an early version of Except.txt (which now redirects here), this file includes the full structure and a stack dump of a CONTEXT element.

List of known Causes of Internal Errors (please expand)

Since "Internal Error" is the game's response to almost any fatal error, its causes are diverse. Most common are causes related to weapons and warheads, with a missing warhead probably being the all-time no. 1 cause of Internal Errors.

Weapons-related Causes

  • Pointing to a weapon that does not exist (possibly caused by a simple misspelling of the correct weapon's name)
  • Making the game use a weapon that wasn't parsed beforehand (by having it attached to a unit, an example being shrapnel-weapons that aren't assigned to a dummy unit)
    • A subset of this happens when you try to use a weapon in a game mode override file that wasn't attached to a unit in the main rules
  • Attempting to use a weapon without a projectile.

Warhead-related Causes

  • Having a weapon's Warhead tag point to a warhead that doesn't exist (e.g. through a typo), or having no warhead-tag at all
  • CellSpread must not be bigger than 111
  • Setting off a warhead with a CellSpread that is also Template:TTL
  • Sometimes, warheads that are not listed under [Warheads] can cause an IE

Other Causes

  • An MCV turns neutral: If a player's MCV was mind-controlled by an enemy, that player is killed, and the MCV is then released from mind-control, an Internal Error will be caused by the fact that the MCV tries to return to its original owner, but said owner is not a legal faction of the game anymore. One workaround is to make MCVs unable to be mind-controlled, this is the way it is done in the YR 1.002 UMP. Neutral Construction Yards do not seem to be a problem.
  • If a falling paratrooper (who has nearly reached the ground) is killed by an area-effect mutation weapon, an IE will be triggered. Point based mutations seem to be okay and the Genetic Mutator seems incapable of killing falling paratroopers. If you have an area-effect mutation weapon, you should ensure that all paratroopers are immune to it.
  • Template:TTL. If the AI uses a Weather Storm or Nuclear Missile superweapon and a building with HoverPad=yes exists, the game will suffer an IE. This IE can, however, be prevented by uncommenting the flag Template:TTL (change the values if you like).
  • Omitting Template:TTL on InfDeath 9's animation (Template:TTL) can sometimes cause an internal error. See MakeInfantry for more information.
  • Using the 'sell unit' super weapon on a tank-bunkered unit breaks the Tank Bunker. Attempting to sell or destroy the broken Tank Bunker causes an Internal Error. The only possible fix is to make sure a player never ever has access to both the "Sell Unit" Super weapon and the Tank Bunker at the same time - in reality, this means you can only have either of them...not both.
  • Adding a new harvester for a 4th side/faction and not making an AI Trigger for it will cause an IE
  • The modding concept known as "Infantry Linking" can result in an IE, occuring when the linked infantry was modified in a subsequent game mode override file or a map and a human player scrolls to a place on the map where coordinates on which an AI-owned War Factory is located are visible on his screen. Once again, the only solution is not to do it.
  • If you have a buildable Construction Yard, start its construction, and then cancel it, an IE will occur. Same solution as above.2
  • Calling for an animation that is not listed under [Animations] might trigger an Internal Error
  • If you build a unit ingame whose voxel or shp you put into an original game mix instead of a proper expansion mix, you'll have a Close Encounter of the Erroneous Kind
  • Not having at least one valid InfantryType with Template:TTL (default) for each house will lead to an IE on load
  • Setting Template:TTL will cause an IE. (Default value is -1, positive values do not cause an IE.)
  • A certain side's Construction Yard not having Template:TTL set leads to that side's AI causing an IE.
  • Removing a building from the PrerequisitePower= list, while it exists in one of the (GDI/NODRegular/Third)PowerPlant= lists will cause IE the moment any of your Power buildings gets destroyed or sold as long as you own a Construction Yard. (For example, YR mods that remove Yuri's Army from the game, should never remove YAPOWR from PrerequisitePower=).

Footnotes

1 In certain versions, RockPatch does allow a higher value.

2 According to this post, the poster has found a solution to allow this. This has, however, not been confirmed independently.

Figuring out your IE from Except.txt

Since all IEs caused by one and the same reason share the same EIP: value in except.txt, knowing that value might help you pinpoint your IE. The following is a small and incomplete list of EIPs and their corresponding IE reasons.

EIP Cause
Yuri's Revenge 1.001
004145BD You have tried to give infantry a spawn weapon (Such as ASWLauncher)
0042E7AF An AI player deployed a conyard which has Template:TTL set.
0046650D You have a shrapnel weapon which isn't assigned to a dummy object.
004895C7 You have a warhead whose Template:TTL exceeds 11.
0050CE14 You have a BuildingType with Template:TTL, but you need to restore the [[[:Template:TTL]]] → Template:TTL line.
0050CE5C You have a BuildingType with Template:TTL, but you need to restore the [[[:Template:TTL]]] → Template:TTL line.
005D7387 You need at least one InfantryType with Template:TTL
006AEBB8 Your ra2md.ini file lists a combination of mpmode/map which the game cannot satisfy.
006F40A2 You have an object referencing a WarheadType that isn't defined.
0071AF4D You have a shrapnel weapon with a Template:TTL warhead.
0073B0C9 Infantry Linking.
004F8CCD You've listet less than 3 BuildingTypes at BuildConst= in [AI] Section and lost or sold your last listet Construction Yard while on low power. If you've already lost it, the IE will trigger when you run out of power after that.
Common
90900004 Generic exception, for example, raised when you are missing the snowmd.ini median fix.

Software used to find Internal Errors

  • INI Checker (can check your rules, art and sound files for syntactic errors like typos and missing references)
  • ExceptChecker (primarily for RockPatch-related IEs, it analyzes except.txt, tries to find references to code added by the patch or known routines, and might then be able give a direction)
  • Debugger (if you know assembler)

See also