Patch:Game errors

From KeenWiki
(Redirected from Patch:Errors)
Jump to navigation Jump to search

Game errors are problems that occur during gameplay that (usually) result in the crash of the game or the display of an error message. They are useful patch-wise in that a well constructed mod will never use these errors and they can be co-opted for other means.

There are four basic types of error encountered in the Keen games; the first are nonfatal errors, these will display an error message, but will allow the game to continue being played. An example of this is the 'Unable to play background music' error. The second kind are crashes, and they cause the game to crash leaving just a command prompt and (usually) a single line of text explaining technical details. These are the most common and least useful errors. An example is the 'too many animating tiles' error. The third kind of error is a freezing error, where the game will freeze, needing to be closed. An example is the animating tile freeze. The final category of errors will not affect gameply hugely but result in 'gibberish' or other limits on what can be done.

This page will cover two basic functions. The first is to identify errors and how they are triggered and thus aid the modder in avoiding them. The second will be to supply patches where possible to remove or modify error code or more useful purposes. (It may be useful to see Patch:Text patches

Since most errors occur in the Keen Galaxy series, all errors listed on this page apply only to Keens 4, 5 and 6 unless sated otherwise.


Nonfatal errors

As noted these are errors that show a message, but allow the player to continue, though not without consequences.


Low memory

This error is specific to Keen Dreams and occurs when the game is first being loaded into memory. If there is enough memory to run the game but not to ensure it will not crash, the screen will display a warning and offer the player the option to continue or quit. Pressing the 'C' key will allow the game to continue, any other key will quit the game.

Keen Dreams low memory error

#Text calls
%patch $3A64  [$01F2W] #Text called from 1
%patch $3A6F  [$023BW] #Text called from 2
%patch $3A7A  [$0284W] #Text called from 3
%patch $3A85  [$02CAW] #Text called from 4
%patch $3A90  [$02F0W] #Text called from 5

#Text
%patch $23C62 "There is not enough memory available to play the game reliably.  You can" $00
%patch $23CAB "play anyway, but an out of memory condition will eventually pop up.  The" $00
%patch $23CF4 "correct solution is to unload some TSRs or rename your CONFIG.SYS and" $00
%patch $23D3A "AUTOEXEC.BAT to free up more memory." $0A $00
%patch $23D60 "Do you want to (Q)uit, or (C)ontinue?" $00

#Key to continue
%patch $3AAB $2E


Disable\Ignore

This patch disables the low memory check. It will not disable the game crashing if there is not enough memory, only borderline cases. (Which should not occur on modern setups at any rate.)

Ignore Keen Dreams low memory error

#Ignore low memory (Frees $3A45-$3AB8)
%patch $3A43 $EB $74


Insufficient Memory to play music

This error occurs when after all the level and graphics have been loaded, there does not remain enough free memory to load the IMF music file selected for that level. The solution is to either use a smaller music file for the level or free up memory.

This error is both easy to diagnose and remedy. The first step is to load the level with the error. Using the memory test cheat (F10 + M) the amount of free memory without the music can be found. This can then be compared with the size of the IMF file needing to be played to give a good estimate of how much extra memory needs to be freed up. If a smaller music file is not desirable or cannot be found then more memory will have to be freed up. This can be constantly checked with the memory cheat.

There are three main ways to free up memory. The first is to physically shrink the level's size; each tile removed will free up six bytes of memory, so trimming a large level can save a lot. This however is often not preferable.

The second method is to lessen the number of different tiles in the level (This is why TED5 has a function to tell you how many there are.) each background tile will save 128 bytes and each foreground tile 140 bytes of memory. Again this may not be preferable, but a large level often contains many tiles that do not really add anything to it.

Finally certain sprites may be removed. Each sprite caches all its graphics into memory so it can display them A sprite can easily take up tens of kilobytes of space, the larger and showier it is, the more memory it needs. To remove a sprite cache, all instances of the sprite must be removed from the level, not one can remain.

A related solution is to edit the graphics, either making them smaller, or changing how many copies are placed into memory. (In theory this will make the sprite move less smoothy, but this is often hard to see.) This can halve or even quarter the amount of memory the sprite needs to run.

Insufficient memory to play music

#Insufficient memory to play music window -Keen 4:
%patch $8D18  $EB    #Never show (Free 8D1A-8D7F)
%patch $8D1B  [$0008W] #Height
%patch $8D1F  [$0014W] #Width
%patch $8D30  [$06ECW] #Text called from
%patch $2F55C "Insufficient memory" $0A
              "for background music!" $00

#Insufficient memory to play music window -Keen 5:
%patch $8C8A  $EB    #Never show (Free 8C8C-8CEE)
%patch $8C8D  [$0008W] #Height
%patch $8C91  [$0014W] #Width
%patch $8CA2  [$065EW] #Text called from
%patch $3099E "Insufficient memory" $0A
              "for background music!" $00

#Insufficient memory to play music window -Keen 6:
%patch $8AF2  $EB    #Never show (Free 8AF4-8B69)
%patch $8AF5  [$0008W] #Height
%patch $8AF9  [$0014W] #Width
%patch $8B0A  [$0656W] #Text called from
%patch $31386 "Insufficient memory" $0A
              "for background music!" $00


Not enough memory to load game

This error occurs quite simply when a saved game demands more memory than the game has. This usually happens if the game was saved in a different mod or different version of the same mod. In this case it is not the saved game or even necessarily the mod that is broken, there is simply an incompatibility between the conditions the game was saved in and the conditions it was loaded in. Even the smallest change can cause this. Working only with games saved in the most recent version of the game should fix this.

If this occurs in a completed or stable mod then it points to deep and unpredictable errors that can be difficult to fix. The best strategy is simply to attempt to discover what conditions cause this to happen, starting with which level\difficulty then looking for more specific subconditions such as the presence of a certain sprite.

There are two situations in which this error can arise and in Keen 4\6 they use different text. In Keen 5 they use the same text.

Not enough memory to load game error

#Keen 4:
%patch $5E82  [$0259W] #Text called from
%patch $2F0C9 "Not enough memory" $0A "to load game!" $00
%patch $5EFF  [$0279W] #Text called from
%patch $2F0E9 "Not enough memory" $0A "to load game!" $00

#Keen 5:
%patch $5E1C  [$01FEW] #Text called from 1
%patch $5E98  [$01FEW] #Text called from 2
%patch $3053E "Not enough memory" $0A "to load game!" $00

#Keen 6:
%patch $5C56  [$019DW] #Text called from
%patch $30ECD "Not enough memory" $0A "to load game!" $00
%patch $5CD3  [$01BDW] #Text called from
%patch $30EED "Not enough memory" $0A "to load game!" $00


Insufficient Memory to load level

This occurs when a level is too large to be played. It relates entirely to the size of the level. A good 'large' size for a level is 100x100 tiles, (See also level size limits in the 'other limitations' section.) A level that is much larger than this, in area (Height * width) will exceed the memory allocated and be unable to load. the only way to resolve this is to reduce the size of the level.

At present the exact maximum size of the level that can be loaded is unknown. however it also affects sprites and background music, for both of these to load (In that order.) there must be enough free memory after the level has been loaded.

If the levels do not trigger this error then the code space may be used for other things.

Insufficient memory to load level error

#Keen 4 Insufficient memory to load level window:
%patch $69EF  $EB    #Never show (Free 69F1-6A32)
%patch $69F8  [$0008W] #Height
%patch $69FC  [$0014W] #Width
%patch $6A0D  [$0335W] #Text called from
%patch $2F1A5 "Insufficient memory" $0A
               "to load level!" $00

#Keen 5 Insufficient memory to load level window:
%patch $69AA  $EB    #Never show (Free 69AC-69ED)
%patch $69B3  [$0008W] #Height
%patch $69B7  [$0014W] #Width
%patch $69C8  [$02D8W] #Text called from
%patch $30618 "Insufficient memory" $0A
               "to load level!" $00

#Keen 6 Insufficient memory to load level window:
%patch $67E0  $EB    #Never show (Free 67E2-6823)
%patch $67E9  [$0008W] #Height
%patch $67ED  [$0014W] #Width
%patch $67FE  [$027BW] #Text called from
%patch $30FAB "Insufficient memory" $0A
               "to load level!" $00


Crash errors

As mentioned, these errors cause the executable to crash, leaving the user at the command prompt with technical details of the error.


Null pointer assignment

This is a bizarre error that sometimes appears when the game is exited to DOS or when something is massively wrong. It can be overlaid with gibberish and usually only the first line appears. It appears to be inserted by the C++ compiler and thus totally unrelated to the game's actual errors.

It is likely this error only appears when something corrupts the game to such an extent that it fails completely. (Its appearance when the game is quit may be due to the game not being able to shut itself down correctly.) There is little that can be done to mitigate this error.

Null pointer assignment text

#Keen 1:
%patch $1307D "Null pointer assignment" $0D $0A
              "Divide error" $0D $0A
              "Abnormal program termination" $0D $0A $0

#Keen 2:
%patch $177AD "Null pointer assignment" $0D $0A
              "Divide error" $0D $0A
              "Abnormal program termination" $0D $0A $0

#Keen 3:
%patch $1984D "Null pointer assignment" $0D $0A
              "Divide error" $0D $0A
              "Abnormal program termination" $0D $0A $0

#Keen 4:
%patch $2EE9F "Null pointer assignment" $0D $0A
              "Divide error" $0D $0A
              "Abnormal program termination" $0D $0A $0

#Keen 5:
%patch $3036F "Null pointer assignment" $0D $0A
              "Divide error" $0D $0A
              "Abnormal program termination" $0D $0A $0

#Keen 6:
%patch $30D5F "Null pointer assignment" $0D $0A
              "Divide error" $0D $0A
              "Abnormal program termination" $0D $0A $0

#Keen Dreams:
%patch $23A9F "Null pointer assignment" $0D $0A
              "Divide error" $0D $0A
              "Abnormal program termination" $0D $0A $00


Missing a text file

This error is displayed when a vital external file is missing from the game directory. It is mostly encountered in Keen 1 where all the game texts are external but can also appear when things like the Finale file are absent. This can happen if the filename the game searches for has been altered or if the file itself is missing.

Missing text file error texts

#Keen 1:
%patch $B37B  [$359DW] #Text called from
%patch $165ED "Missing a text file!" $00


#Keen 2:
%patch $AA94  [$3578W] #Text called from
%patch $1ACF8 "Missing a text file!" $00

#Keen 3:
%patch $BDEE  [$37C8W] #Text called from
%patch $1CFE8 "Missing a text file!" $00


Disk error

This error occurs while starting the game when the game cannot access one of the files it needs. This may be because the disk drive has been disconnected, is read only or broken. This error was much more common in the days of floppy disks and is not expected to occur on modern systems.

The first error is the initial message which allows the player to attempt to correct the problem. The second error is displayed after the first if problems continue or if 'abort' has been selected. The third error indicates that the game is aborting its attempt and will shut down.

Disk error texts

#Keen 1:
%patch $7B3E  [$2AF4W] $EB $19 #Text called from
%patch $15B44 "DISK ERROR!  I am having some problems" $0A
%patch $15B6C "accessing the disk drive. Put the disk" $0A
%patch $15B94 "back in (if it's out) and press a key" $0A
%patch $15BBB "to retry, or ESC to abort:" $00

%patch $7B94  [$2B86W] $EB $07 #Text called from
%patch $15BD6 "DISK ERROR!  I am having some problems" $0A
%patch $15BFE "accessing the disk drive." $0A $00

%patch $7BD7  [$2BC9W] #Text called from
%patch $15C19 "Aborting." $0A $00


#Keen 2:
%patch $7F4E  [$2DD3W] $EB $19 #Text called from
%patch $1A553 "DISK ERROR!  I am having some problems" $0A
%patch $1A57B "accessing the disk drive. Put the disk" $0A
%patch $1A5A3 "back in (if it's out) and press a key" $0A
%patch $1A5CA "to retry, or ESC to abort:" $00

%patch $7FA4  [$2E65W] $EB $07 #Text called from
%patch $1A5E5 "DISK ERROR!  I am having some problems" $0A
%patch $1A60D "accessing the disk drive." $0A $00

%patch $7FE7  [$2EA8W] #Text called from
%patch $1A628 "Aborting." $0A $00


#Keen 3:
%patch $8857  [$2E75W] $EB $16 #Text called from
%patch $1C695 "DISK ERROR!  I am having some problems" $0A
%patch $1C6BD "accessing the disk drive. Put the disk" $0A
%patch $1C6E5 "back in (if it's out) and press a key" $0A
%patch $1C70C "to retry, or ESC to abort:" $00

%patch $88A9  [$2F07W] $EB $06 #Text called from
%patch $1C727 "DISK ERROR!  I am having some problems" $0A
%patch $1C74F "accessing the disk drive." $0A $00

%patch $88EE  [$2F4AW] #Text called from
%patch $1C76A "Aborting." $0A $00


Can't open files errors

These errors occur when a vital file cannot be opened. There are three possible causes for this; firstly the file's filename has been overwritten by a patch, secondly the file itself may have been deleted or renamed and thirdly the file may be restricted by the operating system. (Having read only properties for example.)

If the last two causes can be ruled out (They are easy to check.) then removing recent patches to test for conflict is the best way to test for the problem.

Can't open files errors

#Keen 4:
%patch $3D47  [$018EW] #Text called from
%patch $2EFFE "Can't open EGAGRAPH.CK4!" $00

%patch $13363  [$3AEFW] #Text called from
%patch $3295F "Can't open GAMEMAPS.CK4!" $00

%patch $133A7  [$3B12W] #Text called from
%patch $32982 "Can't open AUDIO.CK4!" $00


#Keen 5:
%patch $3D41  [$0147W] #Text called from
%patch $30487 "Can't open EGAGRAPH.CK5!" $00

%patch $14300  [$3245W] #Text called from
%patch $33585 "Can't open GAMEMAPS.CK5!" $00

%patch $14344  [$3268W] #Text called from
%patch $335A8 "Can't open AUDIO.CK5!" $00


#Keen 6:
%patch $12E94  [$34EFW] #Text called from
%patch $3421F "Can't open GAMEMAPS.CK6!" $00

%patch $12ED8  [$3512W] #Text called from
%patch $34242 "Can't open AUDIO.CK6!" $00


#Keen Dreams:
%patch $439D  [$03C0W] #Text called from
%patch $23E30 "Can't load TITLE SCREEN" $00

%patch $B983  [$283AW] #Text called from
%patch $262AA "Can't open KDREAMS.MAP!" $00

%patch $B9C1  [$285EW] #Text called from
%patch $262CE "Can't open KDREAMS.AUD!" $00


EGAGRAPH errors

In Keen 4 the game contains code both to check for EGAGRAPH and if it is not found to create it from two files, EGA1.CK4 and EGA2.CK4. Keen 5 has the code but it is defective, and Keen 6 does not have this ability at all. The only error that should appear is the "Can't open EGAGRAPH.CK4!" if the EGAGRAPH file is absent or its name has been patched and a matching file is not present.

Check for EGAGRAPH

#Keen 4:
%patch $3CD4  [$0112W] #Check for this file (EGAGRAPH) if not found...
%patch $3CF7  [$011FW] #Combining text
%patch $3D03  [$015DW] #Prepare to write data to this file (EGAGRAPH)
%patch $3D07  [$0154W] #Check for this file (EGA1)
%patch $3D18  [$016AW] #Can't rename file
%patch $3D34  [$0181W] #Rename EGA1 data to this (EGAGRAPH)
%patch $3D47  [$018EW] #Can't open EGAGRAPH to dump data
%patch $3D74  [$01A7W] #Check for this file (EGA2)
%patch $3D87  [$01B0W] #Can't find EGA2
%patch $3E6A  [$01C5W] #Rename this file (EGA2)

%patch $2EF82 "EGAGRAPH.CK4" $00	#Check for this file
%patch $2EF8F "Combining EGA1.CK4 and EGA2.CK4 into EGAGRAPH.CK4..." $00

%patch $2EFCD "EGAGRAPH.CK4" $00	#Create this file
%patch $2EFC4 "EGA1.CK4" $00		#Check, read from this file...
%patch $2EFDA "Can't rename EGA1.CK4!" $00
%patch $2EFF1 "EGAGRAPH.CK4" $00	#...rename to this file
%patch $2EFFE "Can't open EGAGRAPH.CK4!" $00
%patch $2F017 "EGA2.CK4" $00		#Check, read from this file...
%patch $2F020 "Can't find EGA2.CK4!" $00
%patch $2F035 "EGA2.CK4" $00		#Rename this file?


#Keen 5:
%patch $3CCE  [$00E5W] #Check for this file (EGAGRAPH) if not found...
%patch $3CF1  [$00F2W] #Combining text
%patch $3D01  [$0127W] #Check for this file (EGA1)
%patch $3D12  [$0130W] #Can't rename file
%patch $3D41  [$0147W] #Can't open EGAGRAPH to dump data
%patch $3D6E  [$0160W] #Check for this file (EGA2)
%patch $3D81  [$0169W] #Can't find EGA2

%patch $30425 "EGAGRAPH.CK5" $00	#Check for this file
%patch $30432 "Combining EGA1.CK5 and EGA2.CK5 into EGAGRAPH.CK5..." $00

%patch $30467 "EGA1.CK5" $00		#Check, read from this file...
%patch $30470 "Can't rename EGA1.CK5!" $00
%patch $30487 "Can't open EGAGRAPH.CK5!" $00
%patch $304A0 "EGA2.CK5" $00		#Check, read from this file...
%patch $304A9 "Can't find EGA2.CK5!" $00


RF_MarkTileGraphics errors

All errors involving 'RF_MarkTileGraphics' are errors with tile animation. They are patch problems that result when a modder produces a corrupt TILEINFO.CKx file. This error is the best result as it provides information about both the problem and the tile responsible. The worst case scenario is that the game freezes.

There are three types of error and six possible errors (Five in Keen 5); three for background and three for foreground tiles. Each type of error is as follows.

Too many unique animating tiles: Animating tiles require extra memory on top of what is needed for their graphics. When too many different types of animated tile are in a level then this memory will be overrun and the level will not be playable. The solution is to remove some kinds of animating tile from the level. (All instances of a tile must be removed, which is why TED5 has a feature to count the number of different tiles in a level, if even one tile of type x remains, type x will still be loaded into memory.)

If this error occurs during play, not at the start then the problem is with how many animating tiles are appearing at once; no more than 24 animating tiles of any kind can appear in play (Onscreen or within 2 tiles of the screen borders) at one time.

Note that in Keen 5 the same text is used for both the background and foreground error, in the other Galaxy games different texts are used.

Anim of 0: This occurs when a tile animates to tile 0. Since tile 0 is a special case (No tile) this cannot happen. It is the easiest error to fix as the offending tile will be at the top of the tileset, within the first 128 tiles. The offending tile must be made to animate to another tile or not animate at all. This error is rare as it requires a modder to deliberately set tile 0 as an animation target.

Unending animation: This occurs when a tile animation is not a nice neat loop. It is rather common as there are many ways a modder may unintentionally cause it. The first possibility is that a tile that animates (Has an animation delay) does not have anything to animate to, this can happen if part of an animation loop is removed or not set in the first place.

The second way this may happen is if two tiles are set to animate to the same target and both 'start' tiles are present in a level. Like two cars trying to park in the same space, they clash.

If a modder is conscientious they will have kept a record of what they have done before the error so that they have a good idea as to what tile may be the problem. If not there may be some guesswork. The tile error might well give a tile number, but this is hard to pin down as it is a 'chunk number' and needs a certain value removed from it to give the actual tile number. In desperate situations it is possible to back up levels and delete the newest parts of them, stopping when the error stops/ (The tile can then be identified, fixed and the backed up levels restored.)

'RF_MarkTileGraphics' errors

#Keen 4:
%patch $168F9  [$4099W] #Text called from
%patch $32F09 "RF_MarkTileGraphics: Background anim of 0:" $00

%patch $16969  [$40C4W] #Text called from
%patch $32F34 "RF_MarkTileGraphics: Too many unique animated tiles!" $00

%patch $169F5  [$40F9W] #Text called from
%patch $32F69 "RF_MarkTileGraphics: Unending background animation:" $00

%patch $16AC1  [$412DW] #Text called from
%patch $32F9D "RF_MarkTileGraphics: Foreground anim of 0:" $00

%patch $16B3A  [$4158W] #Text called from
%patch $32FC8 "RF_MarkTileGraphics: Too many unique animated tiles!" $00

%patch $16BC6  [$418DW] #Text called from
%patch $32FFD "RF_MarkTileGraphics: Unending foreground animation:" $00


#Keen 5:
%patch $17896  [$3750W] #Text called from
%patch $33A90 "RF_MarkTileGraphics: Background anim of 0:" $00

%patch $17906  [$377BW] #Text called from
%patch $33ABB "RF_MarkTileGraphics: Too many unique animated tiles!" $00

%patch $17992  [$37B0W] #Text called from
%patch $33AF0 "RF_MarkTileGraphics: Unending background animation:" $00

%patch $17A5E  [$37E4W] #Text called from
%patch $33B24 "RF_MarkTileGraphics: Foreground anim of 0:" $00

%patch $17B63  [$380FW] #Text called from
%patch $33B4F "RF_MarkTileGraphics: Unending foreground animation:" $00


#Keen 6:
%patch $16468  [$3A99W] #Text called from
%patch $347C9 "RF_MarkTileGraphics: Background anim of 0:" $00

%patch $164DC  [$3AC4W] #Text called from
%patch $347F4 "RF_MarkTileGraphics: Too many unique animated tiles!" $00

%patch $165B7  [$3AF9W] #Text called from
%patch $34829 "RF_MarkTileGraphics: Unending background animation:" $00

%patch $16686  [$3B2DW] #Text called from
%patch $3485D "RF_MarkTileGraphics: Foreground anim of 0:" $00

%patch $16703  [$3B58W] #Text called from
%patch $34888 "RF_MarkTileGraphics: Too many unique animated tiles!" $00

%patch $167E3  [$3B8DW] #Text called from
%patch $348BD "RF_MarkTileGraphics: Unending foreground animation:" $00

#Keen Dreams:
%patch $E7D6  [$4120W] #Text called from 1
%patch $E903  [$4120W] #Text called from 2
%patch $27B90 "MarkTileGraphics: Unending animation!" $00


RF_CheckForAnimTile error

This error occurs when too many animated tiles are shown onscreen at once. There is only a limited number of tile frames available for animation and this can be exhausted by many animated tiles being onscreen, an animation loop having lots of different tiles in it, or both.

The most common cause is too many tiles, removing any large blocks of animating tiles from the level will fix this.

There are two errors, one for background and on for foreground tiles. both use the same text, and in Keen 5 and Keen Dreams the texts were combined for efficiency.

RF_CheckForAnimTile error

#Keen 4:
%patch $16CA1  [$41C1W] #Text called from
%patch $33031 "RF_CheckForAnimTile: No free spots in tilearray!" $00
%patch $16D3A  [$41F2W] #Text called from
%patch $33062 "RF_CheckForAnimTile: No free spots in tilearray!" $00

#Keen 5:
%patch $17C3E  [$3843W] #Text called from
%patch $33B83 "RF_CheckForAnimTile: No free spots in tilearray!" $00

#Keen 6:
%patch $168D5  [$3BC1W] #Text called from
%patch $348F1 "RF_CheckForAnimTile: No free spots in tilearray!" $00
%patch $16974  [$3BF2W] #Text called from
%patch $34922 "RF_CheckForAnimTile: No free spots in tilearray!" $00

#Keen Dreams:
%patch $E9A2  [$4146W] #Text called from
%patch $27BB6 "RF_CheckForAnimTile: No free spots in tilearray!" $00


RFL_AnimateTiles errors

This error occurs when an animated tile is set to animate to a tile that is not in fact in the tileset. Using standard modding tools this should be impossible but it may occur if data becomes corrupted or a patch interferes with things. The error can be checked for in three ways; by backing up levels and removing layers, then individual sections of tiles to see what the 'bad tile' is; by removing recent patches from the patchfile or by using an earlier version of the tile properties to see if that file was corrupted.

RFL_AnimateTiles errors

#Keen 4 :
%patch $16F39  [$4223W] #Text called from
%patch $33093 "RFL_AnimateTiles: Out of bounds!" $00

#Keen 5 :
%patch $17ED6  [$3874W] #Text called from
%patch $33BB4 "RFL_AnimateTiles: Out of bounds!" $00

#Keen 6 :
%patch $16BA9  [$3C23W] #Text called from
%patch $34953 "RFL_AnimateTiles: Out of bounds!" $00

#Keen Dreams :
%patch $EBE6  [$4177W] #Text called from
%patch $27BE7 "RFL_AnimateTiles: Out of bounds!" $00


MM_ClearBlock errors

This error is triggered when a level contains too many unique tiles to fit into memory. This includes regular and animated tiles, all of which must be cached before the level loads. The only way to avoid this error is to edit the level to not contain so many unique foreground or background tiles.

Keen

#Keen 4 :
%patch $159FC [$3FA1W] #Text called from
%patch $32E11 "MM_ClearBlock: No purgable blocks!" $00

#Keen 5 :
%patch $16999 [$3659W] #Text called from
%patch $33999 "MM_ClearBlock: No purgable blocks!" $00

#Keen 6 :
%patch $1552D [$39A1W] #Text called from
%patch $346D1 "MM_ClearBlock: No purgable blocks!" $00


WallDebug errors

These are tileinfo errors that occur when the game encounters a tile that has values for either its left or right sides that are not 0 or 1. (Pass or block.) It will occur when the Wall Debug cheat (F10 + Y) is used in a level containing a problematic tile. The number of the first tile that has this problem will be given with the error, allowing quick identification and fixing.

It is possible for this to occur via bugs in the program used to edit tileinfo or by a patch being placed within the tileinfo segment of the game. In this case it will always appear in a similar situation and depend on specific tile(s). If a nonsensical number (Say 0 or a negative number.) is given as the affected tile, or the tile number keeps changing randomly or is not given at all, then it is possible the bug is a 'scrambling error' caused by a patch in another area of code becoming scrambled and accidentally referring to the error code. In this case testing of recent patches may solve the problem.

WallDebug errors

#Keen 4:
%patch $72EC  [$04ACW] #Text called from
%patch $2F31C "WallDebug: East wall other than 1:" $00

%patch $7350  [$04CFW] #Text called from
%patch $2F33F "WallDebug: West wall other than 1:" $00


#Keen 5:
%patch $72A1  [$0428W] #Text called from
%patch $30768 "WallDebug: East wall other than 1:" $00

%patch $7305  [$044BW] #Text called from
%patch $3078B "WallDebug: West wall other than 1:" $00


#Keen 6:
%patch $70BB  [$0424W] #Text called from
%patch $31154 "WallDebug: East wall other than 1:" $00

%patch $711F  [$0447W] #Text called from
%patch $31177 "WallDebug: West wall other than 1:" $00


FullClipToWalls

This is an issue with a sprite's clipping; specifically it is trying to use a clipping of 2 (Full clipping to walls\slopes) when it can't. Most sprites use a clipping of 1, allowing them to move up slopes but not into walls. Some sprites however like the Dopefish need to avoid sloped tiles altogether and thus use a value of 2. But this has very limited usability.

This error usually occurs when an 'ordinary' sprite is given the wrong clipping but can also occur if something goes severely wrong and a sprite gets muddled. To identify the error make a test level and add sprites in one-by-one.

FullClipToWalls errors

#Keen 4:
%patch $A7BC  [$08D8W] #Text called from
%patch $2F748 "FullClipToWalls: Bad obclass" $00

#Keen 5:
%patch $9AE4  [$07C4W] #Text called from
%patch $30B04 "FullClipToWalls: Bad obclass" $00

#Keen 6:
%patch $99C9  [$07BCW] #Text called from
%patch $314EC "FullClipToWalls: Bad obclass" $00


Object with bad state

This error occurs when a sprite's 'state' doesn't make sense. This can be triggered by a number of things but usually means that a patch has become garbled and caused a sprite to have values for things that it shouldn't. To identify the error make a test level and add sprites in one-by-one.

Object with bad state errors

#Keen 4:
%patch $B6C6  [$08F5W] #Text called from
%patch $2F765 "Object with bad state!" $00

#Keen 5:
%patch $A9FD  [$07E1W] #Text called from
%patch $30B21 "Object with bad state!" $00

#Keen 6:
%patch $A8E2  [$07D9W] #Text called from
%patch $31509 "Object with bad state!" $00


Tried to load a non existent map

This error occurs when the game tries to load a level that doesn't exist. While it is possible for a patch to corrupt the map header data this is not common and instead it usually involves an error by a level editing program or the patches required to play custom maps. See Patch:GAMEMAPS.

Tried to load a non existent map errors

#Keen 4:
%patch $13D4F  [$3B4CW] #Text called from
%patch $329BC "CA_CacheMap: Tried to load a non existent map!" $00


#Keen 5:
%patch $14CEC  [$32A2W] #Text called from
%patch $335E2 "CA_CacheMap: Tried to load a non existent map!" $00


#Keen 6:
%patch $13880  [$354CW] #Text called from
%patch $3427C "CA_CacheMap: Tried to load a non existent map!" $00


#Keen Dreams:
%patch $C2BE  [$289AW] #Text called from
%patch $2630A "CA_CacheMap: Tried to load a non existant map!" $00


Map is too tall

This error can occur under two circumstances. The first, which is very rare, is when the map is literally too tall, over 200 tiles high. Such a level will already be suffering from the 'level size limit' bug in the 'other limits' section.

However the most common appearance of this level is an accidental triggering when using TED5 as a level editor. TED5 can compress levels (Carmackize them) and Keen Galaxy games require this. If the levels are saved but not compressed (Which takes time unless Instant Carma is used.) then the game sees nothing but gibberish and crashes with this error. Checking that levels are carmackized is the first step to solving this.

Similar situation will also cause this bug, if level data has become corrupt, if the MAPHEAD.CKx file is corrupt or not the right one for the levels or not patched correctly. Such situations can be aggravating and underlie the need to backup regularly.

Map too tall error

#Keen 4:
%patch $16744  [$4080W] #Text called from
%patch $32EF0 "RF_NewMap: Map too tall!" $00

#Keen 5:
%patch $176E1  [$3737W] #Text called from
%patch $33A77 "RF_NewMap: Map too tall!" $00

#Keen 6:
%patch $16275  [$3A80W] #Text called from
%patch $347B0 "RF_NewMap: Map too tall!" $00


Maximum map height limit

This patch alters the maximum map height. For Keen 4 and 6 this is 200 tiles, for Keen 5 however it is 250 tiles. Increasing the limit will cause problems; for Keen 4 and 6 maps taller than 200 tiles cause 'flicker errors' where lines 200-204 start to overlap with the top rows of the level. (The rest of the level is playable.) Levels taller than 250 tiles confuse Keen's location and will result in 'insta-wins' when the player enters the level.

Map height limit

#Maximum map height -Keen 4
%patch $1673F [$00C8W]

#Maximum map height -Keen 5
%patch $176DC [$00FAW]

#Maximum map height -Keen 6
%patch $16270 [$00C8W]


Insufficient memory to load map level

This error is identical in nature to the 'unable to load level' error, except that in this case it is the map level that cannot be loaded. Since a lot of important things are also done at this point, the game cannot simply throw up an error, but must crash. The solutions are the same as given in the level error section above.

Keen 4

#Keen 4:
%patch $6A3B  [$0358W] #Text called from
%patch $2F1C8 "GameLoop: Insufficient memory to load world map!" $00

#Keen 5:
%patch $69F6  [$02FBW] #Text called from
%patch $3063B "GameLoop: Insufficient memory to load world map!" $00

#Keen 6:
%patch $682C  [$029EW] #Text called from
%patch $30FCE "GameLoop: Insufficient memory to load world map!" $00


RF_SetScrollBlock errors

This error occurs when the modder has placed too many scrollbars in a level. It should always happen when first entering a level. The error will explain which type of scrollbar is at fault, vertical or horizontal. The only solution to this is to remove scrollbars from the level until the error stops occurring.

If all scrollbars are removed yet the error recurs then it is a patch error and the entire patchfile must be checked.

Scroll bar errors

#Keen 4:
%patch $1706B  [$4244W] #Text called from
%patch $330B4 "RF_SetScrollBlock: Too many horizontal scroll blocks" $00
%patch $17094  [$4279W] #Text called from
%patch $330E9 "RF_SetScrollBlock: Too many vertical scroll blocks" $00

#Keen 5:
%patch $18008  [$3895W] #Text called from
%patch $33BD5 "RF_SetScrollBlock: Too many horizontal scroll blocks" $00
%patch $18031  [$38CAW] #Text called from
%patch $33C0A "RF_SetScrollBlock: Too many vertical scroll blocks" $00

#Keen 6:
%patch $16CDB  [$3C44W] #Text called from
%patch $34974 "RF_SetScrollBlock: Too many horizontal scroll blocks" $00
%patch $16D04  [$3C79W] #Text called from
%patch $349A9 "RF_SetScrollBlock: Too many vertical scroll blocks" $00


RFL_NewRow errors

This error appears to relate to scroll blocks and may occur if a scroll block has been corrupted and is neither vertical or horizontal. However, this is only conjecture.

RFL_NewRow errors

#Keen 4 :
%patch $17251  [$42ACW] #Text called from
%patch $3311C "RFL_NewRow: Bad dir!" $00

#Keen 5 :
%patch $181EE  [$38FDW] #Text called from
%patch $33C3D "RFL_NewRow: Bad dir!" $00

#Keen 6 :
%patch $16EC1  [$3CACW] #Text called from
%patch $349DC "RFL_NewRow: Bad dir!" $00

#Keen Dreams :
%patch $EE0C  [$4198W] #Text called from
%patch $27C08 "RFL_NewRow: Bad dir!" $00


No free spots in Objarray

This error occurs at the start of a level when there are too many objects (Enemies, keys, etc) in a level. The 'object array' can only hold 100 different objects, that is things in layer 3 of the level (Not tiles of any kind.) and this is why TED5 has a feature to show how many objects exist in the level.

The object array is a specific amount of memory set aside for any object placed in the level that stores its properties. All objects thus use the same amount, one entry, in this array. Therefore the only way to rectify this error is to remove objects from the level, starting with the least significant. (Such at point objects, but not point tiles.)

This error is included in Keen Dreams, but is called a 'sprite array' error, see the below section. In Keen Vorticons the level will simply crash on loading. The limit in Vorticons is 76 sprites or fewer per level.

Object array errors

#Keen 4:
%patch $89FD  [$067FW] #Text called from
%patch $2F4EF "GetNewObj: No free spots in objarray!" $00

#Keen 5:
%patch $8979  [$05F1W] #Text called from
%patch $30931 "GetNewObj: No free spots in objarray!" $00

#Keen 6:
%patch $87E1  [$05E9W] #Text called from
%patch $31319 "GetNewObj: No free spots in objarray!" $00


Don't crash, just don't spawn sprites

These patches avoid crashing the game and notifying the player. Instead the game simply doesn't spawn the extra sprites. However since this occurs at the start of a level it will mean that anything that creates a new sprite will cause a 'sprite array' crash unless that is also patched out. (See section below.)

If the sprite array error is also dealt with the level will still play oddly, Keen will be unable to shoot and points will not show when items are obtained. This will happen until enough objects have been destroyed to free up some array space. The level will also be missing the 'extra' objects, those at the bottom and right corner of the level.

Remove object array errors

#Keen 4:
%patch $89FC $5D $CB

#Keen 5:
%patch $8978 $5D $CB

#Keen 6:
%patch $87E0 $5D $CB


No free spots in Sprite array

This error occurs for the same reasons as the error above; there is no space in the sprite (object) array for new sprites to be placed. However it differs in that it occurs in the middle of gameplay, not when the level is loaded. In other words it occurs when existing sprites that fit into the sprite array produce a new sprite that can't.

This will happen if any sprite shoots a projectile that isn't destroyed or shoots fast enough that about 60 new sprites can be onscreen at once or if a marginal level produces just one or two extra sprites. This can be checked using the Count objects cheat included in the game for just this purpose. The total number of objects in a level should not exceed 70 or so. If the count is high at the level start, this means the level is dangerously marginal and some objects should be removed from the map. If not then it is a production\disposal problem and regular checks of the count will keep the modder informed as to what is going on.

In Keen Dreams this cannot occur as the game prevents new sprites being produced when the object array is full. This is a surprising feature. However when this error does occur, it is not a sprite array error but an object array error, triggered at the level start. (See above section.) Only the wording is different.

Sprite array error messagess

#Keen 4:
%patch $17C1B  [$42C1W] #Text called from
%patch $33131 "RF_PlaceSprite: No free spots in spritearray!" $00

#Keen 5:
%patch $18BB8  [$3912W] #Text called from
%patch $33C52 "RF_PlaceSprite: No free spots in spritearray!" $00

#Keen 6:
%patch $1788A  [$3CC1W] #Text called from
%patch $349F1 "RF_PlaceSprite: No free spots in spritearray!" $00

#Keen Dreams:
%patch $F2A3  [$41ADW] #Text called from
%patch $27C1D "RF_PlaceSprite: No free spots in spritearray!" $00


Don't crash, just don't spawn sprites

These patches avoid crashing the game and notifying the player. Instead the game simply doesn't spawn the sprite. This can have interesting effects. For example, when the sprite array is full Keen can shoot but no shot will be produced. Likewise item point indicators will not appear. This may be a worthwhile tradeoff if a modder is confident no serious issues will occur. (Say if a large level has one isolated point where too many sprites appear.)

Remove sprite array errors

#Don't spawn sprites when there's no array space -Keen 4:
%patch $17C1A $5F $5E $8B $E5 $5D $CB

#Don't spawn sprites when there's no array space -Keen 5:
%patch $18BBA $5F $5E $8B $E5 $5D $CB

#Don't spawn sprites when there's no array space -Keen 6:
%patch $17889 $5F $5E $8B $E5 $5D $CB

#Don't spawn sprites when there's no array space -Keen Dreams:
%patch $F2A2  $5F $5E $8B $E5 $5D $CB


Placed uncached sprite

This error occurs during gameplay when an object tries to use a graphic image that wasn't cached at the level start. (See Animations and Sprite cache for an explanation of this.) This is annoyingly common when advanced patching is involved and enemies, etc are using animations they did not originally.

The error comes with a number, which is useful if the modder is using Keengraph as it will be the same number as the sprite bitmap that was trying to be loaded, usually allowing the modder to check, identify the sprite at fault and alter their patch file accordingly. In Modkeen this is not possible as the sprite bitmaps are not numbered as the game numbers them.

Placed uncached sprite error

#Keen 4:
%patch $17C88  [$42EFW] #Text called from
%patch $3315F "RF_PlaceSprite: Placed an uncached sprite:" $00

#Keen 5:
%patch $18C25  [$3940W] #Text called from
%patch $33C80 "RF_PlaceSprite: Placed an uncached sprite:" $00

#Keen 6:
%patch $178F7  [$3CEFW] #Text called from
%patch $34A1F "RF_PlaceSprite: Placed an uncached sprite:" $00


Ignore error

These patches cause the game to ignore the uncached error. Instead of crashing the game will display gibberish on the screen where the uncached sprite should be. (In severe circumstances this will cause the game to freeze.) This may be of use when debugging or if the error is hard to eliminate and intermittent.

Ignore sprite errors

#Keen 4:
%patch $17C85 $EB

#Keen 5:
%patch $18C22 $EB

#Keen 6:
%patch $178F4 $EB


Tried to remove the player

The game tracks a certain sprite (The last Keen-type sprite encountered when loading sprites from the level map.) as the player. The screen will follow it, it will die when the 'kill player' code is called, etc. While other sprites can act like the player, they are not special and can be removed, destroyed, etc. However if due to a certain patch the player sprite is set to action=0 (Nothing, that is, removed from the level.) then the game will crash as it does not have a way to pick a new player sprite.

This is always a patching error. It usually occurs when two sprites collide. As an example, setting Keen's sprite type to 3 (The same as his shot) will cause Keen to stun enemy sprites and vanish. The only way to solve this problem is to check the patch file for any patches that may be causing a problem.

'Tried to remove the player' error

#Keen 4:
%patch $8A69  [$06A5W] #Text called from
%patch $2F515 "RemoveObj: Tried to remove the player!" $00

#Keen 5:
%patch $89E5  [$0617W] #Text called from
%patch $30957 "RemoveObj: Tried to remove the player!" $00

#Keen 6:
%patch $884D  [$060FW] #Text called from
%patch $3133F "RemoveObj: Tried to remove the player!" $00


Removing player loses level

This patch alters the game code so that trying to remove the player automatically loses the level, as it would if Keen died. This can allow a unique method of dying in addition to the regular types and is less frustrating than a game crash. By altering the level state value highlighted in blue the game can do other things, such as win the level instead.

Remove player loses the level

#Remove player loses the level -Keen 4
%patch $8A68 $C7 $06 $7A70W  [$0001W]  $5E $5D $CB


Bad shifts number

This is a graphics error that occurs when the modder has written an incorrect sprite shifts entry in SPRITES.TXT (Modkeen) or LIST.TXT (Keengraph) and imported it. This relates to the number of sprite shifts, or how smoothly a sprite animation can move in the level. it can be 1, 2 or 4, but no other number. This number is the last number in every sprite entry in the text file. This error will only occur when an incorrect sprite animation is called, which will help narrow down the search.

Keen Galaxy and Dreams shifts errors

#Keen 4:
%patch $13954  [$3B28W] #Text called from
%patch $32998 "CAL_CacheSprite: Bad shifts number!" $00

#Keen 5:
%patch $148F1  [$327EW] #Text called from
%patch $335BE "CAL_CacheSprite: Bad shifts number!" $00

#Keen 6:
%patch $13485  [$3528W] #Text called from
%patch $34258 "CAL_CacheSprite: Bad shifts number!" $00

#Keen Dreams:
%patch $BEFC  [$2876W] #Text called from
%patch $262E6 "CAL_CacheSprite: Bad shifts number!" $00


No star specs for object

This error occurs only in Keen 6 and is encountered when the game is not told where to put the stun stars when a sprite is stunned. Notably, changing the Nospike's sprite type will cause this to happen whenever one is stunned or falls off a cliff.

This error can be fixed by patching the relevant entry for the stunned sprite star position to $1A6CW or another valid value.

Keen 6

#No star specs for object error
%patch $A9A1  [$7F0W] #Text called from
%patch $31520 "No star spec for object!" $00


SpawnShot - Bad dir

This error technically occurs because the player has produced a shot that is moving in an illegal direction (Say up and down at the same time.) In practice this will appear only due to patch errors corrupting the shooting code. (Around $E500) The only solution to this is to check each patch, especially recently added patches to see if this fixes the error.

Spawn shot errors

#Keen 4:
%patch $E608  [$184CW] #Text called from
%patch $306BC "SpawnShot: Bad dir!" $00

#Keen 5:
%patch $DD37  [$1631W] #Text called from
%patch $31971 "SpawnShot: Bad dir!" $00

#Keen 6:
%patch $D8A2  [$1652W] #Text called from
%patch $32382 "SpawnShot: Bad dir!" $00


KeenThrow - Bad state

This error is the Keen Dreams equivalent of the Spawnshot error mentioned above. It should be handled in the same way.

Keen Dreams

#Bad State call
%patch $7643  [$1713W]

#Text
%patch $25183 "KeenThrow: Bad state!" $00


Disable

This patch disables the error; instead of crashing the game Keen's shot will just fall to the ground..

Keen Dreams

#Prevent bad state error
%patch $7642 $EB $09


Walk: Bad dir

This error is specific to Keen 5 and occurs when a Shikadi Mine moves in an 'incorrect' direction. This should only occur if the default Shikadi Mine code has been tampered with somehow or another patch is massively incorrect.

Shikadi Mine error

#Keen 5:
%patch $11E23 [$31A4W] #Text called from
%patch $334E4 "Walk: Bad dir" $00


Goplat moved to a bad spot

This error occurs when the Keen 5 Goplats and Keen 6 Goplats follow an arrow path onto a square with no arrow. Having no direction to move in the game crashes. Keen 5 has two types of Goplat while Keen 6 has only one.

Goplat errors

#Keen 5 :
%patch $10845 [$1C8AW] #Text called from
%patch $31FCA "Goplat moved to a bad spot: " $00
%patch $10A62 [$1EF0W] #Text called from
%patch $32230 "Goplat moved to a bad spot!" $00

#Keen 6 :
%patch $106A2  [$2443W] #Text called from
%patch $33173 "Goplat moved to a bad spot!" $00


Ignore error, Goplats freeze

These patches circumvent the Goplat error. Instead of crashing the game the Goplats merely freeze in place. This can be useful for creating things such as a Platform that rises up out of the ground to a specific height before stopping.

Goplats freeze on error

#Red Goplats freeze when they run out of arrows - Keen 5
%patch $10844 $EB $0A

#Purple Goplats freeze when they run out of arrows - Keen 5
%patch $10A61 $EB $0A

#Goplats freeze when they run out of arrows - Keen 6
%patch $106A1 $EB $0A


Keyholder points to bad spot

This error should occur when the player tries to place a key gem to open a door. It occurs when the keyholder does not have a correct sprite value over it. usually this happens when the modder forgets to put a value in, giving a default value of 0,0. Other invalid values are those outside the level borders. This error is easy enough to fix since there should only be a small number of keyholders in the level to check for validity.

This error may also occur if a 'hidden' keyholder is triggered, say if the modder accidentally gives a tile the keyholder property. (The hidden holder will of course not be given a value and can be hard to find until the player accidentally runs into one while having the right colored gem.)

In either case the best course of action is to play the level and note exactly where the game crashes. This will be the exact location of the broken keyholder.

Keyholder errors

#Keen 4:
%patch $C2E0  [$1426W] #Text called from
%patch $30296 "Keyholder points to a bad spot!" $00

#Keen 5:
%patch $B6FE  [$130EW] #Text called from
%patch $3164E "Keyholder points to a bad spot!" $00

#Keen 6:
%patch $B4E1  [$129EW] #Text called from
%patch $31FCE "Keyholder points to a bad spot!" $00


Ignore error, door fails

These patches ignore the 'bad spot' error, simply aborting the door opening sequence. This means that while Keen can place the gem but no door sprite can be created. This allows 'pointless' keyholders to be placed that take gems but do nothing.

Ignore Keyholder errors

#Ignore bad keyholder error -Keen 4
%patch $C2DF $5F $5E $8B $E5 $5D $CB

#Ignore bad keyholder error -Keen 5
%patch $B6FD $5F $5E $8B $E5 $5D $CB

#Ignore bad keyholder error -Keen 6
%patch $B4E0 $5F $5E $8B $E5 $5D $CB


StartMusic - Bad level number

This error occurs when a song is started. This is usually when a level is entered, but may also be when something else changes the music, the ending sequence for example or rescuing an Oracle Council member. StartMusic works by taking a value (3 say) then looking at the level music list and reading that music entry from it to play. (Why it doesn't just take a music value directly is unknown.) See Patch:Music.

There are two sources of error that may cause this. In the first the entry in the level music list is for a song that doesn't exist. (Say song 300.) Obviously playing a nonexistent song is impossible. The second cause is if the game is told to play the song of a nonexistent level. This can happen when the background music for say, the ending sequence is set to a nonexistent level (Again, say level 300) Both of these errors will involve a problem in the music patch.

It is also possible a faulty sound file will cause this problem, but this is unlikely.

'StartMusic - Bad level number' error

#Keen 4:
%patch $8CAD  [$06CCW] #Text called from
%patch $2F53C "StartMusic() - bad level number" $00

#Keen 5:
%patch $8C29  [$063EW] #Text called from
%patch $3097E "StartMusic() - bad level number" $00

#Keen 6:
%patch $8A91  [$0636W] #Text called from
%patch $31366 "StartMusic() - bad level number" $00


Ignore error

These patches cause the game to ignore the error. The first set cause the game to play no music at all- silence. The second causes the game to continue playing the song it is playing when the error occurs. (This can still be silence if the game has called StopMusic before attempting to switch to the erroneous song.)

Ignore bad level number, play silence

#Ignore bad level number, play silence -Keen 4:
%patch $8CAC $B8 $0001W $EB $07

#Ignore bad level number, play silence -Keen 5:
%patch $8C28 $B8 $0001W $EB $07

#Ignore bad level number, play silence -Keen 6:
%patch $8A90 $B8 $0001W $EB $07

Ignore bad level number, don't switch song

#Ignore bad level number, don't switch song -Keen 4:
%patch $8CAC $5F $5E $8B $E5 $5D $CB

#Ignore bad level number, don't switch song -Keen 5:
%patch $8C28 $5F $5E $8B $E5 $5D $CB

#Ignore bad level number, don't switch song -Keen 6:
%patch $8A90 $5F $5E $8B $E5 $5D $CB


MM_Set errors

There are two possible errors in the 'MM Set'; Purge and Lock. Both are caused by massive memory problems and are often symptomatic of patching errors. 'Purge' errors deal with trying to clear things from memory to 'make more space'; This error often occurs aside from patching when a level contains two many memory 'blocks' and there is not enough space in the memory block array to store more. This is a combination problem as background tiles, foreground tiles, sprite images and bitmaps all add together to take up memory block space. The easiest way to remove this error is to 'simplify' a level, often by removing rarely used foreground or background tiles.

When patching is an issue (Say the problem only appeared after a new patch was added.) purge errors occur most often when an exceptionally long string of text is loaded somewhere expecting a short string, such as a level name. This is similar to the 'string exceeds width' error above, but moreso. This often happens when a terminal $00 is left out of a text patch, mixing two strings into one big one.

Purge errors can also occur when a non-level music call asks for a song that doesn't exist. For example, if theending sequence song is set to level 3's music, and level 3 plays song 99 (Which doesn't exist.) then entering level 3 will cause a song error, but winning the game will result in this error. (If the game can be won without entering level 3, then the player will not encounter any error before this one.)

Lock errors involve the game trying to load something into memory that it shouldn't. It's hard to cause, and hard to fix.

Keen MM_Set errors

#Keen 4:
%patch $16091 [$4008W] #Text called from
%patch $32E78 "MM_SetPurge: Block not found!" $00

%patch $16114 [$4026W] #Text called from
%patch $32E96 "MM_SetLock: Block not found!" $00

#Keen 5:
%patch $1702E [$36BFW] #Text called from
%patch $339FF "MM_SetPurge: Block not found!" $00

%patch $170B1 [$36DDW] #Text called from
%patch $33A1D "MM_SetLock: Block not found!" $00

#Keen 6:
%patch $15BC2 [$3A08W] #Text called from
%patch $34738 "MM_SetPurge: Block not found!" $00

%patch $15C45 [$3A26W] #Text called from
%patch $34756 "MM_SetLock: Block not found!" $00


String exceeds width

This error occurs when a text window is given a line of text too wide for it. This is nearly always the result of a text patch, usually when a $0A or $00 is left out, resulting in one long, wide line of text. Close checking of text patches will often show the problem.

This error can also occur when inputting text into the star wars story screen, in this case the cause is identical, one of the lines of text in the story is too wide and must be reduced. The maximum width of a line of text is approximately 24 characters (Or "123456789012345678901234" for reference when patching.), but this varies with what characters are used.

String exceeds width error

#Keen 4:
%patch $1A195 [$4721W] #Text called from
%patch $33591 "US_CPrintLine() - String exceeds width" $00

#Keen 5:
%patch $1B133 [$3D3CW] #Text called from
%patch $3407C "US_CPrintLine() - String exceeds width" $00

#Keen 6:
%patch $19E05 [$4121W] #Text called from
%patch $34E51 "US_CPrintLine() - String exceeds width" $00


Ignore error

These patches cause the game to ignore the width error. Instead of crashing the game will simply not display any visible text. This may be of use when debugging or if the error is hard to eliminate and intermittent.

Ignore 'String exceeds width' errors

#Keen 4:
%patch $1A192 $EB

#Keen 5:
%patch $1B130 $EB

#Keen 6:
%patch $19E02 $EB


PageLayout errors

These errors should be encountered while using the Computer Wrist or in the ending sequence. They occur when something is wrong relating to the text in these sequences. They will be triggered when the offending sequence is loaded, meaning that each page in the sequence will have to be scanned for possible errors.

The first error, the word limit, occurs when too much text has been placed on a single page. The word limit is such that in order to trigger this error the text will have to spill off the bottom of the page. It usually occurs when two pages are accidentally merged when modding the page text document.

The second error, 'Text not headed with ^P' occurs, as would be expected, when text in a page does not start with '^P' This can occur if the sequence document does not start with '^P', but usually occurs when a page that is not the last page in the sequence has no text on it at all; this confuses the parser into thinking the next page has no '^P' header.

The third error, "No ^E to terminate file" occurs when the text in a chunk does not end with '^E'. All text chunks must end with this to tell the game when to stop reading data. This however may occur with a perfectly fine chunk in the Keen 4 ending sequence if the wrong chunk is used. Due to a unique bug only one specific text chunk can be used to end the game.

The ^P and ^E errors can also be triggered if the game runs low on memory while browsing the Computerwrist. This can happen if the help documents are reasonably (but not unreasonably) large.

All these errors can only be corrected by a modder looking at the offending text document.

PageLayout errors

#Keen 4:
%patch $955F  [$0720W] #Text called from
%patch $2F590 "PageLayout: Word limit exceeded" $00

%patch $96DE  [$0740W] #Text called from
%patch $2F5B0 "PageLayout: Text not headed with ^P" $00

%patch $98DD  [$076DW] #Text called from
%patch $2F5DD "CacheLayoutGraphics: No ^E to terminate file!" $00


#Keen 5:
%patch $E4C7  [$1650W] #Text called from
%patch $31990 "PageLayout: Word limit exceeded" $00

%patch $E646  [$1670W] #Text called from
%patch $319B0 "PageLayout: Text not headed with ^P" $00

%patch $E845  [$169DW] #Text called from
%patch $319DD "CacheLayoutGraphics: No ^E to terminate file!" $00


#Keen 6:
%patch $DFE7  [$1666W] #Text called from
%patch $32396 "PageLayout: Word limit exceeded" $00

%patch $E0FD  [$1686W] #Text called from
%patch $323B6 "PageLayout: Text not headed with ^P" $00

%patch $E2D3  [$16B3W] #Text called from
%patch $323E3 "CacheLayoutGraphics: No ^E to terminate file!" $00


Don't crash game, just blank screen

These patches avoid the game crashing if the ^P error is triggered, instead simply displaying a blank help page that can be quit to return to the Computerwrist menu. This is really only useful as a last-ditch save if memory issues cause random crashes in help. If memory is low and the player continues to try and open new help documents the game will run out of memory entirely and crash anyway.

^P error doesn't crash game

#^P error doesn't crash game -Keen 4
%patch $96DD $5F $5E $8B $E5 $5D $CB

#^P error doesn't crash game -Keen 5
%patch $E645 $5F $5E $8B $E5 $5D $CB

#^P error doesn't crash game -Keen 6
%patch $E0FC $5F $5E $8B $E5 $5D $CB


CA_FarRead\CA_FarWrite

These two errors relate to file sizes, specifically when the game tries to load or create a file that has a chunk in it larger than 64K. This is actually quite rare and usually occurs after a bad import. They can also be triggered by code getting garbled and accidentally loading two files instead of one. It is most commonly encountered in the Computer Wrist or ending sequences if they are laid out incorrect. FarRead is by far the most common of this pair of errors.

CA_FarRead\CA_FarWrite errors

#Keen 4 :
%patch $12B66  [$3A66W] #Text called from
%patch $328D6 "CA_FarRead doesn't support 64K reads yet!" $00
%patch $12BB2  [$3A90W] #Text called from
%patch $32900 "CA_FarWrite doesn't support 64K reads yet!" $00


#Keen 5 :
%patch $13B03  [$31BCW] #Text called from
%patch $334FC "CA_FarRead doesn't support 64K reads yet!" $00
%patch $13B4F  [$31E6W] #Text called from
%patch $33526 "CA_FarWrite doesn't support 64K reads yet!" $00


#Keen 6 :
%patch $12697  [$3466W] #Text called from
%patch $34196 "CA_FarRead doesn't support 64K reads yet!" $00
%patch $126E3  [$3490W] #Text called from
%patch $341C0 "CA_FarWrite doesn't support 64K reads yet!" $00


#Keen Dreams :
%patch $B350  [$27B4W] #Text called from
%patch $26224 "CA_FarRead doesn't support 64K reads yet!" $00
%patch $B39B  [$27DEW] #Text called from
%patch $2624E "CA_FarWrite doesn't support 64K reads yet!" $00


USL_ConfirmComm errors

This error is very rare and occurs when the Main Menu is asked to do something it cannot, such as save a game when no game is being played. Getting this error is a sign that some patch has gone severely wrong, interfering with the menu code around $19000-$1C000. The only solution is to make a note of what circumstances cause the error and check the patch file for patches that fix the error when removed.

USL_ConfirmComm errors

#Keen 4:
%patch $1AF87  [$4903W] #Text called from
%patch $33773 "USL_ConfirmComm() - empty comm" $00

#Keen 5:
%patch $1BF25  [$3EF4W] #Text called from
%patch $34234 "USL_ConfirmComm() - empty comm" $00

#Keen 6:
%patch $1ABF7  [$437DW] #Text called from
%patch $350AD "USL_ConfirmComm() - empty comm" $00


Demo loop exited

This error occurs when something goes wrong with the demo loop in Keen Galaxy or Dreams. The exact sources of error vary but are usually a corrupt demo file or a problem with the demo loop code. Checking demo files and demo patches is a good way to debug this.

Demo loop exited error

#Keen 4:
%patch $3ECF  [$01DAW] #Text called from
%patch $2F04A "Demo loop exited???" $00

#Keen 5:
%patch $3EC9  [$018AW] #Text called from
%patch $304CA "Demo loop exited???" $00

#Keen 6:
%patch $3CF8  [$011EW] #Text called from
%patch $30E4E "Demo loop exited???" $00

#Keen Dreams:
%patch $3BF7  [$0357W] #Text called from
%patch $23DC7 "Demo loop exited???" $00


Demo buffer overflow

This error occurs when something goes wrong with the demo cheat in Keen Galaxy or Dreams. Specifically it occurs when a demo is recorded for too long, exceeding the amount of memory available for storing a demo file. The solution is to stop recording a demo before this happens. If this does not occur during demo recording then it is due to a random patch corrupting the game.

Demo buffer overflow error

#Keen 4:
%patch $152FA  [$3EFCW] #Text called from
%patch $32D6C "Demo buffer overflow" $00

#Keen 5:
%patch $16297  [$35B4W] #Text called from
%patch $338F4 "Demo buffer overflow" $00

#Keen 6:
%patch $14E2B  [$38FCW] #Text called from
%patch $3462C "Demo buffer overflow" $00

#Keen Dreams:
%patch $1093A  [$461EW] #Text called from
%patch $2808E "Demo buffer overflow" $00


Demo playback exceeded

This error occurs when trying to play a demo that is too large for the memory set aside. It is thus similar to the above error except that it occurs when a demo is being played rather than recorded. This should not be possible however if a demo chunk is corrupted or was recorded under different memory conditions than the demo is being played back then it is possible that this error will occur. The only solution is to use a smaller\shorter demo chunk for this demo. If this error occurs no matter what demo is used or outside of the demo loop then it is due to a random patch corrupting the game.

Demo playback exceeded

#Keen 4:
%patch $1504B  [$3EE5W] #Text called from
%patch $32D55 "Demo playback exceeded" $00

#Keen 5:
%patch $15FE8  [$359DW] #Text called from
%patch $338DD "Demo playback exceeded" $00

#Keen 6:
%patch $14B7C  [$38E5W] #Text called from
%patch $34615 "Demo playback exceeded" $00

#Keen Dreams:
%patch $106E2  [$4607W] #Text called from
%patch $28077 "Demo playback exceeded" $00


CA_UpLevel\CA_DownLevel

These errors relate to the 'cache level' of the game. This is a value between 0 and 7 that controls what resources are being loaded or cleared from memory. As an example, when Keen enters a new level that level's sprites and tiles must be loaded into memory at a certain cache level. When he exits the level they're unloaded. But more vital things like the game's fonts are not altered when this happens.

This error results from an 'imbalance' in code; normally anything that loads stuff into memory has an equal and opposite bit of code that will unload it. However a patch can overwrite this. If unloading is disabled the game will eventually run out of cache levels (down past 0), conversely if loading is disabled vital game resources can be unloaded. (up past 7.)

The only way to test for this error is to remove patches from your patchfile and see if it still occurs.

CA_UpLevel\CA_DownLevel errors

#Keen 4 :
%patch $13F38  [$3B7BW] #Text called from
%patch $329EB "CA_UpLevel: Up past level 7!" $00
%patch $13F5A  [$3B98W] #Text called from
%patch $32A08 "CA_DownLevel: Down past level 0!" $00


#Keen 5 :
%patch $14ED5  [$32D1W] #Text called from
%patch $33611 "CA_UpLevel: Up past level 7!" $00
%patch $14EF7  [$32EEW] #Text called from
%patch $3362E "CA_DownLevel: Down past level 0!" $00


#Keen 6 :
%patch $13A69  [$357BW] #Text called from
%patch $342AB "CA_UpLevel: Up past level 7!" $00
%patch $13A8B  [$3598W] #Text called from
%patch $342C8 "CA_DownLevel: Down past level 0!" $00


#Keen Dreams :
%patch $C4B6  [$28C9W] #Text called from
%patch $26339 "CA_UpLevel: Up past level 7!" $00
%patch $C4D3  [$28E6W] #Text called from
%patch $26356 "CA_DownLevel: Down past level 0!" $00


Out of memory

These errors occur when the game runs out of memory. In many respects this is a 'general error' expected to occur whenever something goes wrong. In Keen 1 all these occurrences are separate, (for example the third error occurs when the LZW compression goes awry.) but in the other two Vorticons episodes the errors all redirect to the same area of code with only one error message for efficiency.

Out of memory errors

#Keen 1:
%patch $5C91  [$278FW] #Text called from
%patch $157DF "Out of memory!  Try unloading your TSRs!" $00
%patch $6936  [$27D8W] #Text called from
%patch $15828 "Out of memory!  Try unloading your TSRs!" $00
%patch $69B6  [$2801W] #Text called from
%patch $15851 "Out of memory!  Try unloading your TSRs!" $00
%patch $69DF  [$282AW] #Text called from
%patch $1587A "Out of memory!  Try unloading your TSRs!" $00


#Keen 2:
%patch $2264  [$26EFW] #Text called from
%patch $19E6F "Out of memory!  Try unloading your TSRs!" $00


#Keen 3:
%patch $2210  [$27EBW] #Text called from
%patch $1C00B "Out of memory!  Try unloading your TSRs!" $00


Bad pointers

These errors occur when the game is given a 'bad pointer'; that is an address for some code. There are two kinds of pointer, 'think' and 'contact', the difference between which is not important. These errors usually occur when a massive patch error has occurred causing the game to become completely lost. It is the least specific game error and one of the hardest to pin down.

Bad pointer errors

#Keen 1 :
%patch $291D  [$241CW] #Text called from
%patch $1546C "Bad think pointer!" $00
%patch $292B  [$242FW] #Text called from
%patch $1547F "Bad contact pointer!" $00


#Keen 2 :
%patch $575F  [$2CC8W] #Text called from
%patch $1A448 "Bad think pointer!" $00
%patch $576D  [$2CDBW] #Text called from
%patch $1A45B "Bad contact pointer!" $00


#Keen 3 :
%patch $5FA7  [$2D02W] #Text called from
%patch $1C522 "Bad think pointer!" $00
%patch $5FB4  [$2D15W] #Text called from
%patch $1C535 "Bad contact pointer!" $00


Error during code expansion

These are Keen 1 errors. The first error appears during LZW decompression when the code encounters nonsense data. As the only way this can occur is corruption of the original LZW compressed file this error should never appear on modern systems.

The second error occurs when the decompressed code uses up all available memory and also often occurs when nonsense data is encountered, causing the expanded data to be very large. It too is unlikely to appear on modern systems. (However identical errors occur in other situations. See above sections.)

Keen 1

#LZW decompression error
%patch $6BB1  [$2853W] #Text called from
%patch $158A3 "Error during code expansion!" $0A $00

%patch $69B6  [$2801W] #Text called from
%patch $15851 "Out of memory!  Try unloading your TSRs!" $00


Freeze errors

These errors cause the game to freeze, and sometimes cause the music to stick on a single note. The game is unresponsive and must be closed down. These are also known as 'divide by zero' errors after their most common cause. There is no way to tell what the error is except via context, timing and trial and error. As such the following subsections describe the cause of the error, not any sort of message the player may get.


Game freezes at ONE MOMENT image

This error occurs in Vorticons and is when the game freezes, often with a display of gibberish, at the One Moment screen. This is usually caused by a corrputed data file, usually the SCORE.CKx file, but possibly a *TEXT.CKx file or CTLPANEL.CKx file. Deleting or replacing these files should solve the problem.

If the screen fills entirely with gibberish then what has likely happened is that there was no valid one moment graphic in the graphics file. This may have been due to graphic modification or a patch that changes what bitmap is used. (If the game can be run without the patch file but still freezes it is the second option.)


Level freezes just after loading

This error occurs when the game freezes shortly after entering a level, usually less than ten seconds after. It does not matter what the player does, though the freeze can be delayed by going to the main menu or checking the status window.

The cause is an animating tile that animates to a non-animating tile. The game tries to animate this tile infinitely fast, freezing the game. This is usually a tileinfo problem and can be resolved by fixing the errant tile. There are two ways to do this.

The first is to check the tileinfo by carefully going over ll the tiles used in the level and checking them. This may miss the tile.

The second is to remove tiles from the level until it no longer freezes, then adding suspect tiles back to see if the error returns. This is often more reliable, but requires the modder to back up their game maps.

In rare cases there will be just one too many animating tiles in a level. (See freeze with music, below.)


Level loads to black screen

This error occurs when a sprite is behaving improperly. Usually this is the player sprite or something in the sprite's initiation or spawning code, since it occurs immediately after the level loads. The most common cause is the modder not putting a player sprite in the level (for example mistaking the 'I' Keen helmet for the actual player sprite.) Levels can be debugged by checking the player sprite is present, and if the error persists, removing sprite types from the level one by one and seeing when functionality is restored. (The affected sprite can then be checked over.)


Level loads to black with music

While this can happen due to a bad behavior (As above.), it often occurs when there is one too many animated tiles in the level. The game freezes when the tile tries to animate. This is a very borderline case, enough to be exactly at the limit and cause problems, but not enough to cause the game to crash with an error. It can be confirmed by adding another, unique animated tile to the level and seeing the corresponding crash. To solve this simply remove the least needed animated tile from the level.

This is sometimes caused by a sprite behavior issue (See 'freezes just after loading' above).


Level loads to gibberish or gibberish appears while loading

This is usually a patch error, but may, in rare circumstances be a level error (See the 'other limits' section below.) In short the level has loaded as gibberish, causing the game to display nonsense.

The first step to fixing this is to check if only one level is affected, if all levels are affected this is likely a patch problem. If only one level is affected it may be a patch relating to a sprite appearing only in that level. Otherwise it may be a game limit bug.

If the level is in Vorticons and complex enough it may be that the sprite limit has been reached. In Vorticons only 76 ordinary sprites can be placed in any one level. If this limit is exceeded when the level starts then the level will turn to gibberish and crash. In some level editors this is easy enough to check by adding up all the sprites.


Other limits\problems

These are not errors as such, or have no way for the game to handle them, but are limitations that the modder may not be aware of. In some cases it is possible to circumvent these, in other cases not.


Level height\width limit

In Keen Galaxy and Dreams it is impossible for a level to be wider or taller than 257 tiles. This is because of how the game reads Keen's position. If a level exceeds one of these dimensions (It cannot exceed both) then a large part of the level, though displaying correctly, will be 'uninhabitable' for Keen; he will simply exit the level or die when he enters it.

This is because the game 'wraps the level around' so it thinks that most of the level is negative and thus that Keen is outside it, ready to exit to the world map.

It is also possible for a map to be so large it causes its own 'map to tall' error, but this is unlikely.

There is no way to circumvent this error at present, nor is there likely to be.


Maximum number of sprites

In Keen galaxy an error will appear if the sprite limit is exceeded. (No free spots in objarray for example.) In Keen Vorticons the level will simply crash on loading. (See freeze errors section above.) The limit in Keen Vorticons is 76 sprites.


Forbidden pointer values and gibberish in-level

Due to the way the game's compression works, there are certain values that cannot be used as sprite pointers for doors or switches by naive level editors. This is especially an issue in levels that are 100 tiles wide or wider.

There are three sets of forbidden values that will cause the level to load as gibberish or freeze if placed within it. The first is the value $ABCD which affects the RLEW compression. The second is $xxA7 and the third $xxA8, both of which destroy the Carmack compression of the level. It is unlikely these values will be placed in a level, but it has happened.

Levels saved by Abiathar are invincible to these problems; it performs RLEW compression and escapes Carmack magic values.


Tiles become gibberish

There are numerous conditions when a tile will not display correctly. To see examples of this use the F10 Y cheat in Keen 4 or 6. Such gibberish is actually data from memory where the tile should be.

The first way this may happen is if animating foreground tiles are placed over animating background tiles. Due to the way these work they interfere and result in nonsense. Note that item tiles are animating tiles.

The second way is when a door is not set up properly, a door must consist of a top tile, any number of middle tiles and a bottom tile, all of which must not animate but have animation targets set and be part of a door opening tile sequence (By default four frames long.) If any of these conditions is not met, some or all of the door tiles will become gibberish.

The third way this may occur is similar, but involving bridges and switches, switch tiles must have the switch property and have animation targets but not animate (bridge tiles are the same) They must also loop, so that eventually the bridge or switch can return to its original appearance.


Maximum number of cached items

The maximum number of items the game can cache at once is 1200. This includes sprite images, sounds, tiles, music and other game chunks. Of this tiles are likely to be the largest component. This causes no error, just a game crash.


Maximum number of sprite images onscreen

No more than 60 sprite images can be onscreen at once. This is not 60 sprite, but rather 60 separate sprite image chunks. So a sprite like Keen 4's moving platform which is one single object with several images counts for more than one sprite image. (The Sphereful counts for 5 images for example.)


Maximum number of affected tiles

There is a limit to how many 16x16 tile squares can be updated via scrolling onscreen, having a sprite pass in front of them or animating. Only 90 tiles may do this in any one game loop.


Cannot place Keyholder pointers, Switch pointers or [B] sprites on animating tiles

The animation time of an animating tile is stored in the ifnoplane (sprite) layer of the level. This means that any infoplane value that must sit there for the duration of the level will be deleted if the tile (background or foreground) animates. These things include [B] sprites used for changing the direction of moving platforms and pointers for doors and bridges.