Galactile | TileInfo resource editor for Keen:Galaxy
version 4.0 | released on May ??, 2011
by Alan C. Faubert/ckguy <a@bipship.com>
www.bipship.com + www.tl-dr.org
thanks @ adurdin, Lemm, Levellass, Mink

WHAT DOES THIS PROGRAM DO?

This program allows the Keener to alter tile properties. 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.

WHAT DOES THIS PROGRAM NOT DO?

This program does not alter the appearance of the tiles. (Use adurdin’s excellent ModKeen2 for that purpose, or perhaps Levellass’s slightly-newer-to-the-scene KeenGraph.) It does not let you create new Keen levels. (Use Mink’s The Omegamatic for this.) And lastly, this program does not let you create completely new kinds of properties for tiles. (Use Lemm for this.) This program only lets you change the tiles’ properties to those of existing tiles.

REVISION HISTORY (feel free to skip this if you want)

A BIT OF BACKGROUND

First of all, these docs assume a good knowledge of CKPatch, Commander Keen built-in resources, and just modding in general. For a good introduction to these topics, check out the “Modding Tutorials” on Xtraverse’s “Beyond the Pogo” website at dosclassics.com/keen.

(Now that we’ve weeded out the riffraff, we may proceed unencumbered!)

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:

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

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.

HOW TO USE THIS PROGRAM

Before you even fun the program, 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 in galactile.zip. For the two bitmaps, probably the easiest way to get these is to use ?TIL0000.BMP and ?TIL0001.BMP exported with ModKeen2 or KeenGraph.

Now you can start up the program. In the first 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.

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, I would recommend 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, or even use the up and down arrow keys.

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. With the spinbox 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. Similarily, 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 Keen:Galaxy as they do in Keen:Vorticons.) 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 dialoge 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.)

To save the file click either “Save” to save to the current file, or “Save As” to save to another file. To use the TileInfo resource in you own Keen game, you can patch it into memory by putting one of these lines into your CKPatch script file:

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

Note that these are for Keens 4, 5, and 6 version 1.4, Keen Dreams version 1.13. These are the standard versions for all modding in Keen:Galaxy, just as version 1.31 is the standard for Keen:Vorticons. If you must know, the offsets for Keens 4, 5, and 6, version 1.0, are $23742, $24B12, and $23DE2, respectively. Modding from versions other than 1.4 (1.13 for Dreams) is not recommended.

FLAG VALUES (feel free to skip this if you want)

Here are the various flag values recognized by the program:

TopFlag values
ValuePurposeComments
$00Fall through
$07Bottom > Top
$06Bottom > Middle
$05Middle > Top
$04Top > Bottom
$02Top > Middle
$03Middle > Bottom
$11Flat top with pole
$09DeadlyCan’t land on in God mode
$39FuseKeen 5 only
$21Giant switch (on)Keen 6 only
$29Conveyor beltKeen 6 only

BottomFlag values
ValuePurposeComments
$00Jump through
$01Flat bottom
$04Bottom > Top
$02Bottom > Middle
$03Middle > Top
$07Top > Bottom
$06Top > Middle
$05Middle > Bottom
$11Pole going through
$21Giant switch (off)Keen 6 only
     
MiscFlag values
ValuePurposeComments
$00No special properties
$01Pole
$02DoorAlso entry to Miragia in Keen 4
$03Deadly
$15100 points
$16200 points
$17500 points
$181000 points
$192000 points
$1A5000 points
$1CNeural stunner
$04Collect 100 to get 1UP
$1B1UP
$0FSwitch for bridgesKeen 4 & 5 only
$12BridgeKeen 5 & 6 only
$05Switch for moving platforms (off)Keen 4 & 5 only
$06Switch for moving platforms (on)Keen 4 & 5 only
$11Sprite path arrowKeen 5 & 6 only
$07Red keygem holder
$08Yellow keygem holder
$09Blue keygem holder
$0AGreen keygem holder
$0BTop water entranceKeen 4 only
$0CRight water entranceKeen 4 only
$0DBottom water entranceKeen 4 only
$0ELeft water entranceKeen 4 only
$10“Moon” floor tileKeen 4 only
$20Keycard doorKeen 5 only
$21Elevator on map (left side)Keen 5 only
$22Elevator on map (right side)Keen 5 only
$1FLittle Ampton computerKeen 5 only
$14Teleport entranceKeen 5 & 6 only
$13Active zapper (top)Keen 6 only
$1EInactive zapperKeen 6 only
$02Top of FireKeen Dreams only
$7FTop of Exit SignKeen Dreams only

HOW TO CHEAT

Some of the things you just read are ... well not 100% true. Not if you’re allowed to cheat. (Which you are.)

The first (simpler) kind of cheating involves THAT AUTOLOAD THING

The second (more advanced) kind of cheating involves THAT TILE PROPERTIES INI THING

ABOUT THE SOURCE CODE

The program’s source code is included in the distribution. Starting in version 4.0, Galactile is released under the new No-Douche License. Previous versions were released under a somewhat-vague license wherein the souce code was provided, but you couldn't actually do anything with it without asking. Under the (more permissive, even vaguer) No-Douche License, you can do whatever you want with this source, as long as it doesn’t involve you being a douche. Douchiness is to be decided by an impromptu internet jury/vigilante group of your fellow Keeners. If you think you’ve found a loophope in this license—too late you’re already being a douche.

The program is written in Euphoria (version 4.0.2, to be precise), an obscure but amazing language I’ve grown to love over the years. [begin plug — The greatest thing about Euphoria is the flexible but simple data structures. The types of data are: atoms (these are numbers), and sequences (these are finite ordered collections of atoms and sequences). Sequences can contain any combination of other data, and are completely dynamic at runtime. With the one data structure of a sequence, you can implement arrays, multidimensional arrays, structures, trees, stacks, linked lists, and pretty much anything else you can think of. What about strings? These are just sequences of atoms, which are the ASCII codes. The string "ABC" is exactly the same as the sequence {65, 66, 67}. Anyway, this language is completely awesome and fully recommended. On October 17, 2006, it went completely open source (no more paying for advanced features!), so go get your copy today. — end plug] It uses Win32Lib (version 0.70.20), which is pretty much a gigantic set of wrapper routines for the Windows API. (To be honest, the library could be a lot nicer and more internally consistent.)

CLOSING REMARKS

Thanks are due to adurdin for figuring out the Keen:Galaxy TileInfo format all those years ago. (We’re talking like 2003.) Thanks to Lemm and Levellass for figuring out what was up with Keen Dreams tiles a more reasonable number of years ago. Thanks to Mink for making the might-as-well-be-official CkD456Tli release supporting Keen Dreams, and for writing some other code I blatantly stole (back). And lastly thanks to the other various subsets of cool people in various parts of the internet who keep Keen alive.

If you have any questions or comments, please post them on Keen: Modding (www.keenmodding.org) or the Public Commander Keen Forum (www.pckf.com), or email them to me (a@bipship.com), or hit me up when I'm on IRC (Foonetic.net #pckf). If you notice any bugs or inconvenient thingies or discover flag values that do not work as expected, please tell me! I always want to hear suggestions about how to improve this program. Almost always.

I need you guys to go bug-hunting and let me know what crazy new species you find. This tool has been used for some great mods; let’s have some more!

Alan C. Faubert/ckguy
May ??, 2011