Simple Tile Map Editor

Latest build : 1.1.0.20 Tuesday, October 7, 2008 3:58:20 PM
- Jump to Downloads

The Simple Tile Map Editor let's you design your tile maps visually and save them as small binary files that you can use in your MIDP game projects. That's all it does...

I made this application for my own use but I figured it might be useful to someone else. Here, have a screenshot:


Click to Enlarge - kinda reminds me of all the email spam I'm getting XD heh


Choosing a tile from the Tile Panel
The Tile Panel on the right side of the window let's you pick a tile from the tileset image you loaded. You can assign a tile to the left mouse button and the right mouse button by using either to pick a tile from the Tile Panel. An enlarged preview of the selected tiles will be displayed at the bottom part of the Tile Panel.


Tools and Basic Usage
Selection Tool:
Let's you select a group of tiles for use in Selection Mode.

Pen Tool:
Let's you draw a single tile.

Fill Tool:
Fills an area with the tile assigned to either the left or right mouse button.

Single Tile Mode - Same effect as the Pen Tool.
Selection Mode - Affects only the area inside or outside the selection rectangle, depending on which part of the map you clicked on.
Full Map Mode - Affects the entire map.

Replacer Tool:
Replaces the tile you clicked on with the tile assigned to the left or right mouse button.

Single Tile Mode - Same effect as the Pen Tool.
Selection Mode - Affects only the area inside or outside the selection rectangle, depending on which part of the map you clicked on.
Full Map Mode - Affects the entire map.

Toggle Grid:
Displays a grid on the map so you can see what tiles you're actually clicking on.

View Data:
Displays the map data (including block map data) of the currently open map as comma delimited byte values in a new tab window. Useful for embedding the map data in your source code.

WORD Resolution Map Width and Height:
The "Use WORD values for map dimensions" checkbox allows you to define map sizes larger than 256x256. You can find it in the "Map Dimensions Dialog" whenever you create a new map.

Map Dimensions Dialog
Map Dimensions Dialog



Block Map Mode:
Allows you to assign extra byte data to each map tile. Useful for defining look-up tables and optimizing code. Block map data is saved in a separate file with a ".BMD" extension.

Resize Map:
Allows you to resize the currently open map.

Crop Map to Selection:
Allows you to crop (or resize) the map leaving only the currently selected tiles. You must have the Selection Tool checked to enable this option.

Zoom In/Out:
Allows you to magnify the map rendered on the screen for easier editing specially when working with small tile sizes. The magnification values are in fixed increments:
25%, 50%, 75%, 100%, 150%, 200%, 300%, 400%, 800%.

Grid Color - New:
Allows you to change the maps grid color.

Toggle Tileset Index Numbers - New:
Allows you to hide or show the index numbers of the tiles in the tileset panel.


The Simple Map File Information
The map editor uses ".SMP" as the default extension. One important thing to remember is that the editor uses the byte data type for all map data. This means that the value of any data in the map has a range of 0 to 255. This limits you to the following maximum values:

map width - 255
map height - 255
tile width - 255
tile height - 255
number of tiles - 255

Note: tile index 0 should be a blank tile

I just thought I should let you know even though I doubt you'll be hitting the max values in your map if your just using it for MIDP games.

SMP File Structure:

Field Bytes Description
--------------------------------------------------------
Descriptor** 7 nothing really just skip this
Usually contains the string:
"STME1.0"

UseWord 1 an ASCII character that
determines if the map width and
map height is in BYTE or WORD
values. "B" for BYTE and "W"
for WORD.

MapWidth 1 the map width or number of
tile columns.
(2 bytes if you choose WORD
values)

MapHeight 1 the map height or number of
tile rows
(2 bytes if you choose WORD
values)

TileWidth 1 the width of a tile in pixels

TileHeight 1 the height of a tile in pixels

MapData X the actual map data. Read from
top to bottom, left to right.
Multiply the MapWidth and the
MapHeight to get actual length
of the data in bytes.
--------------------------------------------------------
**Note:
Starting from build 1.1.0.14, the descriptor has been
changed to "STME1.0".

Your program can determine if it should read WORD values
or BYTE values for the map width and map height by first
checking the 8th byte. It should contain the ASCII
character "B" for Byte and "W" for Word.

Ex:
Descriptor
STME1.0B - read map width and map height as
byte values
STME1.0W - read map width and map height as
word values

The rest of the map data including tile width and tile
height are still in bytes.

The map editor itself only checks for the "W" character
so it will still work on maps created with previous
versions of the map editor.

You can still open the old maps that have integer map
dimensions (4 bytes) created with version 1.1.0.14 but
the map will be saved with the map width and map height
as WORD values (2 bytes) instead.


**BMD File Structure:

Field Bytes Description
--------------------------------------------------------
BlockMapData X Block map data. Read from
top to bottom, left to right.
Multiply the MapWidth and the
MapHeight from the SMP file to
get the actual length of the
data in bytes.
--------------------------------------------------------
**Note:
The BMD file and Block Map Mode functions are available
starting with version 1.1.0.16 of STME.


Here's a sample method that shows how to read an SMP file:


/* required libraries - start
place this before your class declaration

import java.io.DataInputStream;
import java.io.InputStream;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.TiledLayer;

required libraries - end
*/

public TiledLayer getMap(String fpath, Image ftiles){
TiledLayer tMap = null;
try {
// open the file
InputStream is = this.getClass().getResourceAsStream(fpath);
DataInputStream ds = new DataInputStream(is);
try {
// skip the descriptor
ds.skipBytes(8);

// read map width
int mW = ds.readByte();

// read map height
int mH = ds.readByte();

// read tile width
int tW = ds.readByte();

// read tile height
int tH = ds.readByte();

// create a new tiled layer
tMap = new TiledLayer(mW, mH, ftiles, tW, tH);

// loop through the map data
for (int rCtr = 0; rCtr < mH; rCtr++){
for (int cCtr = 0; cCtr < mW; cCtr++){
// read a tile index
byte nB = ds.readByte();

// if tile index is non-zero
// tile index 0 is usually a blank tile
if (nB > 0) {
// assign (tile index + 1) to the current cell
// TiledLayer objects start tile index at 1
// instead of 0
tMap.setCell(cCtr, rCtr, nB + 1);
}
}
}

} catch (Exception ex) {
tMap = null;
System.err.println("map loading error : " + ex.getMessage());
}
// close the file
ds.close();
ds = null;
is = null;
} catch (Exception ex) {
tMap = null;
System.err.println("map loading error : " + ex.getMessage());
}

// return the newly created map or null if loading failed
return tMap;
}


The getMap() method reads the map file and returns a new TiledLayer object based on the contents of the map file. It has 2 parameters:
  • String fpath - the path to the map file
  • Image ftiles - the tileset image

You probably noticed that we're adding 1 to the actual value loaded from the map file. This is because the map editor counts the tiles starting at 0 while the TiledLayer class starts at 1. Hence, the tile data in the map file must be offset by 1 before being assigned to the TiledLayer.


Supported Image Formats
The Simple Tile Map Editor uses the GraphicsEx library written by Mike Lischke so I guess it supports the same image formats. You can head over to the new website for more information : Soft-Gems GraphicsEx page.



Download Build 1.1.0.20

10/07/2008
SimpleTileMapEditor1.1.0.20.zip
(470 KB) - Download it.
(Win32 binary)
MD5 : c2b8e14e95ab76bccbd8aec50a96839e
*SimpleTileMapEditor.exe
You can find a small list of changes here : List of Changes


Older Versions
02/17/2008
SimpleTileMapEditor1.1.0.19.zip
(468.06 KB) - Download it.
(Win32 binary)
MD5 : fc1984afb0f004301df2af087f1419f9
*SimpleTileMapEditor.exe
You can find a small list of changes here : List of Changes

02/17/2008
SimpleTileMapEditor1.1.0.19.zip
(468.06 KB) - Download it.
(Win32 binary)
MD5 : fc1984afb0f004301df2af087f1419f9
*SimpleTileMapEditor.exe
You can find a small list of changes here : List of Changes

02/06/2008
SimpleTileMapEditor1.1.0.17.zip
(471.57 KB) - Download it.
(Win32 binary)
MD5 : 4bb894f057faa9617704ffd24063a498
*SimpleTileMapEditor.exe
You can find a small list of changes here : List of Changes

02/03/2008
SimpleTileMapEditor1.1.0.16.zip
(470.94 KB) - Download it.
(Win32 binary)
MD5 : e4ec440c7814be5bef5bd25b0b52ad59
*SimpleTileMapEditor.exe
You can find a small list of changes here : List of Changes

01/25/2008
SimpleTileMapEditor1.1.0.15.zip
(538.38 KB) - Download it.
(Still Windows binaries only)
MD5 : d779a5c733d59c4c95d173c5ac38fc0f
*SimpleTileMapEditor.exe
You can find a small list of changes here : List of Changes

01/24/2008
SimpleTileMapEditor1.1.0.14.zip
(539.88 KB) - Download it.
(Still Win32 only XD)
MD5 : de2cb119d08090eca02103d331676b9b
*SimpleTileMapEditor.exe
You can find a small list of changes here : List of Changes

Initial Release
SimpleTileMapEditor.zip
(528.2 KB) - Download it.
(Win32 binaries only. Sorry guys.)
MD5 : 2173abf6f33c8cd96711df63fe820f74
*SimpleTileMapEditor.zip


Installation
No need to install. Just extract to your favorite folder, double click on the executable and your in business.

I will try to update this as much as time allows. In the meantime, if you have some questions or suggestions, don't hesitate to leave a comment.

9 comments   |   post a comment
said...
The Simple Tile Map Editor is fantastic. I was looking for something to use in a C++ SDL project and this is perfect. All the other map solutions I found online exported to complicated formats or XML and the overhead of making those play nice with my existing library was less than optimal. With the STME I was able to have a class up and running in 20 minutes that could render maps beautifully.

I commend you for your work as the program works as advertised and provides a great experience. I have a small request though, if you could release the source or produce a version that allows more than a 256x256 map that would be excellent. I understand that it was meant for mobile platform gaming but it is a great all around utility.

Placing a flag in the first 8 bytes to say whether or not the map is extended (using 2 bytes for map width and height) would probably work well as it wouldn't effect current .smp files. I think a 256 tile limit is fine though.
said...
how can i load a tileset?
whenever i try to, i can just load one image which even overwrites the image i loaded before ...
help!
said...
hi, semper_ferox,

done! :) cheers and thanx!
said...
Hi, blabbo,

If you want to load a different tileset for a new tile map...hit the new map button :).

Loading a tileset to an open map replaces the tileset used by that map within the editor (doesn't really overwrite anything). That way you can test different tilesets on the same map.
said...
Hi,
I'd like to use a tile map as small as 6x6 tiles, but the editor won't let me enter numbers smaller than 8 :) Would you please withdraw this limitation? The editor is great otherwise!
Thanks
nke
said...
Also, if I reload another tileset with a different tilesize, it crashes ... :) I think it would be great to just change the pixel width of tiles on the fly without having to create a new map!
Cheers!
said...
@semper_ferox
"WORD Resolution Map Width and Height:
The "Use WORD values for map dimensions" checkbox allows you to define map sizes larger than 256x256. You can find it in the "Map Dimensions Dialog" whenever you create a new map."
said...
This is very good editor. I recomended that! =)