CKPatch, or Commander Keen Patch, is a series of programs that take advantage of an obscure DOS protocol that allows an executable file to be patched into memory. Initially developed for Commander Keen 1-3, the series was expanded to cover Commander Keen 4-6 and eventually several other related games.
It is illegal to modify even shareware game executables, which means that traditionally modders had to make do with altering what graphics, levels and such were not hard-coded. For many games this was no problem since as long as the files were in the correct format, the game would use them. Most games however, were not meant to be edited and these often placed severe restraints on what could be done.
For Commander Keen 1-3, while all graphics, sounds and levels could be modified with no problems, however in-game texts were more difficult to alter. To do this CKPatch was created, its full potential not realized until much later.
Patching involves altering the code of a game executable by copying said executable into memory and making changes there. Since the original file is not modified, this is perfectly legal, and all sorts of changes can be made. Initially CKPatch was used for little more than altering mod stories, but it rapidly gained widespread use in altering ever more complex things, sprite behaviors, player behavior, cutscenes and more.
The basic idea is to use a script file to give CKPatch a series of commands (Prefaced by %patch) each of which alters a segment of code. If it is known what a code segment does, then it can be altered as the user wishes.
As well as Keen 1-3 and 4-6, several other games have been added. The first was Commander Keen Dreams with KDPatch. Other Keen engine games were also added recently: