Finally, after reinstalling Windows 6 times in about 3 months, Kung-Fu Coders(tm) presents
TileMaster 2D Map Editor prototype
by Andrew Partington (a.partington@yaroze41.freeserve.co.uk)
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 ;)
TileMaster was coded using Java 1.1.6, which features a JIT compiler for faster execution speed. Although TileMaster will run under older versions of Java without the JIT compiler, it will be pretty slow. I don't know what will happen under Java 1.2, which has a new windowing toolkit. You have been warned!
To run the program, type java MapEditor 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 utility was designed for use with the Sony Net Yaroze development kit (specifically, the GsMAP/GsBG/GsCELL handlers in the Yaroze libraries). However, the output format is pretty general (a 2D array of unsigned shorts in C format), so you may be able to bend your map routine/generated map data to suit.
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 luvverly graphics that make up the building blocks of your map. You should use your art package or graphics converter to save the graphics as multiples of 8,16 or 32 blocks wide and high. If you want a template, look at the file default.gif to get the basic idea.NOTE! So long as the width and height of the map graphics is a mutiple of of 8, 16, or 32 pixels, the map data can be any size you like. Avoid weird sizes, or pictures that contain other stuff than what you want to use as your map blocks, 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 -> Set sizeTo set the size of the map, choose this option. Enter the number of blocks horizontally and vertically, click OK and the Main Window will be resized accordingly.WARNING!! Setting a new number of blocks will cause the data already on the map window to be lost! So make sure that you set the map size BEFORE doing any editing!!
Map -> Tile sizeTo use bigger or smaller tiles to build up the map, select this option. Currently there are only 3 sizes: 8*8, 16*16 and 32*32. The tiles in the Tile Window are not affected.NOTE: Yaroze GsBG format map data only allows 16*16 blocks (the default setting). So don't change unless you have reason to!
WARNING!! Don't mix tiles of different sizes on the same map! It just won't work!
Map -> Map formatNot implemented yet. You're stuck with PSX GsBG format for now. Eventually, i'll do a map format which writes out an array of GsSPRITE objects with the mx and my coordinates adjusted appropriately.
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.
4: Final thoughts
Remember, this is a prototype, and is bound to be a bit rough around the edges. It does the job, and that's all i'm bothered about. I'm not releasing the source yet, there should be no need to recompile it anyway, but I might once i've got a decent job. New features will be added as and when I need them. At the moment, this util does what I need it to do, so i'll try using it for a bit and see what happens. 2D Sprite based maps are pretty high on the agenda....Any useful feedback would be appreciated!