Setting up the map editor

Downloads

Source code
Executable (Windows 32bits)

Before you try to compile the code you will have to change the path to "Tile.png" at the beginning of Map.cpp

Format of the maps

A level of the game is a grid of square tiles. Obviously, when you play the game, you can see that you move tile by tile.
But how do we represent a wall ?
There are two main ways to see walls.
I didn't know which representation the original game used. So I asked myself "what do we see when we play ?"
We see walls. We don't know when we see a wall if the tile behind is filled with something or empty.
And as I think that the map editor could be used for others game I opted for the most flexible format, even if it's the more expensive in terms of memory size.

Each tile will contain a byte representing it's type, saying if it's an empty tile, a tile with a hole in the ground, a teleporter, etc..
Each tile will also contain 4 "wall" elements representing the "inner" side of each wall - the side that we see when we are inside of the tile.
Obviously the outer side of each wall is the inner side of the corresponding wall of the tile next to us.
Each of these "wall" elements will contain a byte that will tell it's type - either if it's a plain wall, a wall with a switch, a wall with an alcove, etc...

The map will be wall-based. So if we want to move from one tile to another we will test the walls between them. In fact we will only test the "inner" walls of the starting tile.

The editor


This is the first version of the map editor.
On the left there is obviously the map. If you resize the window you'll see that this area will strecth to fill the space available.
As you can see on the image, if this area is to small to contain the map, a scrollbar will appear to allow us to move into the map.
This way we can work on map of any size.

On the right, is the "tools" area. At the moment there is only a "tabview" that will allow us to work at different levels on the map.
There will probably be more tabs in the future i.e. for the monsters...

Let's use it

Click on the "Tiles" tab and move the mouse over the map, you will see a green square that shows you the tile where your mouse is.
Press the left mouse button and the tile will change to a beautiful hand drawn "stone pattern".
Press the right mouse button and the tile will turn black again.

Note: If you compiled yourself the sources and you see that nothing changes when you click on the left mouse button, check the path to "Tile.png" in Map.cpp

Now "draw" a few tiles like that, and click on the "Walls" tab.
If you move your mouse on the map you will see that the green square is now a rectangle that represents the walls.
There is no way to draw a wall at the moment.

If you click on the "Objects" tab, you will see that the green square is smaller. Because in the original game there are 4 possible positions to place an object inside a tile

The code

Here is a description of the different files: