by Andy Partington (a.partington@yaroze41.freeserve.co.uk)TileMaster 2D Map Editor 0.2
Like the title says, TileMaster is a utility to help design level maps for 2D games. For those of us who have tried knocking their own games together, you know how tedious typing out your map data by hand is. This map editor lets you see what the level map will look like before you use it in your game, and lets you design levels far easier than the old graph paper and patience method!Because TileMaster is written in Java, it will run on any machine which can handle the Java environment. It'll come in handy when deciding to move over to more stable operating systems ;)
Major changes since the last version (prototype):
Removed tile size restrictions - now your tiles can have almost any width and height (except zero). Removed GsSPRITE and GsMAP format options - This kind of thing is probably best left to your game engine. Added filename filtering when loading graphics - now you can only see the supported graphics formats. Added double buffering to the canvas in the main window - you can now hide the window and it'll repaint correctly when redisplayed. Fixed hideously slow map data loading. Resizing the map is no longer destructive.
To run the program, type java MapEditor (or jre MapEditor if you're using the runtime environment) and press return. Assuming you've installed Java correctly, with the correct classpath, then the program will start running. Java is case-sensitive, so type it just like it is above.
This is the main editing area for the map. It is also the window which allows you to control the various functions of the map editor.Menu funtions
File -> Load -> Tile GraphicsThis option lets you load in your graphics that make up the building blocks of your map. They should be arranged in a similar way to the file default.gif.NOTE! The tiles can be any size you like, not just 16*16 as in the above example. However, avoid pictures that contain other stuff than what you want to use as your map blocks (unless your game code supports it!), because the map editor will work out things wrongly, and your map will look proper bent when you come to use it in your game. Just crop an area which holds the exact area of your blocks, and save it out as a .GIF or .JPEG file.
File -> Load -> Level MapLets you load a level map that you have been working on. Make sure that the tiles that you used for drawing the map are loaded beforehand, or else your map will be displayed rather strangely indeed! On the other hand, this is good for when you want to try out different tile sets using the same map data!This option won't work with exported C data, so don't even try it!!
File -> Export map dataSaves the map data in C format. The file produced contains a 2D array of unsigned shorts, the name of which is the filename (minus extension). You can save it with a .h extension, and #include it at the top of your program.0xffff represents a blank block, while numbers 0-0xfffe represents each map block. This format should be general enough to be used with other routines besides what the Net Yaroze BG handler expects, with a bit of persuasion.
File -> Save mapLets you get some shut-eye on those late-night games designing seshes!!Well, you might be able to use this data in your programs too! The first 32 bytes of the file are taken up by two short values (16-bit Java format). These are the number of blocks across and the number of blocks down. The rest of the data is also in short format. Again, you could probably batter this map data format into something your routines can use.
NOTE: The file sizes of the map format are a bit sinister - they don't seem to correspond to what they should do. e.g. if you have a map size of 20*16, the data should be 640 bytes, plus 4 bytes for the header = 644 bytes. Instead, it ends up slightly larger than it should be (653 bytes). Other sizes are similarly too large. So whether or not there is some crap being written in there or not, I dunno, so if you want to play it safe, just export the map as a C file.
File -> ExitShuts down the program and quits the scene!
Map -> Resize mapTo resize the map, choose this option. Enter the number of blocks horizontally and vertically, click OK and the Main Window will be resized accordingly.WARNING!! If you want to make the map smaller than the current size, you may lose part of the map data. In this instance, as much data as possible is preserved, starting from the top left hand corner of the map.
Map -> Set tile sizeTo use bigger or smaller tiles to build up the map, select this option. A dialogue box will appear asking you for the width and height of a tile. This only affects the area that gets chosen inside the tile window; the actual tiles themselves are not affected.NOTE (GsBG users only): Yaroze GsBG format map data only allows 16*16 tiles (the default setting). This is something to keep in mind when building your maps. Say if you use 8*8 tiles to build a GsBG map, it may look fine in TileMaster, but will be displayed very differently when you come to use it!
WARNING!! Don't mix tiles of different sizes on the same map! It isn't supported (and may never be!)
Map -> Create new mapHmm, that's a tricky one... ;)
Help -> AboutNo help here, but a bit of info telling you where you can find some!
The tile window is the area which contains the graphics for the map blocks. To select a map block, just click on the block. You can then click or drag the mouse in the main window to place the block.
Placing a block
Firstly, you must select a block, as described in the description of the tile window. To place a block, click the mouse button in the main window. You can drag the mouse in order to draw the blocks in freehand.Removing a block
To remove a block from the Main Window, hold down CTRL while clicking/dragging the mouse in the main window. I would have preferred to use the right mouse button for this, but this would have meant that Mac owners couldn't delete blocks :)
4: Final thoughts
Well, the second version is upon us, and its looking a bit more stable for the most part! It works nicely on my machine at work, and more-or-less adequately on a P133. Unfortunately, adding double buffering has crippled it in terms of speed for P120 users (I originally developed this on a P133, but i'm making changes on an old P120 laptop I rescued from an I.T. clearout at work). People who have slower machines may have to make do with the prototype for now... :(Many thanks go to Philippe Lorin (Pal) for his suggestions for improvements/encouragement, without which I would probably have left TileMaster gathering dust!
I'm still open to any feedback! Email me at a.partington@yaroze41.freeserve.co.uk