Mappy (and I think I should have picked a better name for it) is an editor and playback library system to help people writing games that use a 'tilemap'. The tilemap is a system for storing a rectangular area of graphics using less memory than a complete picture, and also gives other useful features like collision detection (solid areas). There are different versions of the editor, but they all use and make the same FMP map files. MappyWin32 V1.3 introduced FMP V1.0 which requires a playback library that supports it, but you can still make the old FMP format with it.
Mappy allows you to take a picture and split it into blocks (tiles), these can then be put in a grid to make a level of any size, also the blocks can be given properties, layered, and even animated. When you have made the level, you can easily load, display and move it in your game by using the Mappy playback library for your system.
Currently the main site is:
http://www.tilemap.co.uk
with a mirror site at:
http://www.geocities.com/SiliconValley/Vista/7336/robmpy.htm
See the docs for the different downloads.
When I first started writing PC stuff (I got DJGPP and Allegro in 1997), having transferred from the Amiga, I looked for a decent map editor, there weren't many about and they didn't have the features I wanted (animation and layering, mainly). So I decided for my first project to sort of 'translate' my Amiga map editor I used (which may explain the IFF style file format Mappy uses). I just kept tinkering with Mappy in my spare time, when I needed to learn Windows C programming I just converted the dos code to that, but deliberately separated the Windows code to try to make Mappy portable (see source).
(Download pages).
Up to you really, if you just want to see how it works and have a Win32 capable system (Win 95/98,Me,2000,NT or XP) get the top file under 'Mappy editors' (MappyWin32) this has the editor and test maps to play about with. This editor has a built in DirectX preview and extensive html documentation. All the editors load and save the same FMP files, see compatibility.
If you want to use the maps you make in your own game, you will need to download a playback library which contain sourcecode, examples and documentation. These can be found further down the Mappy page and include:
MappyAL - for Allegro and WinAllegro developers
MappyDX - for DirectX SDK developers
MappyJV - for JAVA developers
CDXMappy - for CDX developers
and many more...
The original editor (just plain 'Mappy') is a DOS program, NT users may have problems with it, MappyWin32 doesn't run under DOS. MappyWA (DirectX) has the same look and features as Mappy, but is a Windows application (it is the worst version of the editor, but has its uses, like for editing the raw graphics within a FMP file). If you want to keep it simple, and can run it, MappyWin32 is the only editor you need.
The maps you produce are interchangeable between all the editors mentioned, but there may be a few problems in these situations:
MappyWin32 is screen independent, the others aren't. If you make a map in 24bit colour and try to load it in Mappy when your graphics card doesn't support it it will exit.
MappyWin32 can display areas outside the map (they appear grey), the other editors can't. If your map is too small to fill a 640*480 screen, or you have saved the map when you are too near the bottom right, it will not load in the other editors. The only editor that currently supports FMP1.0 is MappyWin32 (V1.3 or later)
If you are trying to use all the features, it is complicated and will take some time to learn them. However, if you are just using it as a basic map editor it is very simple, create a map, import the graphics, put blocks in map, save map. It is only when you try to do more complicated things like add transparency, parallax, and animation that it gets more complicated. Start by doing a simple map, then try the features one by one. The MappyWin32 documentation covers all the features in detail.
I have just made a BIG tutorial including a complete game source, map, html docs. It goes through making the graphics, map, game, adding sound. This is well worth a look, available at the main Mappy site, called 'Mappy Tutorial 1'.
Tutorial Errata:
When playing the game, if you collide with a baddie, you appear back at the start
The tutorial suggests using a picture of 640*480 for the blocks, this is only good for block sizes of 20*20 pixels or more otherwise you break the 1024 block limit for FMP0.5 (there are 1200 16*16 blocks on a 640*480 picture)
These are source files containing functions for loading and using the map in your game, documentation and examples are included. They can be modified as you like, and there are no restrictions on how you use them. See downloading for details...
You can assign information to a block by double clicking it in the Block Editor window (MappyWin32), but how do you access this in the playback libraries? Use the function 'MapGetBlock' which returns a BLKSTR pointer. You can then access the information. The numeric information is in the 'user' fields (1 to 7) and corresponds to the 7 white edit fields of block properties. The collision information is tl, tr, bl and br. The 'other' information is 'trigger' (this is also the BG transparency bit), and unused1, unused2 and unused3. To access it from the BLKSTR, simply use something like this:
BLKSTR * myblock;
myblock = MapGetBlock (blockx, blocky);
if (myblock->tl) { topleft collision bit is set }
switch (myblock->user3) {
case 0:
the user3 field has a value of 0
break;
}
score += myblock->user1; /* Add value to score */
See the header file for the BLKSTR definition. One thing, the values are all unsigned by default, but you may want negative values, just use a cast. There is an example of this in Mappy Tutorial 1 in the dxstuff.cpp and alstuff.c files.
A 'block layer' in Mappy is a graphic that is part of a block structure, you can see the in the block properties dialogue above BG, FG1, FG2 and FG3. These are drawn by calls to MapDrawBG etc. This allows you to layer sprites in between the block layers.
A 'map layer' is a complete map array, or basically what is shown in the main window in Mappy. These can be edited in the 'layers' menu of MappyWin32. It is often not necessary to have more than one layer, although you'll see a good use for a second one in Mappy tutorial 1 (on the Mappy site).
Please see the documentation for MappyWin32 V1.4 if you are using that, if you are using another editor, read on:
Depends how you've done it. The easiest way is to initially make the picture you are using for the tiles large enough to hold all the tiles you want to use (say 640*480, but make sure there can't be more than 1024 tiles (or 30000 for FMP 1.0), 16*16 or lower should not be put on a 640*480 screen (=1200 tiles)), then fill it with a colour OTHER than black. Now when you make the tiles, put them on this, import into the map for the first time and say 'YES' to make new block structures, you will get a lot of extra ones that all look the same, just ignore them for now. When you want to change your graphics or add new blocks do so on that picture, import the picture again, say 'NO' to make new block structures, then 'YES' to replace existing graphics. When you have finished the map, you can simply choose 'Remove unused blocks' then 'Remove unused graphics' from the MapTools (careful with those! back up the map first) to only keep the tiles and graphics being used, this will shrink the map filesize down nicely.
This topic is also covered in Mappy tutorial 1.
There could be a number of reasons, but these are the most common:
* The picture size isn't a multiple of the block size (example: 16*16 blocks on a 251*109 picture)
* The blocks are not lined up properly on the picture, make sure the first is in the top left (0,0), export a BMP from the test.fmp to get an idea
* The blocks are a different size from the size specified in 'New Map'
This is possibly the most asked question. You nominate a colour to be transparent (usually index 0 in 8bit, some uncommon colour in other depths such as magenta (0xFF00FF)). This is NEVER drawn if the graphic is in the FG1, FG2, FG3 fields of a block structure. If the colour is used in the BG graphic it IS drawn UNLESS the BG Tranparency box is checked in the block properties. The BG Transparency box is the top left box of the 'Others', this will be labelled better in later versions of the editor. Make sure you check this box for block 0 if you want BG transparency! The BG transparency only affects drawing in calls to MapDrawBGT. You can check you've done it correctly in MappyWin32 by doing an anim preview in the correct colour depth with 'show background with transparency' checked and some block other than 0 as the 'Block Graphic for parallax'. You can also use 'Autoset BG transparency' in MapTools.
This is the expected result if you use MapDrawBGT without drawing anything beforehand. MapDrawBGT doesn't draw the transparent colour, and if you haven't drawn anything behind the previous frames are seen. You should either use MapDrawBG, or draw/clear the area (with parallax, backdrop graphic, etc) before calling MapDrawBGT.
FMP is short for Flexible MaP. It is very similar to IFF, and is flexible because other information can be added to the file without stopping it being loaded into Mappy. For this explanation, when I mention 'LSB' that's 'least significant byte first' and is the way Intel or x86 store their information, 'MSB' 'most significant byte first' is how Motorola and some other CPUs work. The difference is how numbers of more than one byte are stored in memory, example:
0x12345678 in LSB=0x78563412, in MSB=0x12345678.
This isn't a problem unless a number in a file written in LSB is read on an MSB processor, or the other way round. The first 12 bytes of an FMP file are the header, in ASCII it's FORM????FMAP, where the '?' is a long int in MSB format indicating the size of the file less 8 bytes (technically the first 8 bytes, FORM???? are the header which is why they don't count). There follow 'chunks' which contain information about the map, these can be in any order but for sanity's sake MPHD precedes chunks that rely on the information in MPHD. All chunks should be an even amount of bytes in size. A full explanation of the chunks can be found in the editor documentation.
Yes, the full Mappy V1.0 and an earlier version of MappyWin32 source is available at the site.