Ceilick's Keen Galaxy Modding Tutorial

From KeenWiki
Jump to: navigation, search

This tutorial aims to teach Keen Galaxy modding (Keen episodes 4, 5, and 6) to people who don't know the first thing about modding, but even the experienced modder should find this information as a good reference tool. Keen 4 will be used for specific examples, but if you are modding Keen 5 or 6, you should be able to follow along.

Setting Up Files and Folders

Download the Keen Galaxy Modding Package.

Alternatively, you can also manually create this package:

Create your base folder called "KeenModding" on your desktop. In this folder you'll want to create two subfolders: "Keen4mod" and "Tools". In your "Keen4mod" folder, create a folder called "BMP".

Copy all your Keen 4 game files into the folder "Keen4mod".

  • Note: It is very important that you use the right version of the episode you wish to mod. Make sure they are the correct versions: Keen 4 v1.4, Keen 5 v1.4, and Keen 6 v1.4.


Tool Downloads

These are the tools you will need in order to mod Keen's 4, 5, and 6 and included in the modding package. If you wish to download them individually:

  • Download CWSDPMI.EXE
    • Note: Depending on your computer's operating system you may need CWSDPMI.EXE to run modkeen and other modding programs.

Level Editors

You will need one of the five existing level editors: TED5, Keen Next (K:N), The Photachyon Transceiver (TPT), The Omegamatic (TOM), or Abiathar. This tutorial does not include instructions for The Photachyon Tranceiver since it is in many ways a windows based TED5. All of these editors are included in the modding package. The most up to date and well documented Level Editor is Abiathar with its own Wiki entry.

Drawing Tools

One of the simplest tools for modifying Keen graphics is MS Paint. However, only the versions of MS Paint prior to Windows 7 will function with the Keen palette correctly.

Some modders use programs such as GIMP or PhotoShop.


Setting Up Files and Folders (Continued)

Unzip the tools in your tool folder. Copy the following files into your "Keen4mod" folder:

  • modkeen.exe
  • unlzexe.exe
  • ck4patch.exe (Keen 5 requires 'ck5patch.exe', Keen 6 'ck6patch.exe')

Once these files are in place, Unlzexe your Keen4.exe by dragging and dropping the file onto Unlzexe.exe. A window may flash on the screen when you do so.

  • Note: If you are using the 64 bit version of unlzexe, this will create a Keen4.exenew. You will then need to delete the old Keen4.exe and rename Keen4.exenew to Keen4.exe.
  • Note: If you are using the 32 bit version of UNLZEXE, open a CMD (like beneath) in that folder and enter UNLZEXE KEEN5E.EXE to unpack it.

Open a command prompt. If you are unfamiliar with this process: go to your computer's start button, and either click 'run', or in the search field type run and click the first result. In the run box, type cmd. Now you have a command prompt open.

Modkeen exporting graphics and texts

You'll see something like
C:\Users\UserName>

Type:
cd desktop\KeenModding\Keen4mod

Press enter, then:
modkeen -episode=4 -export -bmpdir="BMP"

If all goes well, you should see a list of everything modkeen has exported followed by the word Done!

  • Note: If you are using a 64 bit version of windows modkeen may not run through the command prompt. You can run it instead by dropping modkeen.exe onto DOSBox.exe and then typing:
    modkeen -episode=4 -export -bmpdir="BMP"


Editing Graphics and Text

To begin editing the graphics and most text found in the game, go to your BMP folder. You'll see a lot of images there as well as some text files and some other files.

Graphics

EGA Color Palette
extracted 4til0001 bitmap

You can edit any of these images how you want, but keep some things in mind:

  • You need to use the original Keen colors. This is easy to do if you just edit the images with MSpaint.
    • Note: Windows 7 users will need to download the old version of mspaint.
  • On sprite images, you'll see three frames: the image against a black background, a black outline on a white background, and a red box on a grey background. The first image is where the sprite is drawn. The second is used to show what parts of the original image are going to be shown in-game. The last box is used for hitbox measurement, although it doesn't directly affect hitbox size (the 4sprites.txt determines this, see the hitboxes section below).
  • In the foreground tileset (4til0001) you'll see a similar black and white duplicate section on the right side. This is also used to show what parts of the tiles are going to be shown in-game.
  • The height and width of images must be multiples of 8 (although some of the original images do not follow this rule).
  • Changing the size of an enemy will affect how it spawns and the 'hitbox' area it uses to interact with the environment and with keen.
  • You cannot change the size of the tilesets.
  • Tiles are made up of a 16 by 16 area of pixels.
  • The image that displays in the scrolling story (for Keen 4 this is 4bmp0102.bmp) is limited in palette colors. The colors availible can be changed with patching.


Hitboxes

In keen galaxy, hitboxes are invisible rectangular areas used for telling a sprite how to interact with the environment or with Keen. For a point item, the hitbox is the area keen must touch to collect the item. For an enemy, it is the area of the enemy that will touch the ground and touch keen. For Keen himself, its the area he can interact with platforms, enemies, and other objects.

ModKeen extracted Keen sprite example

To edit the hitboxes, open 4sprites.txt. This can be a complex, difficult process that often falls to trial and error.

4SPRITES.TXT file with Keen sprite highlighted

We'll use Keen's left facing standing frame as an example. The image name for this is 4spr0006.bmp. So in 4sprites.txt, look for item 6. It will look like this:

6: [4, 0, 19, 31], [0, 0], 4.

The first set of brackets controls the hitbox. The first set of numbers are x and y coordinates for the top left corner of the image. These are measured from the top left of the image (4 pixels across and 0 down). The next coordinates are for the bottom right of the hitbox. These are also measured from the top left corner of the image (19 pixels across and 31 down). Notice that even though the image is actually 32 pixels high, the hitbox is designed to be 1 pixel away from the bottom. This is important for any sprite that needs to move on a platform.

The second set of brackets are coordinates that have to do with where a sprite image appears ingame relative to where it is placed in the level editor. In the example of the Keen sprite, these are 0,0. Its usually easiest to leave these at 0,0, but if you use a sprite that changes frame size over the course of its animation, or a sprite intended to float above the ground, you may want to experiment with this. The first value is an X coordinate and will determine how far to the right or left the sprite is placed. The second value is a Y coordinate which determines how far up or down the sprite is placed.

  • Note: If you've modded an enemy and it is stuck in the ground or in the air, you'll want to edit the Y value to bring the hitbox even with the ground.

The last value is not a coordinate but has to do with animation frame rate. In the example of Keen, this value is 4. This value varies from 1, 2, and 4.This determines how 'smooth' the frames in a series animate, 4 being the smoothest, 2 medium, and 1 low. The smoother the animation, the more memory will be used in the level.

  • Note: Use the 4 value sparingly to avoid memory issues and game crashes.

Texts

Keen 4 help section Text, INPUT
Keen 4 help section Text, OUTPUT

You'll find a number of text files in your BMP folder. You can edit these with notepad or a similar application. These files include the help sections, the story, and the end-game story.

These files employ a formatting code:

  • ^P Marks the beginning of a page.
  • ^Gy,x,n Displays a bitmap number (n - 6). These images numbers don't match up with the image numbers in your graphics folder, so you'll want to do some experimenting to get the right one (accept you were using Keengraph instead of modkeen). x,y point at pixel a location on the screen. At these coordinates the image will be placed.
  • ^Ly,x Following text will be aligned beginning at pixel location x,y.
  • ^Cc Changes the text to color c, which is a single hex digit, 0-9 or A-F. The specific codes for changing the color of text are:
    • ^CA lime text color          
    • ^C2 green text color         
    • ^CB cyan text color          
    • ^C3 dark turquoise text color
    • ^CC red text color           
    • ^C4 red text color           
    • ^CD magenta text color       
    • ^C5 violet red text color    
    • ^CE yellow text color        
    • ^C6 brown text color         
    • ^C9 light blue text color    
    • ^C1 blue text color          
    • ^CF white text color         
    • ^C7 light grey text color    
    • ^C8 grey text color          
    • ^C0 black text color         

  • ^Ty,x,n,t After a delay of t time units (t/100 seconds?), this timestamp displays a bitmap (n - 6) at pixel location x,y on the screen.
  • ^By,x,w,h,c Fills the width-by-height-pixel rectangle at pixel location x,y with color 4 (the c parameter is ignored in version 1.4).
  • ^E Marks the end of the dialogue.


Importing Graphics and Texts

Modkeen importing graphics and texts

To import your graphics, go back to your command prompt and type in the same address as previously, but you'll change the command to import this time:

modkeen -episode=4 -import -bmpdir="BMP"

  • Note: You may need to drag and drop modkeen onto DOSBox and then type this command.

If you get the Done! message, you've imported successfully, however, you can't try out your new graphics until after creating a patch file and corresponding batch file, which is explained in the next section.


Patch File and Batch File

Your patch file is used to access all the edited content in your mod. It's what allows you to have new graphics, new tile properties, new levels, new music, new text, new enemy behaviors, etc. It also allows you to change the 'rules' of the game in certain ways (although there are limitations).

If you look in your keen4mod folder, you will notice that Modkeen has generated a patch file for you called Keen4.pat. You will want to rename this so that it isn't overwritten in the future. Locate Keen4.pat and rename it to something like mymod.pat.

Play.bat batch file

You can also create a patch file from scratch. To do this, create a new .txt file called mymod. Open the file and save as mymod.pat and make sure you select all files in the Save as type section. You should now have a mymod.pat file.

Your batch file is what you'll use from now on to play your mod. To create a batch file, first create a new text document and name it whatever you want. In this example we'll use Play. In the text file, type: ck4patch mymod.pat

Now, go to file and save as Play.bat and make sure you select all files in the Save as type section.

Run Play.bat to make sure your mod is working. If you see your modified graphics and/or texts, it works!

Patching Basics

mymod.pat patch file

After you've made sure Play.bat runs fine, open up mymod.pat with a text editor.

You should see:

ext ck4
version 1.4
# Load the modified graphics
%egahead EGAHEAD.CK4
%end

Here's what each line means:

  • The first two lines mark the beginning of your patch file.
  • The # symbol indicates a comment. Any line preceded by a # will be skipped over and allows you to include notes in your patch file.
  • %egahead EGAHEAD.CK4 is what tells the game to use your new graphics.
  • %end will mark the end of your patch file. Anything that appears after this will not be read by the game, so make sure that any patches you add to this file are included before this line.
generating patches with The Neural Stunner

You can find all kinds of patches in the Patches Wiki entry or on the Keen Modding Forum as well as make specific requests. Additionally, your can run The Neural Stunner to generate some easy patches, or dig through the patch files of existing mods.

Here's an example patch that makes Bounders unkillable:

%patch $11166 $12 $2F

Now add it to the patch file and also add a comment explaining what it does.

%ext ck4
%version 1.4
# Load the modified graphics
%egahead EGAHEAD.CK4
#Make bounders unkillable
%patch $11166 $12 $2F 
%end

Now save your patch file and run Play.bat . Bounders should now be unkillable!

For a deeper understanding of how patches work please check out Levellass' Keen Patching Tutorial, which is a basic step-by-step guide from simple to complex patch techniques for the novice patcher.


Tile Properties

CK456Dtli working with Keen 4

Go to your "Tools" folder and go into your ckD456tli folder. Copy the Keen4.tli file into your "keen4mod" folder. Then go to your patchfile and add the patch that corresponds to your modded episode below:

%patchfile $249C2 keen4.tli
%patchfile $25B22 keen5.tli 
%patchfile $25212 keen6.tli

Now run CkD456tli. The first item the program asks you for is the file which you just copied to your "keen4mod" folder. Locate and select it. Next, go into the "BMP" folder and select the background tileset, and after that select the foreground tileset.

You're now in the editing menu.

On the left side you can see the background tiles. The properties in that tileset are limited: either a tile can animate or have no properties. If a tile animates, the next tile in the animation sequence is outlined in a double red border. Note that tiles can only animate up to 128 tiles before or after any given tile, so try to keep tiles that animate near each other.

To animate a tile, select the first tile in the animation sequence. Next, right click the tile that should appear next in the sequence. Now left click that new tile and select the tile it will animate to next. Make sure the last tile in this sequence animates back to the original tile. Now go back and add animation times to each tile. By moving the scrollbar, you can change the amount of time spent on the tile while animating (0 to 255 time units).

If a tile animates that you don't want to animate, right click the original tile. You will need to repeat this step for each tile in the animation sequence.

  • Note: Reducing the scroll bar to zero will NOT prevent the tile from animating and will instead cause the game to crash
  • Note: After disabling a tile from animating, it is not necessary to reduce its value in the scroll bar to zero, although this is recommended to avoid future errors when editing.

On the right side is the foreground tiles. For foreground tiles, you can also edit the animation properties (and they work the same way), but there are several other properties you can edit as well. 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 on either side signify that Keen (and other sprites) cannot enter the tile from that side, making it solid. (Note that these are almost always set or cleared together. One-way tiles do not work as well in Keens 4, 5, and 6 as they do in Keens 1, 2, and 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.

  • Note: There are some exceptions where foreground tiles that animate have their animation value set to zero. This includes: Key-gem doors and and flag holders.

When you're finished editing, click save.


Level Editing

Before getting into special instructions for each editor, some general knowledge about how Keen Galaxy levels work is needed.

Keen 4, 5, and 6 levels consist of three layers of tiles: the background, foreground, and info layers. The background is just there to add color to the scene; Keen and the enemies don't interact with it. The foreground layer contains tiles that Keen interacts with: platforms, point items, doors, secret passages, and so on (note that many tiles in the foreground layer actually appear behind Keen, but they are not considered 'background tiles'). Finally, the info layer contains information about sprites and special features such as switches, doors, bridges and so on. When level editing, you will generally work with only one layer at a time, although all three may be visible at once (layers can be toggled).

In keen 4, 5, and 6, the world map is built primarily from background tiles which do no have solid properties. Instead, special 'invisible' tiles are placed from the foreground tilset on the world map to block Keen's path. These can be difficult to figure out. Check tile properties with ckD456tli to figure out what is what and then edit the invisible tiles to have visual cues for placement (they can be made invisible again later). Alternatively, you can use foreground tiles to build the world map (although this will use more memory).

Keen Galaxy levels have a rectangular border of 2 tiles. Borders should be filled with solid tiles with some exceptions. To create a level exit, leave the border empty where you want Keen to exit. Keen cannot exit out the top or bottom of the screen (Keen will die on the screen bottom and Keen will glitch on the screen top).

Point items can be placed as both sprites or as tiles. It is important to place as many point items as tiles as possible to avoid memory issues. A good rule of thumb is to only place sprite items on foreground tiles.

Included below are general instructions for TED5 (sections written by Levellass and Adurdin, edited by Ceilick), Keen: Next (written by Ceilick), and The Omegamatic (written by Mink and edited by Ceilick). Abiathar however is not included in the following section. Therefore see the Abiathar-Wiki entry (written by Fleexy and edited by Nisaba). Alternative take a look at Fleexy's official manual, or video tutorial playlist.


TED5

Setting up TED5

A level map loaded in TED5.

Download and unzip TED5 into your "keen4mod" folder.

1. Look for the file Egahead.ck4. Rename this file Egahead.ren.

2. Run Tedsetup.

3. Tedsetup will generate a new Egahead.ck4. Delete this file. Now Rename Egahead.ren to Egahead.ck4.

This is the only time you will need to run tedsetup and follow the above steps.

You will probably need DOSBox to run TED5. Just drag and drop the TED5.exe onto your DOSBox icon.

The Interface

After dismissing the welcome screen, the first thing you will want to do is press F9, or click the ? tab and select Video Mode Switch. That will cause TED to run in 640x480 mode, giving you more space to work with. You can switch to the low resolution mode again anytime you want to make sure how much of the level is going to be displayed on the in-game screen at once.

At the bottom of the screen, you will see the Info Bar. From the far left to right, it displays:

  • Selected Background tile.
  • Selected Foreground tile.
  • Selected Sprite Icon.

These items display the icon as a graphic, followed by the tile number in hexadecimal (like $00AE) and decimal (174). Clicking on any of them will bring up the tiles palette so you can select a new one.

Next appears the name of the level. This name is used only in TED5, it does not affect the level name in-game.

Next appears: Active layers (B, F, I)

  • B: Background Tiles
  • F: Foreground Tiles
  • I: Sprite Icon, door/switch coordinates

The letter indicates the layer where you will be adding new tiles to. You can select more than one and the selected tiles will all be placed, however, it is recommended that you work only one layer at a time.

Next appears: Visible layers (b, f, i) This tells you which layers are being toggled. You can toggle layers with the hotkeys 4, 5, and 6.

When a layer is turned off you cannot place items in it by mistake. This allows you to take a closer look at a specific layer to make sure everything is placed correctly.

Lastly, on the bottom far right: Cursor location (X, Y) This gives you the tile coordinates at a specific spot on the map. This will also be given in both decimal and hexadecimal numbers. You will need those numbers in order to have switch that activate lifts, doors leading to other places, toggling bridges, and more.

Editing

By default, TED5 will load the world map for the game. In order to switch to another map, you will need to click the File menu and select Edit New Map. You will then be able to select any of the maps in the game. For this example, pick Slug Village.

You can use the arrow keys to scroll the level around.

You can toggle which type of tile to place (background, foreground, sprite icon) by pressing the 1, 2 or 3 keys. Note for each type of tile, you will need to press the number key to activate it and the same key again to deactivate it before using a different tile type.

Adding new tiles to the level is as simple left-clicking. The currently selected tiles will be placed in all active layers. You can select tiles in three ways: Clicking the tile icon to the left of the Info Bar, pressing the space bar to bring up the tile set, or right-clicking an existing tile.

Right-clicking an existing tile will switch all the active tiles to the ones in the active layers. This means, if you only have the Icon layer active, right-clicking a tile with a slug will only select the slug; while if you have all three layers active, it will select the slug, the Foreground tile, and the Background tile at that location.

Once you have a basic level made, you'll want to add more advanced features like moving platforms, switches, bridges, doors, and so on. These are all done with links in the sprite icon layer.

A simple moving platform in Keen 4 can be placed by putting a moving platform icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B"</tt> in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A collapsing platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.

Often you want the player to have to turn a platform on with a switch. To do this, you need to place another blocking tile in the way of the platform between the other two. Make a note of the hexadecimal values of the location of the tile (the X and Y values beginning with $ at the right-hand side of the status bar). Now place a switch in an appropriate place, and link it to the blocking tile: Choose Misc, New INFOPLANE Value or press Enter, and type in a $ followed by the last two digits of the X and Y values you wrote down. Then click on the switch; this will place the link in the info plane, which will be shown as four digits. The switch will now turn the blocking tile off, to activate the platform.

When working on your world map, you'll want to use the infoplane to specify what levels your entrances will lead to. To do this, go to Misc, New INFOPLANE Value, and type in a $ followed by one of the following: $C0xx is a link to level where xx is the level number in hexadecimal, not decimal), $D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and $F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then edit the info plane by left clicking.

In the same way, you can link a switch to a bridge (link to the left-hand edge of the bridge), a gem-holder to a closed door (link to the top of the door), and a walk-in doorway to the place you walk out (link to where you want Keen's feet to end up after he enters the doorway). Note that if you create a link from a switch to a square with nothing in the info plane, that switch will turn a blocking tile on; also that you need to use a particular tile to make a walk-in door (find out by looking at an existing level).

Another feature which makes Keen levels exciting is secret passages. Some foreground tiles allow Keen to walk behind them-these are suitable for secret passages. However, identifying which ones are like this and which ones are solid is difficult: I suggest examining some of the original levels and noting down the tile numbers of the "secret passage" tiles to keep track of them. When putting point items in a secret passage, you must use icons for them, rather than their foreground tiles. I suggest that you only place the "walk-behind" tiles in secret passages once the level is completed, so that while editing you can keep track of them more easily.

Finally, some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks in the info layer to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.

Saving

You can save your map at any time by going to the File menu and selecting Save Map; however, in order to actually play the level, you will need to Carmacize Maps. While TED5 has an option to do this, it takes too long to do so. The easiest method is to download InstantCarma and unzip the files into the folder with your maps. After you save your map in TED5, just run InstantCarma.

TEDSETUP creates an extra batch file (Go4.bat) and patch file (Patch4.pat) which you do not need if you open your existing patch file and add the line:

%maphead maphead.ck4

You only need to add this to your patch file once. Then just run your batch file to try your level!

Other TED5 Features

Grid Mode toggles the showing of a grid on the current level. This can help with placing tiles in the right positions. Turn this on or off from the Mode menu or by pressing G.

Block Fill mode quickly fills a rectangular area with the currently selected tiles. Choose it from the Mode menu or press B, and click the left mouse button on the desired top-left corner, and the right button on the bottom-right corner, then press Enter to fill the area.

Flood Fill mode will fill an area of one tile with the currently selected tiles. Choose it from the Mode menu or press F, then click in the desired location to fill.

Copy Mode (also on the Mode menu, or press C) lets you select a rectangular set of tiles to copy so that you can duplicate them in another region easily. Select the area as for Block Fill mode, then press Enter.

Paste Mode (you know where to find it) allows you to paste one or more copies of the tiles chosen with Copy Mode. Click with the left mouse button to place a copy. You can use the Paste Overlay option (on the Mode menu, or press F3) to toggle pasting of empty tiles. The Snap-Paste option (press S) toggles pasting copies just anywhere, or in a tessellated pattern. This is especially useful for filling in the background of a level.

You can change the size of a level with the "Change MAP Edges" option on the Edit menu. Select the edge you want to change, and enter a positive or negative number to add or remove rows from that edge.


Keen:Next

Keen: Next.

Setting Up

Go to the keen 4 folder in Keen next and copy the tiles4.png file. Paste this into your "keen4mod" folder.

Edit tiles4.png to include your edited graphics. Be sure to save the file as .png.

Go to your Keen:Next folder and run the kmaps application. You may get an error message after running this, but this is not a problem, just click ok.

When the editor opens, the first thing to do is go up to 'file' then 'new'. A 'project properties' window will appear. Give your project a title (it doesn't matter what you name it) and then check the "keen project" box. We'll be using Keen4, which is the default setting. If you're planning to edit keen 5 or 6, just make sure to select those in the box next to "keen project". Next we need to choose the tileset. In the image file section, go to 'browse' and select the tileset you want to use (in this case, tiles4.png). After all this, click 'ok'.

  • Note: you will have to do this each time you open the editor.

Before editing levels, you must extract them in a way that Keen: Next can read them. Go to 'file', then 'create keen files'. Browse to your "keen4mod" folder and select keen4.exe. Your keen map files should now be created.

  • Note: this will not work if you have run tedsetup.
  • Note: You only have to do this once.

The Interface and Tools

The tiles should load on the right side of editor menu. You can adjust the tile menu width with the mouse by selecting the left edge. You can scroll between the background and foreground tiles.

In the upper left is a toolbar. The default tile tool is the pencil/paintbrush. You can click and place or click and drag to place tiles.

There is also a water dropper tool. This is useful for selecting a tile currently on the map instead of looking for it in the tileset.

  • Note: the water dropper will 'pick up' the tile from the tileset you're currently in; if you currently have a background tile selected and use the water dropper, it will pick up the background tile on the map. If you want a foreground tile, scroll down in the tileset on the right and select one of the foreground tiles, then use the water dropper on the map.

I do not recommend using the paint can tool, since it is very buggy.

The next tool can be used for selecting a rectangular area of the map. This is useful for cutting a piece of the level and pasting it elsewhere (you will need to do this twice if you want to cut and paste both the background and foreground). You can also create stamps this way. Just select an area and go to "selection" and then "create brush". A stamp of the area will now appear on the left.

You can create stamps of a large area of tiles from the tileset also. To do this, click the top left corner of the area of tiles you want in the tileset. Then go to the bottom right corner of that area, while holding shift, and select that tile. Doing this successfully will result in the stamp image appearing on the left side of the editor. You can now use the paintbrush tool to place this stamp, and you can reselect this stamp at any time you're editing.

The next tool looks like a little cog. This is used for placing doors, level entrances, switches, and key-gem holders.

The last important tool has an icon that looks like an arachnut. Click this to bring up the sprite menu. This is used for placing enemies, points, and some other things. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.

In addition to the tools, you can toggle the layers used in editing with the 'view' tab and checking/unchecking layer 1 and layer 2. Make sure that, in the "view" section, you have 'fade unused layers' unchecked. This makes level viewing easier.

  • Note: This is the buggiest part of Keen:Next and if you frequently toggle layers, glitches can ruin a lot of work put into a level. Its usually best to leave both layers visible, or save your progress before toggling layers and then reload Keen: Next as soon as you finish the work that required toggling them.

Editing

To begin editing, first load a map. Go to 'file', then 'Import Keen Map'. In your "keen4mod" folder, select 'maphead.ck4'. You should now be presented with a 'map select' box. Choose the level you'd like to edit. Let's start with the shadowlands.

The shadowlands map should now be loaded in the main editing area. You'll notice little white icons that look like this (!). These are the level sprites. To place these, use the little cog tool up in the upper left (next to the rectangular area selector). When this tool is used to click the map, you'll get an 'info plane' box asking for an x and y coordinate.

On the world map, this is how the coordinates work: The x coordinate determines what kind of sprite is used. An X of 192 designates the sprite as a level entrance. Note: you cannot place a level entrance on a tile that appears over keen or on an animating tile.

An x of 208 is a level block (like those used in the slug village); this sprite does not actually block keen, but is placed over a foreground tile that does. When the level is beaten, this info number removes the foreground tile.

An x value of 240 is for the flag holders.

Y coordinates only designate what level the sprite is associated with. A Y of 1 will designate the level as level 1.

To place sprites (enemies) in a level, go to the tools menu and click the little icon that looks like an arachnut. The sprite menu should appear in place of the tileset. To place a sprite, make sure you have the paintbrush icon selected, then click the sprite you want to place. To switch back to tiles from sprites, click the little black square icon to the left of the arachnut icon you used to get to the sprite menu.

  • Note: some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order.

To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door. In the lower left side of the editor, you'll notice that the map coordinates for this tile appear. Memorize or write these down. Now select the cog tool and then click your keygem holder. Enter in the coordinates for your door. You've now got a working door.

To place doors that Keen can enter, first place two sets of door tiles on the map. Now you must determine the coordinates. Go to one of your doors and hold the mouse over the tile below the bottom left door tile (not on the bottom left door tile or keen will drop out of the air). Check the coordinates. Then go to the door you want to connect to this spot and use the cog tool and click the lower left door tile (the lower left door tile, not the one below it). Enter in the coordinates. Do the same for the bottom right door tile. Now this door is connected to the other, but you also need to check the coordinates at this door and add them to the tiles of the other door.

To create a working switch, use the cog tool on a switch and use the coordinates for the thing you want the switch to affect. For a bridge, get the coordinates of the top left bridge tile and put this in the info box for the switch. For goplats (moving platforms), get the coordinates of a B sprite (these are sprites which goplats bounce off and then go in the other direction). The switch will remove that sprite so the goplat can move.

To resize a map, go to "edit" and "Resize map". Then select the new level boundaries and the side of the level which should be expanded or shrunk.

Keen: Next has an infinite undo button. Just go to "Edit" and click "Undo".

  • Note: Undo will work for everything except changes to the level boundaries. Make sure you save before changing level boundaries!

Saving

When you're ready to save, go to 'file', then 'export keen map', then select 'maphead.ck4', click yes, and reselect the level you want to save over and click ok.

  • Note: if you like, You can rename the level here before you click ok. The name you choose will only appear in the editor, however, and not in the in-game text.
  • Note: Do not click 'save' or 'save as'. These options do not actually save the level to the game, but as files only Keen: Next can read. Additionally, saving levels in this manner can cause Keen: Next to crash.

After saving you can test your levels by adding this to your patch file:

%maphead maphead.ck4
%gamemaps editmaps.ck4

Then run your batch file and you're all set.


The Omegamatic

Setting Up

A level map loaded in TOM.

Run tom.exe and select the gamemaps.ck4 file. You will then need to select your tilesets which you exported modkeen: 4til0000 and 4til0001. After selecting these, if all goes well, the world map will open in TOM.

The Interface and Tools

Tom features two different level editing styles: TED5 and Keen:Next. I highly recommend Keen:Next Mode and will only cover it in this tutorial. To activate this go to settings and click "Keen:Next Mode". You will now see the tileset on the right side of the TOM window.

In the bottom left of the window you will see three different boxes. These boxes display the tile you pick from the tileset on the right of the window. Each box displays from one of the three layers used in Keen:Galaxy: background tiles, foreground tiles, and sprite icons. To change which tileset to work with, use the hotkeys 1, 2, and 3 to switch between the layers.

To place a tile simply select the tile from the tileset with the left mouse button and click on the level where you want to place it with the left mouse button. You can also right click a tile from the level to make it the active tile for placing, just like a water dropper tool. To erase a tile you will need to right click an empty space in the level, which makes an empty tile the active tile, and then left click what you want to erase.

If you want to select an area of tiles from within a level, press C and left click a corner of the area you want to select. You should then left click the opposite corner of the area you want to select. The selected area will have it's colors inverted until you select the size of the area. You can then press P to paste the area you selected.

If you want to select an area of tiles from the tileset, left click the top left tile of the area you want to select. Then, while holding shift, left click the bottom right tile of the area you want to select. Release shift and then you should be able to place the selected area in the level by left clicking.

You can scroll around the level with your mouse wheel or with the arrow keys. You can zoom in and out in the "View" tab. You can also toggle on and off which layers can be seen with the hotkeys 4, 5, and 6.

To change the level you are editing go to "Levels" and select the level you want to edit. You can rename levels by going to "File" and then "Rename This Level".

You can resize a level by going to "Tools" and selecting either: Insert Row, Delete Row, Insert Column, or Delete Column. After selecting on of these move your mouse around the level and you will see a highlighted area which will be affected by whichever option was chosen. To disable any of these level adjustments just go back to "Tools" and uncheck it.

When working on your world map, you'll want to use sprites to specify what levels your entrances will lead to. To do this, first press 3 to activate the sprite icon layer. Press enter once and a message box will come up with an infoplane number in hexideciaml. Remove the number indicate and type one of the following: C0xx makes a level entrance where xx is the level number in hexadecimal, not decimal), D0xx overlays blocking tiles that will be removed upon completion of the level (think the gates for border village and slug village), and F0xx is for the flag holder which corresponds to the level. After entering your chosen value, you can then place the level entrance, gate, or flag sprite by left clicking.

Sprites and Enemies

To place sprites and enemies in a level, press 3 to bring up the sprite tileset. You can place sprites like you would normally place a tile. Some enemies appear more than once in the sprite menu; this is for enemies that appear on easy, moderate, and hard. You can see little numbers that designate this, but a general rule is that the order they appear in on the menu matches the easy/medium/harder order. Sometimes there is a blank space before or after the order of sprites. For example, the blue bird from keen 4 doesn't have a sprite icon for easy mode, however, it does have a blank tile where the easy mode icon would normally go. This blank tile can be placed to place a blue bird on easy. This works similarly for other enemies in this situation.

Secret Passages

Some foreground tiles have properties that allow Keen to walk behind them; these are secret passages. To make these you will need to identify which tiles have the correct foreground but not blocking properties. I suggest examining some of the original levels and noting down which tiles are used for the secret passages. You can also identify them with the CKD456tli utility. When putting point items in a secret passage, you must use points from the sprite list rather than the foreground tile points.

Moving Platforms

A simple moving platform in Keen 4 can be placed by putting a moving platform sprite icon with a red arrow in the desired spot. To stop the platform moving off the edge of the screen however, you'll need to put some blocking tiles in its path: these icons look like a "B" in a square. Put one blocking tile to each side (for a horizontally-moving platform) or above and below (for a vertically-moving platform). A falling platform (the one with a yellow triangle below) only needs a single blocking tile beneath it. In Keen 5 and Keen 6, the platforms with green arrows (known as Goplats) need a path made of the yellow arrow icons to follow.

Switches for goplats

Often you want the player to have to turn a platform on with a switch. To do this you will need to place another blocking tile in the way of the platform between the other two. After placing the blocking tile, hold the mouse over it and press enter two times. This will give you the hexidecimal coordinates which you will place on the corresponding switch. The switch will now turn the blocking tile off thus activating the platform.

Switches for bridges

To create a switch for bridges, first build the bridge using the bridge tiles. Then hold your mouse over the top left tile of the bridge and press enter twice to get the hexidecimal sprite value. Place this sprite on the switch you want to activate the bridge with. If you want the bridge to begin already opened, you will need to locate the invisible bridge tiles and place these where the bridge will be located, otherwise no bridge will appear. To find these either locate them in existing levels with open bridges or use ckd456tli.

Key Gem Doors

To place a keygem holder, first place the foreground keygem holder tile somewhere on the map (it can be anywhere). Next place a door (these are also foreground tiles) somewhere (anywhere). When making the door, there are three door tiles: a bottom, middle, and top. If you're making a door more than three tiles high, use the middle door piece for additional height. Using your mouse, hold it over the top tile of the door and press enter twice. Place the sprite that this gives you on the gem holder.

Doors

To place doors that Keen can enter, first place two sets of door tiles on the map. Then hold the mouse over bottom left or right of the first door and press enter twice. This gives you a sprite which you should place on the bottom of the second door you want connected to the first door. After placing the sprites at the bottom of the second door, you will need to press enter twice at the bottom of this second door and place the sprites on the first door in the same way.

Scroll Blocks

Some Keen levels have separate areas that act like independent mini-levels (the Pyramid of the Forbidden is a good example of this). You can place scroll blocks from the sprite menu to mark horizontal and vertical edges between these areas. The scroll blocks look like horizontal and vertical blue lines with small white stripes; I suggest examining existing levels to see how they are used before placing them in your own levels.

Saving

To save your progress go to "File" and then "Save all Levels". This will immediately save all your levels.

Testing

After saving you can test your levels by adding this to your patch file:

%maphead maphead.ck4

Then run your batch file.

Abiathar

Abiathar: Link and tile properties overlays are activated, automatic boundary been inserted

See Fleexy's official manual, or video tutorial playlist. Alternative just take a look at the Abiathar-Wiki entry for general editing instructions for this very tool.


General Level Editing Issues

If there are too many sprites in a level you will get the error No space left in objarray; the game has run out of memory to store sprites. This usually occurs at the level start. To fix this, remove sprites from your level. When placing sprites, keep in mind that the more variety of enemies you use, the more memory is used up and the larger the sprite and the more frames it has, the more memory it uses. Also, when trying to save memory, check your points items: these exist both as tiles and sprites (try to use tile points whenever possible).

If you have too many different types of tiles (Background and foreground) then you will get the error No space left in tilearray; this means that the game does not have enough memory to store all your different tile types. Foreground tiles use 8x the memory of background tiles. You shouldn't have more than about 400 tile types total (Background and foreground) in a level, usually 100 back and 300 fore. Additionally, animating tiles with many frames can increase your tile count drastically.

  • Note: I have never had this error before and imagine it would be difficult to attain, so don't be worried about using too much until you get this error.

You cannot have more than 20 actively animating tiles on-screen at any one time, this includes item tiles. This will cause an animating tile error. (Not enough memory to animate all these tiles.)

  • Note: This was a major problem in designing the Lava Falls in Dead in the Desert, so be careful when it comes to animating tiles.

If a level is 'too large' for its music file, the error Not enough memory to play background music! will occur. This is an indication of either large levels or large music files. To reduce this error, either make your level smaller or change the music to a smaller file.

If you see static gibberish instead of an animation while testing your level, then you have placed an animating background over an animating foreground. For memory reasons this is not allowed. Similarly, a sprite cannot be placed on top of an animating tile. This will crash the game.

All of these problems and more can be detected with the Abiathar Level Inspector tool or the inspection mode (press I) of the Tile Property Modifier. It also provides exact points in the level where errors and possible issues appear so that you do not have to launch the game repeatedly to fix bugs.


Music and Sounds

Keenwave editing sound names

Copy Keenwave.exe into your "keen4mod" folder. Run Keenwave and it will generate an IDWAVE text file. Create a folder called "sounds". Open IDwave.txt and add this line:

-episode=4 -export=raw -snddir="sounds"

Run Keenwave by dragging and dropping it onto DOSBox.

Now look in your sounds folder. Here you will see a number of sound files and a few music files (IMF files) at the bottom. To change these, just replace the sounds with new file (they must be the same format, for music this is IMF). Sound effects can be created and modified using WDC. You can create IMF files by converting midi files with IMF Creator.

After changing the sounds or songs, go back to IDWAVE.txt and change the command to:

-episode=4 -import=raw -snddir="sounds"

Run Keenwave.

Now open your patch file and include the lines that apply to the episode you're modding:

#Keenwave patch file; Patch sounds Keen 4:
%patchfile $20DF0 AUDIOHED.CK4	#Audio header
%patchfile $354F6 AUDIODCT.CK4	#Audio dictionary
#Keenwave patch file; Patch sounds Keen 5:
%patchfile $21C80 AUDIOHED.CK5	#Audio header
%patchfile $35EC4 AUDIODCT.CK5	#Audio dictionary
#Keenwave patch file; Patch sounds Keen 6:
%patchfile $20C50 AUDIOHED.CK6  #Audio header
%patchfile $36EEE AUDIODCT.CK6  #Audio dictionary 

Creating and Editing Sound Effects

Begin by installing WDC to your tools folder. Once this is commplete, go to the new WDC folder and create three new folders inside: "Keen4input", "Keen4output", and "KeenSounds". You should then copy a clean version of Keen 4 into the "Keen4input" folder, specfically the files: Audio.ck4, Egagraph.ck4, Gamemaps.ck4, and Keen4e.exe.

  • Note: Make sure this version of the keen4e.exe has NOT been unlzexed.

Now run WDC.exe. After is loads, go to File then New Project. WDC will then ask you to name the project and save the project file; name it "keen4project" and save it to you WDC folder.

WDC will then bring up a window with several options. Under Base Data Folder select your folder "keen4input". You will then get a no map code file alert. When this occurs, select User Other and then select blank.wmc. Under Output Folder select your folder "keen4output". On the left side you will see a small menu, select Other Options and then check the box for Use Tile16s for maps, if they exist.

You should now see the Keen 4 world map. You'll be using only one part of WDC, however, so go to View and select either PC Sounds or Adlib Sounds.

WDC will then load the list of sounds for that category. You can sample each sound by clicking it. Playback controls are located in the upper right. To edit a sound, click the small hammer icon in the lower right. WDC will then ask you where you want to save the file. Navigate to your "keensounds" folder. Name the sound in such a way that you can remember what it is: "slugslime", "jump", "item" etc.

WDC will then load it's sound editor. There are various tabs for effecting how the sound is played, and the main area allows you to use your mouse and 'draw' the sound. Sound editing is a complex task and the only real advice I can offer is to just play around in the editor and save sounds that you find good or interesting.

After you've saved some sounds, you'll want to swap these into your mod. To do so you'll first need to locate the original sound file you want to replace in the sounds folder you created when setting up Keenwave. You can do this by listening and finding the sound you want to replace in WDC and then locating the corresponding number in the sounds folder. This is easy for PC speaker sounds, but since Keenwave doesn't seperate the PC speaker sounds from the adlib, you'll have to locate the last PC Speaker sound and then begin counting again from 1 in order to match the adlib sound list in WDC to that in your sounds folder.

When you've located the original sound you want to swap out, copy it's name to your new sound and then replace the file. Then run Keenwave to import your new sound effect.

Working with the IMF Format

In IMFCreator, go to the options menu and set the tics/sec to 560. This will make your songs convert at the correct tempo.

The following (excluding the tip from thehackercat) is written by Mr.M for PCKF/KeenModding:

Compose your music using your choice of software. As long as it outputs standard General MIDI files, you should be good to go.

Please read and get an understanding of the IMF specs.

  • Note from Thehackercat:
    For those of you using a sheet-music editor such as Finale: You may write two or more parts for one instrument. Keep inside the required 4-note polyphony, but don't be shy about using layered parts and chords, especially on piano staves.

Tips From Mr. M:

(1) IMFCreator seems to interpret MIDI note velocities. If your instrument track is too quiet and it is set to maximum volume, try manually adjusting the note velocites to be higher. I know that FLStudio is capable of doing this; I'm sure other studio software packages are capable of this, too. If the volume of the track is too loud after making your note velocities higher, turn down the volume of that track.

(2) Keep percussion parts as simple as possible. It impedes the maximum polyphony limits that can be utilized by other parts. Simply put, you can write more complex parts that use this structure:

[SIMPLE/NO PERCUSSION]+[BASS LINE]+[CHORDS]+[CHORDS?]+[LEAD]

The number of dropped notes, if any, in IMFCreater is almost unnoticeable if you adhere to this formula. I've been able to push the IMF format to it's limits by doing this.

As Thehackercat stated, don't be shy about using chords and complex structures -- especially if your percussion line is nonexistent or very simple.

(3) Try not to use too many midi tracks, especially if they are all simultaneous. Too many midi tracks results in dropped notes (ie- parts drop out randomly and inconsistently), and songs that exceed the filesize limits. I personally only need 4-8 tracks, counting percussion, to archive the sound that I get in my work.

(4) On the subject of percussion: To circumvent the polyphony limit that gets imposed when you use percussion parts, try using normal instruments played outside their normal range. Then in IMFCreator, tweak the patches you used by adjusting all the possible paramaters until you archive the desired percussive sound. It may not work all the time, but it should do the trick in most cases. (Credit for this tip goes to Bobby Prince)

(5) On the topic of modding instrument patches: Don't be afraid to tweak patches! It's under the EDIT, Instrument (or press CTRL+I) menu. You can edit how all the instruments sound (including percussions). Distortion guitar not distorted enough? No problem. Pad not airy enough for you? Bass drum not punchy enough, or the hi-hat not sharp enough for you? No problems there. See the help menus for the specifics of how the patch parameters are edited.

When I do this, I make a patch set for each specific song. When you close the instrument editor, you are prompted to save changes. Do so, and save the .OP2 file that is generated as something other than GENMIDI.OP2 (I like to save it by song title for easy reference). Keep the original GENMIDI.OP2 file as a base set.

After you've tweaked the patches to your liking and saved your new .OP2 file, stop any playback of the song you're previewing. Under OPTIONS and OP2 File you can choose the OP2 file that has the modded patches you created. Press play and listen to your new instruments!

  • Note: After editing an .OP2 file/patch set, you MUST stop and re-start playback of your song for the changes to take effect

(6) Be careful with pitchbends in your music. IMFCreator tends to over exaggerate them if the pitchbend scale and thresholds are not set properly. There is no ONE configuration for them; best bet is to tinker with them until you get a desirable sound. Remember: Lower numbers mean higher pitchbend scale!

As with editing the patch set, you MUST stop and re-start playback of your song for the changes to take effect.


Loading Window

TheDraw editing the loading screens.
TheDraw editing the final Keen 4 screen.

Go to your graphics folder and look for the file 4msc0000.bin. Copy this to your keenscr folder.

Go to commander prompt and navigate to your keenscr folder and then type:

keenscr load

TheDraw will immediately start editing the screen, with the filename keenscr.bin.

Alt+H will display the help screen with all the commands that TheDraw supports; however, its basic use is extremely simple. Use the arrow keys or mouse to select where you want to enter text, then type it in. By default, it uses bright white color over black color; you can copy a color straight from the screen by placing the cursor over any character and pressing Alt+U, and it will use that color as you type.

You can use Alt+M to enter drawing mode, where you can use the cursor keys or the mouse to draw on the screen; you should enable Draw mode with the cursor in the place where you want to start drawing, as it will start immediately. Alt+F1 to Alt+F4 will give you different line styles for Draw mode.

Once you are done editing the screen, you can save it by pressing Alt+S. TheDraw will ask which format to save it in; press B to select Binary, and enter the filename keenscr.bin. It's important that you keep this filename (overwriting the existing one). After you exit TheDraw and KeenScr notifies you that the file has been updated.

Then you must copy 4msc0000.bin back into your graphics folder. Import using modkeen. You must also copy ck4load into your "mymod" folder.

Edit your patch file to include the patch for the respective episode:

%patchfile $1fe47 ck4load.bin 
%patchfile $20cd7 ck5load.bin 
%patchfile $1fca7 ck6load.bin 

You can also edit the exit screen by going to the command prompt and typing: keenscr 4

When you're done, save it as keenscr.bin overwriting the generated file. You must save it in Binary format when TheDraw asks. It's important that you keep this filename (overwriting the existing one) as KeenScr will recreate the original ?msc0000.bin file with it. After you exit TheDraw, KeenScr notifies you that the file has been updated, you can import it back into your graphics folder using ModKeen.


Scrolling Text

Keen 4 Star Wars like scrolling text story.

Run Startext. The controls are listed. Select your episode of choice and then select edit scrolling story. Type your story as you want it, making sure not to go over the space limit or under it (the original story will appear at the bottom of your story if you do). Press enter.

Copy story.ck4 into your "mymods" folder.

Edit your patch file to include one of the following:

%patchfile $1EE40 "STORY.CK4"
%patchfile $1FDE0 "STORY.CK5"
%patchfile $1ED50 "STORY.CK6"


Credits For This Tutorial