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
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.
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.
Three eventful years pass … (during which ModKeen2 is released, making this program actually useful)
Also — You may have noticed that the executable is now smaller and starts faster. This is because I am using a completely different build method: version 2.0 was built by translating the Euphoria 3.0.1 program into a tokenized version, and appending that to the interpreter. Version 2.1 was built by first translating the program into C, then compiling it with Open Watcom 1.5, then attaching the icon as a resource, then compressing it with UPX 2.01. The process takes much longer (several minutes instead of several seconds), but it does produce a smaller, faster executable.
Also — Sometime after this release and before the next one, a separate subforum on Keen: Modding was created for my program! Woohoo! That’s how I know it’s important!
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.
Also — 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.
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.
Here are the various flag values recognized by the program:
|
|
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
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.)
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