Home arrow Projects arrow Other Projects arrow Level Editor for platform games
Level Editor for platform games Print E-mail
Saturday, 01 April 2006
ImageA long, long, long time ago, I decided it was time to write a game. A platform type game it would be. The operating system of choice was MS-DOS. Windows was not yet very popular at the time. And in any case, I didn't know anything about it. I figured that somewhere along the line, I would need a tool with which to create the levels. And before even thinking about any game details, I set out to creating a level editor. The platform game never materialized, but the level editor was salvaged from a floppy disk. In an ongoing effort to rescue anything I created that is remotely interesting, I'm presenting it here.

A common way to create the levels of a platform game is to use small rectangular graphics called tiles. These tiles are created in such a way that they can be placed next to other tiles to draw the graphics world of the game. The advantage of doing this (as apposed to using one large picture) is that each tile can be reused over and over again. All tiles are stored as one picture file called a decor file. The level of the game can therefore be defined as a list of index values related to the tiles in a decor file. Futhermore, multiple levels can be based on the same decor.
ImageThree files are needed to run the program. LE.EXE is the main executable. It uses the SVGA256.BGI file. STANDEC.VI is the decor file that contains the tiles.

The Keys / How to use
Use the arrow keys to scroll the map.
SPACE toggles between selection screen and map screen.
Left Mouse button selects a tile (on either selection or map screen). Dragging the mouse while the button is down selects multiple tiles. If one or more tiles are selected, pressing the left mouse button paints the selected tiles at the location indicated by the tile outlines.
Right mouse button deselects any tile. You need to do this before making a new selection.
F1 - for a help menu
F2 - load level
F3 - save level
F4 - clear level
F5 - open decor file
F6 - screen dump current screen to file
F7 - row operations (insert/remove)
F8 - column operations (insert/remove)

Some details

  • Each tile is 16 x 16 pixels in size.
  • The default size of the map is 200 x 30 tiles. This can be changed through the row and column operations (max 1000 x 48).
  • In total, there may be no more that 256 colors in the entire level. Palette is defined in decor file.
  • The program uses the svga256.bgi library for Borland's Turbo C++ (etc.). Keep this file next to the main executable and the decor file(s).
  • The source code is available. It's not very well documented, and many methods and variables are not written in English.

File format of the decor files and screen dump files
The graphics format used for this is Jovian VI. This rather unknown format can be read and converted by XnView. Image Alchemy can be used to create such files. The level editor runs in a 320 x 200 resolution (256 colors). The files must use the same.

File format of the saved levels
The tile indices are written to a binary file (column for column). Each index is one (unsigned) byte. The first 4 bytes of the file contain the width (byte 0 and 1, 1 is most significant) and height (byte 2 and 3) of the level. For more information, see the source code.


There are two downloads available. The executable files including one sample level called LEVEL1, and a file containing the source code including the Turbo C project files.

NOTE: I'm right now writing some kind of platform game for mobile phones (Java, J2ME). I found that this old tool does its job nicely. The decor file can be converted to the PNG format. The binary level files can easily be read and interpreted. MIDP-2.0 has the TiledLayer class which is based on exactly the same principle of using indices and decor.

Only registered users can write comments.
Please login or register.


Last Updated ( Tuesday, 09 May 2006 )
< Prev   Next >
2006 Vangilz.com. All Rights Reserved.