From KeenWiki
Jump to: navigation, search
CK456Dtli working with Keen 4

CK456Dtli is a program used to edit the tile properties of Keen Galaxy and Dreams. It is similar to Tileinfo in that respect, but more complex. This is most useful when the Keener is also a Modder, and wishes to create a few new tiles to use, or perhaps to create a whole new set of tiles.

How to use

This page assumes a good knowledge of CKPatch, Commander Keen built-in resources, and just modding in general.

Tile properties

The properties of each tile are encoded in various “flags”. Background tiles have two flags and foreground tiles have seven. The term flags here is rather misleading, because this seems to imply that each one is either on or off. This is far from true—each flag for each tile is represented as a byte in the resource, so in theory a flag could have one of 256 values, but this does not happen in practice.

The flags for background tiles, listed in the order they appear in the TileInfo resource:

   * TimeFlag
   * AnimFlag

The flags for foreground tiles, listed in the order they appear in the TileInfo resource:

   * TopFlag
   * RightFlag
   * BottomFlag
   * LeftFlag
   * AnimFlag
   * MiscFlag (including the pseudo-flag ForegroundFlag)
   * TimeFlag

Altering the properties of a tile consists of changing the values of one or more flags for that tile. Now we’ll go into specifics on the various flags.


(For foreground and background tiles) For tiles that do not animate, this is zero. For animating tiles, it is a relative offset to the next tile in the animation sequence. This is stored as a signed byte, so the offset can be from -128 to +127.


(For foreground and background tiles) For tiles that do not animate, this is zero. For animating tiles, it is the amount of time spent on this tile in the sequence. The time unit is not known. To quote from an old document of adurdin’s: “The time is specified in UNITS, from x00 to xFF. A value of x95 is approximately equal to 2 seconds. Values lower than x02 may animate only sporadically.”

These flags are not just used for tiles that animate “by themselves”. Most of the time when tiles turn into other tiles (on switch to off switch and back, empty keygem holder to keygem holder with key, bridge opening/closing, keygem door opening, Keen 5 keycard door opening, etc.), the situation is handled by animating tiles. The AnimFlag for one tile points to the other, but the TimeFlag is set to zero.


This specifies what the top of the tile is like. It can be a flat solid top, an open top you can fall through, a particular slant, solid but has a pole going through, etc.

LeftFlag and RightFlag

These are zero if you can enter from that side, and one if the tile is solid on that side.


This specifies what the bottom of the tile is like. If you specify the TopFlag to be solid, but specify the BottomFlag to be “jump through”, you will get a tile that you can jump up through and land on, and to get back down through, you look down and jump. Some examples of this kind of tile are the “narrow” floors in Keen 4, the holes in Keen 5, and the tree limbs in Keen 6.


This is the most complicated flag. It encodes many of the special properties that tiles can have (such as being deadly, being an item with a certain point value, etc.). All of these are actually encoded in the lower seven bits of the flag. The high bit specifies whether or not the tile is to appear in front of Keen and other sprites, as opposed to behind them as most foreground tiles do. In this program, this is implemented as a separate pseudo-flag, ForegroundFlag.


Setting up the program as part of a mod is detailed in the Galaxy modding Tutorial page. You will need three things: a TileInfo resource dump, a standard bitmap of the background tiles (18 tiles per row), and a standard bitmap of the foreground tiles (also 18 tiles per row). For the TileInfo resource dump, you will probably be starting with one of the Keen?.tli included with the program or in the file package on the tutorial page. For the two bitmaps, probably the easiest way to get these is to use ?TIL0000.BMP and ?TIL0001.BMP exported with ModKeen.

You should also have one of the following lines in your patch file, depending on what episode you are modifying:

%patchfile $249C2 <filename.tli> 
# for Keen 4
%patchfile $25B22 <filename.tli>
# for Keen 5
%patchfile $25212 <filename.tli>
# for Keen 6
%patchfile $1FC46 <filename.tli>
# for Keen dreams

How to use

Start up the program. Click “OK” at the introductory welcome dialog. In the next dialog box that pops up, select the TileInfo resource file you want to edit, then click on “Open”. In the next window, open the background tile bitmap, and in the window after that, open the foreground tile bitmap. (For the last two windows, the default filename mask corresponds with the filenames used by ModKeen.)

Now, the main program will start. The narrow section on the left has four buttons on top (“Save”, “Save As”, “About”, and “Help”, which have the obvious purposes), and below them various information about the loaded file. Now, especially if you’re working from one of the default TileInfo files that come with this program, it is recommended that you immediately click “Save As” and save to a new file.

To edit the properties of a tile, click on it in the pictures of the tiles. An enlarged version will appear in the top portion of the program. (For foreground tiles, an enlarged version of the mask will also appear.) Use the mouse wheel to scroll the tile pictures up and down. You can also control-click and drag with the left mouse button to scroll if your mouse doesn’t have a wheel.

For background tiles, you can edit the animation properties. To specify what tile this tile animates to, right-click it in the tile selection panel. If a tile animates, the target tile is outlined in a double red border. Note that tiles can only animate up to 128 tiles before them and up to 127 after them. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).

For foreground tiles, you can also edit the animation properties (and they work the same way), but you can also edit several other properties. Above the enlarged pictures of the tile and its mask is a dropdown menu where you can select the properties of the top of the tile. Similarly, the dropdown menu below lets you select the properties of the bottom of the tile. Pushing in the buttons to either side signify that Keen (and other sprites) cannot enter the tile from that side. (Note that these are almost always set or cleared together. One-way tiles do not work as well in Keens 4,5,6 as they do in Keens 1,2,3.) Off to the right is another dropdown menu, which lets you change special properties of the tile. Lastly, when the “FRONT” button is pushed in, it means that the tile appears in front of Keen and other sprites rather than behind them.

And now, some keyboard shortcuts: For both background and foreground tiles, pressing escape resets the properties to their previous values. Pressing F1-F4 copies the current tile’s properties to internal clipboard 1-4, respectively. Pressing F5-F8 pastes the properties on clipboard 1-4 to the current tile. Pressing F9-F12 pops up a dialog box displaying the contents of clipboard 1-4. You can even hold one of F5-F8 down as you drag the mouse around, applying the properties to many tiles quickly.

There is something important to note about the target tile for animation: this is stored as a relative offset to the target tile. This means that when you copy the properties from tile A and paste them to tile B, the target animation tile of tile B isn’t the same as that for tile A, but it is the same relative tile, which is usually what you’d want, anyway. Also note that there are not different kinds of clipboards for the background and foreground tiles—when you copy/paste a background tile, only the animation and timing properties are affected/used, the other properties of the clipboard are unchanged/ignored.

(You may be wondering how the program decides whether the ESC, F1-F8 keypresses apply to the background or foreground tiles. It’s actually quite simple: if your mouse is in the background group in the window, the command applies to the background tiles. If it’s in the foreground group, it applies to the foreground tiles. If the mouse isn’t in either group, nothing happens.)

External links