Keen Dreams level Format

From ModdingWiki
Jump to navigation Jump to search

The map data for the Commander Keen Dreams series of games, (Including Dangerous Dave 3 and Dangerous Dave 4) is stored in the KDREAMS.MAP(Shareware) or GAMEMAPS.MAP(Registered version) files. This stores all the maps of the levels used in the game. The file is read and decompressed using data stored in the MAPHEAD.KDR and MAPDICT.KDR files.

In the main the map format is identical to the Keen 4-6 GameMaps Format except that the map data for each level is compressed using Huffman Compression rather than carmackization. This works identically to the compression for other Keen Dreams files, such as the audio and graphics. The MAPDICT.KDR file is located at the following addresses:

 Keen Dreams: $2B847
 Dave 3:      $2C7BD
 Dave 4:      $2A015


Ted5

Keen Dreams levels can be edited by the TED5 utility, providing they are decompressed to the correct files, much like the usual GameMaps Format files, the difference being that TED5 cannot re-compress the altered files to a usable form, meaning the maps must be recompressed every time changes are completed.

There is also the issue of filenames; due to a programming quirk only v1.13 of Keen Dreams is moddable, and this uses filenames that are at odds with TED5, as well as the modding utilities not producing correctly named files. (Modkeen outputs EGAHEAD.Dreams instead of EGAHEAD.KDR for example.)

The simplest way to solve this is as follows:

  • The creation of EGAHEAD.CK7 for TED5 (Default Dreams EGAHEAD uses 4-byte, not 3-byte pointers)
  • The MAPDICT.KDR file extracted and replaced with one that does not cause compression. This avoids having to compress levels each time changes are made
  • The extraction of MAPTHEAD.CK7 for TED5
  • KDREAMS.MAP decompressed to MAPTEMP.CK7


When changes are to be saved TED5 can be edited and the following steps taken:

  • MAPTEMP.CK7 'compressed' to KDREAMS.MAP with a 'nonfunctional' MAPDICT.KDR file this involves nothing more than adding a dword to the start of each plane of each level's data giving the size of the plane
  • Converting MAPTHEAD.CK7 to MAPHEAD.KDR (For patching and running altered levels)

Utilities

There exists a utility to make Keen Dreams and Dangerous Dave levels compatible with TED5. It comes with all the required files and can be found on http://keenmodding.org/


Notes

This format was reverse engineered by Lemm and Levellass (Mostly Lemm).