<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://moddingwiki.shikadi.net/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=CK+Guy</id>
	<title>ModdingWiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://moddingwiki.shikadi.net/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=CK+Guy"/>
	<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/wiki/Special:Contributions/CK_Guy"/>
	<updated>2026-05-14T04:22:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.11</generator>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=GameMaps_Format&amp;diff=2462</id>
		<title>GameMaps Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=GameMaps_Format&amp;diff=2462"/>
		<updated>2009-02-22T21:49:24Z</updated>

		<summary type="html">&lt;p&gt;CK Guy: Thanks, but it wasn&amp;#039;t actually me who reverse engineered it. See the &amp;#039;Plumbing the Depths of Keen&amp;#039; article.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The map data for [[Commander Keen 4-6]] is mainly stored in the &amp;lt;tt&amp;gt;GAMEMAPS.CKx&amp;lt;/tt&amp;gt; file. This stores all the maps of the levels used in the game. The GAMEMAPS file is read and decompressed using data stored in the &amp;lt;tt&amp;gt;MAPHEAD.CKx&amp;lt;/tt&amp;gt; file. The file&#039;s start is easily located as it always begins with the word $ABCD followed by several dwords and a lot of blank space. In the 1.4 versions of Keen 4-6 (Dumped executable) the file starts at the following:&lt;br /&gt;
&lt;br /&gt;
  Keen 4: $24830&lt;br /&gt;
  Keen 5: $25990&lt;br /&gt;
  Keen 6: $25080&lt;br /&gt;
 (Keen D: $1FA50)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Map headers ==&lt;br /&gt;
&lt;br /&gt;
In Keen, as in most games, the &amp;lt;tt&amp;gt;MAPHEAD&amp;lt;/tt&amp;gt; file is 402 bytes long, consisting of a word and 100 level dwords.&lt;br /&gt;
&lt;br /&gt;
The first word is the flag for [[RLEW compression]], used to compress the &amp;lt;tt&amp;gt;GAMEMAPS&amp;lt;/tt&amp;gt; file. By default this is $ABCD (This can be changed.). The remaining dwords point to the headers of each level in the &amp;lt;tt&amp;gt;GAMEMAPS&amp;lt;/tt&amp;gt; file. (Nonexistent levels have a blank dword, so most of the file is empty space.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GAMEMAPS Format ==&lt;br /&gt;
&lt;br /&gt;
The structure of the &amp;lt;tt&amp;gt;GAMEMAPS&amp;lt;/tt&amp;gt; file is disordered due to the fact that the level headers and level data can be located in any place in any order. The usual structure consists of a variable string of TED settings (&#039;TEDv1.0...&#039;) followed by the levels in no particular order. Each level usually consists of the level header followed by three planes of data, though not always.&lt;br /&gt;
&lt;br /&gt;
The TED settings are unimportant and can usually be ignored. (Though in some cases TED may use them.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Levels in GAMEMAPS ===&lt;br /&gt;
&lt;br /&gt;
The header for each level that is pointed to by MAPHEAD is 42 bytes long:&lt;br /&gt;
&lt;br /&gt;
 0   4    Offset in GAMEMAPS to beginning of compressed plane 0 data&lt;br /&gt;
 4   4    Offset in GAMEMAPS to beginning of compressed plane 1 data&lt;br /&gt;
 8   4    Offset in GAMEMAPS to beginning of compressed plane 2 data&lt;br /&gt;
 12  2    Length of compressed plane 0 data (in bytes)&lt;br /&gt;
 14  2    Length of compressed plane 1 data (in bytes)&lt;br /&gt;
 16  2    Length of compressed plane 2 data (ib bytes)&lt;br /&gt;
 18  2    Width of level (in tiles)&lt;br /&gt;
 20  2    Height of level (in tiles)&lt;br /&gt;
 22  16   Internal name for level (used only by editor, not displayed in-game. null-terminated)&lt;br /&gt;
 38  4    Signature &amp;quot;!ID!&amp;quot;&lt;br /&gt;
 42  x    Level data, three planes RLEW and Carmack compressed&lt;br /&gt;
&lt;br /&gt;
The presence of the level name and the signature are not required by the Keen engine to play the level. Plane 0 is the &#039;background&#039; plane, plane 1 is the &#039;foreground&#039; plane, and plane 2 is the &#039;info&#039; plane. Each is compressed separately, as described below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Compression in GAMEMAPS ===&lt;br /&gt;
&lt;br /&gt;
Each plane is compressed with two successive compression algorithms. The first is [[RLEW compression]], identical to that used in [[Commander Keen 1-3]], except that the magic word (Flag.) is different. (It is specified in the MAPHEAD file, rather than always being xFEFE.) The second is [[Carmack compression]].&lt;br /&gt;
&lt;br /&gt;
The order of compression is RLEW followed by Carmack. One must also keep in mind that each compression algorithm outputs as its first word the length of the uncompressed data. So in the GAMEMAPS file for a particular plane of a particular level, the first word is the number of bytes in the RLEW-compressed data, and the first word of the RLEW-compressed data is the number of bytes in the uncompressed data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&lt;br /&gt;
This format was reverse engineered by Andrew Durdin (adurdin).&lt;br /&gt;
&lt;br /&gt;
The format is used by other games as well, including [[Bio Menace]], [[Catacomb 3D]], [[Dangerous Dave 3]], [[Dave Goes Nutz]], and [[Wolfenstein 3D]]&lt;/div&gt;</summary>
		<author><name>CK Guy</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Carmack_compression&amp;diff=2453</id>
		<title>Carmack compression</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Carmack_compression&amp;diff=2453"/>
		<updated>2009-02-14T02:26:44Z</updated>

		<summary type="html">&lt;p&gt;CK Guy: initial page on carmack compression&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Carmack compression]] is used in the [[GameMaps Format|GAMEMAPS file]] in [[Commander Keen 4-6]] to further shrink the levels down beyond what [[RLEW compression]] can achieve. Its basic idea is somewhat like LZ (Lempel-Ziv) compression in that it contains pointers back to previous data.&lt;br /&gt;
&lt;br /&gt;
As in RLEW compression, the first word in the Carmack compressed data is the number of bytes (not words) in the decompressed data. This is typically the number of bytes in the compressed RLEW data, as Carmack compression is performed after RLEW compression.&lt;br /&gt;
&lt;br /&gt;
Carmack compression contains two types of references to previous data: near pointers and far pointers.&lt;br /&gt;
&lt;br /&gt;
= Near Pointers =&lt;br /&gt;
&lt;br /&gt;
Near pointers occupy three bytes in the compressed data. The first is the number of words in the referenced sequence, the second is the signal byte of xA7, and the third is the number of words to the start of the reference (counting backwards from the current location). As a concrete example, the three bytes x05 xA7 x0A mean &#039;repeat the 5 words starting 10 words ago&#039;.&lt;br /&gt;
&lt;br /&gt;
Notice that near pointers only let one refer to the last 255 words. To refer to sequences further back, one must use far pointers.&lt;br /&gt;
&lt;br /&gt;
= Far Pointers =&lt;br /&gt;
&lt;br /&gt;
Far pointers occupy four bytes in the compressed data. The first is, again, the number of words in the referenced sequence, the second is xA8, and the third and fourth are interpreted as a word - a 0-based pointer to the start of the reference (in words). As a concrete example, the four bytes x10 xA8 x01 x20 mean &#039;repeat the 16 words starting at word number 513&#039;.&lt;br /&gt;
&lt;br /&gt;
= Words with a high byte of xA7 or xA8 =&lt;br /&gt;
&lt;br /&gt;
Words whose high byte is xA7 or xA8 would appear to be issue, as they would be confused with near or far pointers. These are handled by representing them as the three bytes: x00, xA7 or xA8 as appropriate, the low-order byte of the word.&lt;/div&gt;</summary>
		<author><name>CK Guy</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Commander_Keen_1-3&amp;diff=2452</id>
		<title>Commander Keen 1-3</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Commander_Keen_1-3&amp;diff=2452"/>
		<updated>2009-02-14T01:39:05Z</updated>

		<summary type="html">&lt;p&gt;CK Guy: repointed &amp;#039;full screen planar ega&amp;#039; link to proper section name of &amp;#039;raw ega data&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
{{GamePage|Commander Keen 1}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Commander Keen episodes 1-3 was a revolutionary series that launched [[ID Software]]. The games made use of a number of formats and novel features that were to be adapted to other games ID produced. Keen is notable for being the first sidescrollling EGA game on the PC, and for cementing ID&#039;s love for EGA graphics (Most previous games had CGA, EGA and VGA graphics options, all later games were EGA, or had a separate CGA version.)&lt;br /&gt;
&lt;br /&gt;
In them, the hero, Commander Keen, must collect stolen parts of his spaceship hidden on Mars (1), stop a Vorticon ship blowing up earth (2) and finally storm Vorticon VI itself in search of the cause of all this trouble, the mysterious Grand Intellect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File formats ==&lt;br /&gt;
&lt;br /&gt;
This section lists the major file formats used in the game.&lt;br /&gt;
&lt;br /&gt;
* [[B800 Text]] - 4000-byte internal files are text screens shown at exit.&lt;br /&gt;
* [[Commander Keen 1-3 Level format]] - &amp;lt;tt&amp;gt;LEVELxx.CKy&amp;lt;/tt&amp;gt; are game levels.&lt;br /&gt;
* [[Commander Keen EGA Header]] the EGA header is used to read graphics files&lt;br /&gt;
* [[Keen 1-3 Tileinfo format]] - information about the properties of tiles are stored internally in the executable&lt;br /&gt;
* [[Commander Keen 1-3 Score format]] &amp;lt;tt&amp;gt;SCORES.CKy&amp;lt;/tt&amp;gt; stores the game&#039;s highscores&lt;br /&gt;
* [[Keen 1-3 Saved game format]] &amp;lt;tt&amp;gt;SAVEx.CKy&amp;lt;/tt&amp;gt; store the game&#039;s save files. Keen is one of the few early ID games to allow this.&lt;br /&gt;
* [[Inverse Frequency Sound format]] - the sound file is stored internally and uses Apogees &#039;inverse frequency&#039; sound format&lt;br /&gt;
* [[Raw EGA data#Planar EGA data|Full-screen planar EGA]] Most graphics are in this format, compressed or rearranged in various ways. For example, the 320x200 screen graphics are this compressed with [[Keen 1-3 RLE compression]], the &amp;lt;tt&amp;gt;EGALATCH&amp;lt;/tt&amp;gt; AND &amp;lt;tt&amp;gt;EGASPRIT&amp;lt;/tt&amp;gt; files use this too. Note that the screen&#039;s plane size is 8000 bytes, 192 bytes are just &#039;padding&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Keen 1-3 RLE compression]] This is used to compress the ending and previews screens and is a modified form of RLE.&lt;br /&gt;
* [[Keen 1-3 LZW compression]] Used in episode 1 to compress the graphics files&lt;br /&gt;
* Text is contained in the executable, the executable is compressed with [[LZW compression]], and can be uncompressed with UNLZEXE.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&lt;br /&gt;
The so called &#039;Keen engine series&#039; begins with this game. The two games based on this engine are [[Dangerous Dave 2]] and [[Shadow Knights]]&lt;br /&gt;
&lt;br /&gt;
Most of the file formats here were reverse engineered by the Keen modding community.&lt;br /&gt;
&lt;br /&gt;
Commander Keen is mentioned in [[Epic Megagames]] [[Jill of the Jungle]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
* [[Commander Keen Dreams]]&lt;br /&gt;
* [[Commander Keen 4-6]]&lt;br /&gt;
* The [[KeenWiki:Main Page|Commander Keen Wiki]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Apogee]]&lt;br /&gt;
[[Category:id Software]]&lt;br /&gt;
[[Category:Sidescroller]]&lt;/div&gt;</summary>
		<author><name>CK Guy</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=GameMaps_Format&amp;diff=2451</id>
		<title>GameMaps Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=GameMaps_Format&amp;diff=2451"/>
		<updated>2009-02-14T01:35:52Z</updated>

		<summary type="html">&lt;p&gt;CK Guy: Initial page on GameMaps format&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The map data for [[Commander Keen 4-6]] is mainly stored in one file: GAMEMAPS.CKx, along with some header information in the MAPHEAD resource, located within the executable.&lt;br /&gt;
&lt;br /&gt;
= MAPHEAD Header Resource =&lt;br /&gt;
&lt;br /&gt;
In Commander Keen, the MAPHEAD resource is 402 bytes long, consisting conceptually of one word and 100 dwords.&lt;br /&gt;
&lt;br /&gt;
The first word specifies the so-called &#039;magic word&#039; used by the [[RLEW compression]] (see below). This is xABCD in all versions of episodes 4-6, but it can be changed.&lt;br /&gt;
&lt;br /&gt;
Each following dword gives an index into the GAMEMAPS file. The first points to the header of level 0, the second to the header of level 1, and so on up to level 99. The pointer is x00000000 for any level which is not present in GAMEMAPS.&lt;br /&gt;
&lt;br /&gt;
= GAMEMAPS File Format =&lt;br /&gt;
&lt;br /&gt;
In the original Keen games, the first thing in the GAMEMAPS file is the string &amp;quot;TED5v1.0&amp;quot; followed by several junk bytes before that actual level data begins. The contents of this string and the junk bytes are not important, nor are their length.&lt;br /&gt;
&lt;br /&gt;
After this come, in no particular order, the headers for the various levels, as well as the compressed plane data.&lt;br /&gt;
&lt;br /&gt;
== Level Header in GAMEMAPS ==&lt;br /&gt;
&lt;br /&gt;
The header for each level that is pointed to by MAPHEAD is 42 bytes long.&lt;br /&gt;
&lt;br /&gt;
 0   4    Offset in GAMEMAPS to beginning of compressed plane 0 data&lt;br /&gt;
 4   4    Offset in GAMEMAPS to beginning of compressed plane 1 data&lt;br /&gt;
 8   4    Offset in GAMEMAPS to beginning of compressed plane 2 data&lt;br /&gt;
 12  2    Length of compressed plane 0 data (in bytes)&lt;br /&gt;
 14  2    Length of compressed plane 1 data (in bytes)&lt;br /&gt;
 16  2    Length of compressed plane 2 data (ib bytes)&lt;br /&gt;
 18  2    Width of level (in tiles)&lt;br /&gt;
 20  2    Height of level (in tiles)&lt;br /&gt;
 22  16   Internal name for level (used only by editor, not displayed in-game. null-terminated)&lt;br /&gt;
 38  4    Signature &amp;quot;!ID!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The presence of the level name and the signature are not required by the Keen engine to play the level.&lt;br /&gt;
&lt;br /&gt;
Plane 0 is the &#039;background&#039; plane, plane 1 is the &#039;foreground&#039; plane, and plane 2 is the &#039;info&#039; plane. Each is compressed separately, as described below.&lt;br /&gt;
&lt;br /&gt;
== One plane in GAMEMAPS ==&lt;br /&gt;
&lt;br /&gt;
Each plane is compressed with two successive compression algorithms. The first is [[RLEW compression]], identical to that used in [[Commander Keen 1-3]], except that the magic word is different. (It is specified in the MAPHEAD file, rather than always being xFEFE.) The second is [[Carmack compression]].&lt;br /&gt;
&lt;br /&gt;
When compressing, one must first use [[RLEW compression]], then [[Carmack compression]]. When one is decompressing, one must undo the [[Carmack compression]], then the [[RLEW compression]].&lt;br /&gt;
&lt;br /&gt;
One must also keep in mind that each compression algorithm outputs as its first word the length of the uncompressed data. So in the GAMEMAPS file for a particular plane of a particular level, the first word is the number of bytes in the RLEW-compressed data, and the first word of the RLEW-compressed data is the number of bytes in the uncompressed data.&lt;/div&gt;</summary>
		<author><name>CK Guy</name></author>
	</entry>
</feed>