Keen Galaxy Modding Tutorial (by Ceilick)

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, (Mirror)
    • 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. All of these editors are included in the modding package. The most up to date, well documented and recommended level editor is Abiathar.

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 KEEN4E.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 available 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.

You can also create a patch file from scratch. To do this, create a new .txt file called mymod. Open the file and insert the following code lines:

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

Finally save it as mymod.pat and make sure you select all files in the Save as type section. You should now have a mymod.pat file.

Play.bat batch 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 on the Patches Wiki page 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

Galactile working with Keen 4
  • Note: The steps described below are for a basic understanding of tile properties in general. For the sake of simplicity the following will be based on a standalone tile properties tool called Galactile. Note that the level editor Abiathar comes with a build in Tile Properties tool as well, which works quite similar to the beneath mentioned steps.

Go to your "Tools" folder and go into your Galactile 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 Galactile. 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, some general knowledge about how Keen Galaxy levels work is needed.

General knowledge

Layers

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 Galactile 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).

Level borders

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).

Tiles vs info plane

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.

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.

Level Editors

Picking the right level editor might be a choice of taste. TED5 from the early 90's seems be the first draft for purists. But for a beginner it's recommended to go with Abiathar. It's the most up to date and feature rich level editor and also comes with a detailed manual. In opposite to other editors it continues to be updated and altered semi frequently, as new features and functionality are added.

General instructions for TED5, Keen Next (K:N), The Photachyon Transceiver (TPT), The Omegamatic (TOM) can be found on their respective wiki pages.

Abiathar

With the download comes a Documentation/Help file which is strongly recommended. It contains advanced information this tutorial cannot match. The Author also uploaded a video tutorial where most of the basic features are examined.

Abiathar Project Wizard.

Setting up Abiathar

To get started open up Abiathar with the defaults. Go to File, New, a Project Wizard appears. This wizard will walk you through the creation of your dependency file (project). Select your episode from the drop-down in the upper right, check all the boxes (those are what tell it to use defaults), set the tileinfo drop-down to one that either dumps or reads from memory, and click Finish. Abiathar will now become usable for editing.

Navigation through Abiathar

In Abiathar one can move throughout the level with the help of the keyboard and the scroll wheel.

Keyboard Arrow keys move the viewer 1 tile
Holding Control changes the offset to 5
Holding Shift multiplies the offset by 3
Pressing Backspace moves back to the upper left
Scroll wheel Each notch of the wheel moves 2 tiles vertically
Holding Control makes it move horizontally
Zoom The zoom controls can be found under the View menu
or by using the + and numpad keys.

Common Tasks

Abiathar with all planes activated.

This section guides only through the most frequently used features.

Tile Palette

The tile palette can be called either with the Tileset menu or by pressing the appropriate
number key after pressing Space, which switches to the tile palette view:
1 calls the background set,
2 calls the foreground set,
3 calls the set of infoplane pseudo-tiles.
Simply click a tile to copy it to the respective bay. When finished, press Space to return to your level. If you do not want to press Space to access the palettes, you may at any time press:
7 to open the background palette,
8 for the foreground, or
9 for the infoplane.

Plane States

Abiathar: Background plane activated, Foreground plane hidden, Infoplane locked .

Editing with all planes active all the time would be very difficult. To help you see and change only what you want to, Abiathar has several systems to control the status of the planes. Each of the three planes can hold one of three states:

Active visible and editable (default)
Locked only visible
Hidden not visible or editable

These can be controlled in several ways. The Plane menu provides fine-adjustment tools and commands to modify the state of multiple or all the planes at once. While viewing a level, the 1-3 keys control editibility for the respective plane, while the 4-6 keys control visibility. For example, the 2 key toggles the foreground plane between Active and Locked, while the 4 key toggles it between Active and Hidden. The labels in the selected tile bay that display the plane states can also change them. Right-click one to make it less active (active will become locked, locked will become hidden) or left-click to make it more active (hidden will become locked, locked will become active).

Undo & Redo

Undo and Redo can be found under the Edit menu or pressing Z instead. The undo/redo action stack is preserved until the file is saved or closed.

Level Operations

Abiathar: Link and tile properties overlays are activated

Level Operations can be accessed from the Level menu, above the levels list. Adding a level is done with LevelAdd. If one changes the suggested ID to one that is in-use, a warning will pop up before overwriting. The Automatic edge check box will cause Abiathar to automatically fill in the boundary.
Even after a level is created, its dimensions can be changed or an automatic border can be added using the using the LevelProperties dialog. It is also possible to duplicate levels into a new slot with LevelCopy.

Overlays

All overlays can be found under the View menu section.

Grid separating the tiles (it is automatically adjusted for changes in zoom level)
Links overlay processes unknown infoplane values and renders graphical links instead of infoplane
Tile Properties displays foreground tile properties even in the selected tile bay and tile palette


Playing edited Levels

Abiathar inserting Patches.

Once some work has been done on a level set, it is advisable to test them in-game. This, and the final publication of the mod, require the use of CKPatch to patch the maphead (and, if they exist, mapdict and tileinfo) back into the game to read the modified gamemaps file.

Other custom patches that are not automatically generated by Abiathar, can be transfered to the Patches store found under Edit. Therefor all things which are listed the text field above need to be remove from the custom patches. Now Abiathar will integrated them into the generated patch file. Once confirmed that, the appropriate patch, batch, and patcher program files will be created in the dependency file’s directory. The now created play.bat launcher file needs to be run instead of the original Keen executable.

Abiathar creates and saves CK*PATCH.EXE abiathar.pat, play.bat.

iD Software used a self-extracting compression format called LZEXE on the program to make it smaller, thereby fitting it on a floppy disk. Before CKPatch can work, the Keen executable must be decompressed. Abiathar contains UNLZEXE, a program to reverse the compression. Choose Un-LZ EXE under File and open the Keen executable. If it was LZ-compressed Abiathar will decompress it.

Files and Storage

To storage modifications press Save under File. The first time doing this, one popup box will appeare, asking where to store the dependency file. The level set's settings will be written to an *.adeps file, which only contain references and pointers to the real resources files, but don’t store any level data on their own. They are automatically saved as the names beforehand specified in the New Project Wizard.
Closing Abiathar for the first time, quite a few settings will get saved to the editor.aconf config file. Those settings are loaded when Abiathar starts.


Special Tasks

Sprites and Enemies

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 Tile Property Modifier tool in the Tool menu. 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, press L and K on your keyboard. This activates the linker tool. Make also sure that only the Infoplane is active. Next click on the switch tile first and second on the blocking tile. Abiathar will render the links as lines from the controller to the target.

Switches for bridges

To create a switch for bridges, first build the bridge using the bridge tiles and place the switch tiles somewhere (near). Then press L and K on your keyboard. This activates the linker tool. Make also sure that only the Infoplane is active. Next click on the switch tile first and second on the top left most bridge tile. Abiathar will render the links as lines from the controller to the target. 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 the Tile Property Modifier tool in the Tool menu.

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. Then press L and K on your keyboard. This activates the linker tool. Make also sure that only the Infoplane is active. Next click on the switch tile first and second on the topmost door tile. Abiathar will render the links as lines from the controller to the target.

Doors

To place doors that Keen can enter, first place two sets of door tiles on the map. Then press L and K on your keyboard. This activates the linker tool. Make also sure that only the Infoplane is active. Next click on the bottom tile of the first door and after that click on one tile below the second door. Repeat this step vice versa. Abiathar will render the links as lines from the controller to the target. I suggest examining some of the original levels to get an idea how this is done.

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.


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