INI File explained - Manic Miner for Windows

This file explains how Manic Miner for Windows uses the file LEVELS.INI to store levlels information. I hope that if you use this file, you could create your own levels. While you read through this file, look at LEVELS.INI to see how the rules that are explained here are implemented in the LEVELS.INI that comes with the game.

If you don't understand something despite my explanation, please write to me, and I'll try to do my best to explain better. I would ask for one more thing - if you do create levels using the format explained in the INI file, please send me a copy.

Using images stored in PCX files

Manic Miner for Windows needs all the graphics images to be stored in PCX files that have 256 colors. All the PCX files you use should share a single palette. Just use the palette that's stored in IMAGES.PCX. Usually, when we reference a PCX file from the INI file, we use a number. Number 0 always refers to IMAGES.PCX. Number 1 always refers to MISCDATA.PCX. Numbers 2 or higher refer to other PCX files according to a definition in the INI file which we'll get to later.

The [General] Section

This section defines only the following 3 items:

Levels How many levels are defined in this INI file. After all levels are finished, the finishing sequence is shown, and the game resumes at level 1. Each level should have its own section named [LevelXX]. Currently the number of levels is limited to 99 because the number of the level in the section name must be 2 digits long.
ManicL This item defines 8 images of Miner Willy as it moves to the left. Each image is 30 by 40 pixels, and a pair in the format (x,y) describes the position of the image. The images are always taken from PCX 0 (IMAGES.PCX).
ManicR This is the same as ManicL, but for Willy as it moves to the right.

The [LevelXX] Sections

As mentioned before, there's a [LevelXX] section for each level of the game. This section describes all the features of this level from the level name to the movements of the guardians. Here's a list of items that are defined in each level:

LevelName Name of this level. It's limited to 32 characters. The valid characters can be seen in MISCDATA.PCX.
Images A list of PCX file names, seperated with commas. This list defines the images that are available in this level in addition to the 2 predefined PCXs. The PCX files are numbered 2, 3, and so forth, in the order of the list. See for example [Level15].
nChars The number of characters defined using CharXX in this level. These characters are used to define the layout of the level.
nKeys The number of keys in this level.
Gate The position and appearance of the gate. The format is:

Gate=(xpos,ypos) imageno,(x,y,xdiff,ydiff)

xpos and ypos - Position of the gate in character coordinates.

imageno - Image (PCX) number where the gate image is.

x and y - The location of the gate image in image coordinates, as it looks before all the keys are collected

xdiff and ydiff - The ofset between the above gate image, and the second gate image. When all keys are collected, the gate flashes between the 2 images. The position of the second image is x+xdiff and y+ydiff.

Pos Miner Willy's position and direction as the level starts. The format is:

Pos=(xpos,ypos,finepos,dir)

xpos and ypos - Position of Willy in character coordinates.

finepos - The initial x position inside the character position. This is a number in the range 0 to 3, and is measured in 1/4 of a character (2 original pixels). 0 means Willy is standing at the leftmost position within the character when facing left, and at the rightmost position within the character when facing right. Test it to see how it works.

dir: 1 - Willy starts facing left. -1 - Willy starts facing right.

nMonsters Number of guardians in this level. Please note that in some cases, what looks like a guardian on the screen is actually 2 guardians occupying the same position. This is sometimes used because of color restrictions. See examples for that in [Level10] - The Endorian Forest.
Back What image should be used to draw the background. This image is tiled over the entire surface of the level. The image size is in characters, and can be larger than a single character. In the current INI file, all background images are solid colors, but it need not be like that. This item also defines the border color. The format is:

Back=imageno,(x,y,xsize,ysize),border

imageno - Image (PCX) number where the background image is.

x and y - the position of the background image.

xsize and ysize - The size of the background image in character coordinates. So if xsize and ysize are both 2, the image should be 48x48 image pixels - 2 characters = 16 pixels = 48 image pixels.

border - The color of the border around the screen, specified in palette index.

MonsterXX Definition of a single guardian in this level. See Guardian Definition for more information.
CharXX Definition of a single character out of the level layout. See Level Layout Definition for more information.
LineXX Definition of a single line out of the level layout. See Level Layout Definition for more information.
LaserBeam X position in character coordinates of the laser beam. The laser beam always starts at th top row and moves down until it hits a guardian, then it continues to the left until it hits another guardian, and so forth. It's absorbed by any ground or wall. A laser beam is currently defined only for level 19 - Solar Power Generator, but it can be defined in other levels too, if you want.
OverlayImage An overlay image can be used to superimpose an image over a part of the level layout. The overlay image is currently used only in level 20 - The Final Barrier to draw the top portion of the screen. Currently, the overlay image always starts at the top left of the screen. The format is:

OverlayImage=imageno,(x,y,xsize,ysize)

imageno - Image number of the overlay image.

x and y - position of the overlay image within the image (image coordinates).

xsize and ysize - size of the overlay image in image coordinates.

 

Guardian Definition

A guardian is a moving object that usually kills Willy when they touch. In some rare cases, I've used guardians for other actions. I will discuss these features later. A guardian is defined by a MonsterXX item, where XX is a 2 digit number. There are 3 types of guardian definitions:

Currently, only the following levels have complex guardians definitions. But you can add complex guardians to any level you want, of course.

All other levels include either simple or vertical guardian definitions.

Simple Guardians

Specify simple horizontal moving guardians using the following syntax:

MonsterXX=s imageno,(xpos,ypos)[,colorshift] ([xmiddle,]xstart..xend,y)

s Simply use the character 's' to signify that this is a simple guardian definition. You can also use the character 'h' to signify that this is a simple definition of a guardian that moves in half speed. You can create horizontal guardians that move in other speeds, but this will require a complex definition.
imageno Image (PCX) number of the guardian.
xpos and ypos The position of the first image of the guardian. A guardian is always 2 by 2 characters (48 by 48 image pixels) in size. You should define 4 images for a simple guardian. The first image should be at xpos, ypos and the other images should be at xpos+50, ypos, xpos+100, ypos and xpos+150, ypos. The images should show the guardian as it faces right. When the guardian is moving to the left, a mirror image of there images will be used.
colorshift This is an optional parameter. The default is not to use any color shift. If the color shift is non zero, the guardian will be drawn by using the colors in the original image, and adding the colorshift value. The operation is done in the palette index level. The palette of the game is arranged so that if you design a guardian using pink colors (indexes 112 to 127) and you use a colorshift of -32, the guardian will appear in yellow. This is just an example. Take a look at the palette for more insights.
xstart and xend The starting and ending x position, in character coordinates of the guardian. The guardian will walk from the starting position to the ending position and then back to the starting position and then repeat this, until the end of the level. If xstart is smaller than xend, the guardian will initially move to the right. If it's the other way around, it will initially more to the left.
y The y position of the guardian, in character coordinates. This is a horizontal guardian, so its y position remains constant.
middle This is an optional parameter. Most guardians start at one end of their moving range. If this is not the case, specify the starting position, in character coordinates, using this parameter. The guardian will start at the middle position, walk to the xstart position, and then go into the endless loop of xstart to xend. Usually middle is between xstart and xend, but it doesn't have to be.

Vertical Guardians

In Manic Miner for Windows, vertical guardians are used in the following levels:

You can add vertical guardians to any level you want. Use the following syntax:

MonsterXX=v imageno,(xpos,ypos)[,colorshift]
            (firstimage, x, ystart, ytop, ybot, speed)

For viewing convenience the definition is broken into 2 lines. In the INI file this should be one long line. The parameters imageno,(xpos,ypos)[,colorshift] are the same as in a simple guardian, so I will not repeat the explanation here. As for the other parameters:

firstimage A vertical guardian uses 4 images in rotation as it moves. Specify the image number in the range 0 to 3 to be used when first entering the level.
x The horizontal position of the guardian. Since this is a vertical guardian, this position doesn't change during play time. It's specified in character coordinates.
ystart The vertical start position of the guardian. Please note that this number is specified in pixel coordinates.
ytop and ybot The vertical top most position and bottom most position of the quardian. These values are also specified in pixel coordinates.
speed The pixel speed of the guardian. If this parameter is positive the guardian will initially move down. If negative, it will initially move up.

Most of the guardians in Manic Miner can be defined using either the simple syntax or the vertical syntax. In a few other cases, this is not possible, and we have to define complex guardians. We'll talk about complex guardians after we explain how to define the layout of levels.

Level Layout Definition

The level layout is defned by a 32x16 matrix. Each element has the size of a character. Each character has an appearance, and also properties. For example - A crumbling floor, a ground, a wall, a key and so forth.

We define a level layout by first defining the type of characters that are available in this level, and then arrange them into the layout matrix.

Character Definition

Remeber that you must use the nChars parameter to specify how many characters you're about to define for this level. Then, use the following syntax for every character:

CharXX=sym,hex,count imageno,(xpos,ypos[,xdiff,ydiff])[,colorshift]

sym A single character that identifies this character type in the level matrix. You can use any printable character, except for the dot (.), which stands for 'empty' in the level matrix.
hex A hexadecimal value that characterize the properties of this characters. For example - a value of 82 is used for a ground, and a value of 20 is used for a nasty.
count How many images this character has. Usually this value is one, but if this value is greater, this character will change appearence in a loop: image0, image1, image2, ..., image(count-1), image0...

For example, a conveyer belt character uses 4 images. A key also uses 4 images.

A negative value is used to implement crumbling floor. This character has 8 images, but it doesn't switch automatically between them. It switches images only when Willy walks above it. After all 8 images are used, the character is replaced with an empty character.

xdiff and ydiff These parameters are required if and only if the count parameter is not 1. The first image is located at (xpos,ypos) in imageno, the second at (xpos+xdiff,ypos+ydiff), and so forth. If both xdiff and ydiff are 0, the character is drawn using alternate colors using colorshift for the first image, colorshift+16 for the second, colorshift+32 for the third, and so forth.

I think this explains everything except for the hexadecimal properties definition. Here are the common values that are used:

82, 86, 8A, 8E, 92 A regular ground.
C2, C6, CA, CE, D2 A block.
20, 21, 24 A nasty.
BE A crumbling floor character, as it starts (nothing crumbled yet).
A2 A crumbling floor after 7 times Willy stood on it. The next time he will stand on it, it will turn into an empty character. Character A2 is used to define the 8 images of the crumbling floor. The BE character is used to specify the position of the crumbling floor in the level layout.

Actually, a crumbling floor uses 8 characters - BE, BA, B6, B2, AE, AA, A6, and A2. As Willy steps on such a character, it changes to the next one. You can create a crumbling floor that disappears after less than 8 frames, but this wasn't used in the original game.

81, 85, 89 A conveyer belt that moves to the left. Having more than one hexadecimal value for a conveyer belt lets you design fancier conveyor belts (with edges).
83, 87, 8B A conveyer belt that moves to the right.
40 A key to collect.

This is just a partial list of hexadecimal values (there are 256 values, of course). These are the values that were used in the original Manic Miner for Windows INI file. You can create, for example, a crumbling floor that's also a conveyer belt. I'm sure you can guess what hex value should be used for that.

Layout Definition

Once the available character types are defined, you create the layout using 16 lines, in each 32 characters. Each character that appears in this matrix must be defined using a CharXX definition. That's true except for the point (.) sign, that's used for an empty character.

Define the 16 lines using LineXX items.

Complex Guardian Definition

What makes Eugene a complex guardian? It moves up and down like a standard vertical guardian, but when the last key is collected, Eugene stops the cycle and heads down to cover the gate. This is a complex behavior. You can create even more complex moving guardians using the following format:

MonsterXX=c imageno,(xpos,ypos)[,colorshift] (x,y) movement

s Use the character 'c' to signify that this is a complex guardian definition.
x and y The starting position of the guardian. This is specified in character coordinates.
movement A string that contains a coded list of commands that tells the guardian how to move. This is almost a small program.

Here's a list of available "commands" that can be used in the movement string. I will only briefly explain these commands, you'll have to see where they're used and use your common sense to fully understand complex guardian movement commands:

R Set the guardian to right display mode (normal image display)
L Set the guardian to left display mode (mirror image display)
digit Use the image with that number to display the guardian in the next frame. This command is also used to specify the end of sequence of commands for this frame of the game.
! Return to the beginning of the command code. This command is used to create an endless loop. Here's a very simple movement code:

0123!

This means the guardian will forever (or at leat air runs out) cycle through 4 images. It will not move. It may seem that this command should be used only as the last character of the movement command, but it's not. Read on.

r{num}: Begin a repeat loop with 'num' iterations. Note you should use the character 'r', followed by a number, and then followed by a colon (:). No spaces are allowed. Repeat loops cannot be nested.
e End a repeat loop.
> Move the guardian one character to the right (8 pixels).
< Move the guardian one character to the left.
\ Move the guardian one pixel to the right.
/ Move the guardian one pixel to the left.
+ Move the guardian one pixel down.
- Move the guardian one pixel up.
x{num}: Exit the current repeat loop if the guardian's x position is exactly num. This is measured in pixel coordinates.
y{num}: Exit the current repeat loop if the guardian's y position is exactly num. This command is used to control Eugene's fall after the last key was collected.
^ Set the beginning of the endless loop (who's end is marked by an exclamation point). By default the (!) command returns to the beginning of the command, but once the (^) command is reached, the endless loop will return to that command from this point and forward. The Kong Beast uses this command.
s{num}: When a level starts there's status variable that is automatically set to 0. When this command is reached by a guardian, the status changes to the specified num. See the next commands for uses for the status.
* This is a "good" guardian. When Willy touches this monster, he's not killed. Instead, the monster ends it counter loop. Usually at the end of the counter loop (after the 'e') character, you'll put an 's' command to change the status, and cause other guardians to "do" special things.
?{num}: Return to the beginning of the endless loop (like the '!' command), but only if the current status matches num. Recall that in the Kong Beast levels, there's a guardian that moves from side to side on a limited path until Willy pulls the handle, then this guardian extends its path. The '?' command is used to perform that.
@{num}: Jump to this command when the status changes to num. This command is used by the Kong Beast. When Willy flips the second handle, the status changes, and the Kong Beast (that runs an endless loop of changing between 2 images), jumps to the code that makes it fall.
c{x},{y}: Clear the board in the location (x,y), specified in character coordinates. This command is used to open the splitter in the Kong Beast levels, and also to make him fall, as we make the ground under him disappear.
p{num}: Add 'num' points to the score. Once again, this command is used in the Kong Beast. As he falls, we get a lot of points.
} Increase the guardian image number in the cyclic range of 0 to 3. This command also marks the end of commands for this frame. This command is used for vertical guardians. The movement command string automatically created when you define a vertical guardian uses this command.
S Move the guardian 8 characters to the right and to the top. This command is solely used in the Skylab Landing Bay level.

That's all the commands. Now it's time to look at some of the complex guarians in the INI file and see how they can be brought to good use.

More about Character Definition

(tbs)

Some Definitions

Character Coordinates

The screen layout is divided to 16 rows of 32 characters. When a position is specified in character coordinates, the x position can be in the range 0 to 31, and y position in the range 0 to 15. Each character is divided to 8 by 8 pixels (original ZX Spectrum pixels). Some positions are defined in this finer Pixel Coordinates resolution.

Pixel Coordinates

The screen in comprised of 256 by 128 pixels. This does not include the level name and everything below it. Each pixel is the original ZX Spectrum pixel. Manic Miner for Windows actually uses 3x3 pixels for each original pixels, but to be compatible with the old game, all coordinates are limited to the original resolution.

Image Coordinates

Coordinates within a PCX (image) file. They're measured in pixels. image coordinates are 3 times finer than pixel coordinates, since Manic Miner for Windows is drawn in a resolution that's 3 times higher than the original game. For example - A monter is usually 16 by 16 pixels (original ZX Spectrum pixels) in size. This means that in a PCX the guardian should be drawn in a 48 by 48 size.