Instant Carma

From KeenWiki
Jump to: navigation, search

Instant Carma is a program created by CK Guy used to carmackize Keen Galaxy levels separately from TED5 and much more quickly. It accomplishes this due to two reasons, firstly, InstantCarma is run in windows, while TED5 must be run in Dosbox and secondly, while TED5 (and Carmack compression in general) relies on an 8KB sliding window with constant checks and comparisons between compressed and uncompressed data, InstantCarma performs the bare minimum amount of compression.

InstantCarma has been superseded with falling use of TED5 in favor of newer, windows-based level editors that can perform Carmack compression cleanly and quickly.

Minimum compression

Camack Compression is related to LZW and RLE in that it contains pointers to previously decompressed data.

For the minimum amount of compression two things need to be done. Firstly the size of the decompressed data must be written to the start of the minimally compressed data. (This of course will be the same as the decompressed data's length, and slightly shorter than the 'compressed' data being written.)

Secondly, any values that look like Carmack pointers (flags) must be rewritten as to not cause confusion during decompression. The modding wiki states this step as follows:

Words whose high (second) 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: $00, $Ax $xx, this is recognized as an exception (Repeating zero words would make no sense.)

The data will thus be x + 4 bytes longer, where x is the number of words in the uncompressed data with a high byte of $A7 or $A8 (Those looking like Carmack pointers.)

How to Use

Place instantcarma.exe in the folder along with TED5, your levels, and everything else. Run it after you run TED5, and before starting CKPatch. You do not even need to quit TED5 to run Instant Carma and playtest the levels some more.

This program eliminates the need for FIXMHEAD, as well as the complicated and confusing code in GOx.BAT. All the batch file needs to do now is call CKxPATCH. Your patch file does not need a %gamemaps line, as this program outputs directly to the GAMEMAPS file. All you need is the %maphead maphead.ckX line.

See Also

Download