2D Map editor

This is a 2D tile based map editor with three levels for overlapping objects. It also has a colour adjust feature to play with the overall Hue, Saturation, and individual red, green, and blue colour channels of the entire scene. The change is cached, so adjusting the colour should have no impact on performance of the map.

Maps are resizeable and can be moved around as well.

All source is included. There is some source in there for things like ‘sprites’ and ‘players’ and a ‘game’, but it’s not working yet.

http://juddman.googlepages.com/

The colorization of the scene looks really nice, especially the night-time :slight_smile:

Hi Juddman,

This editor looks really good - and I really like the sprites you’re using- they’re nice and bright and happy. I was actually just surfing the net trying to find a tilemap editor and tried out a few but they looked so terrible - the sprites they used were pixelated, dated and dark, they weren’t open source and they only wanted to save stuff in their own custom XML format and make you load that up somehow - yuk. I was just about to slip into a depression until I saw this, so thanks for posting it and opening up the source!

The GUI is very clean and crisp by the way (probably the first Swing app using metal LnF that I think looks good). And the hue settings look very useful for changing the mood of the level/map.

I’m looking through the source now. What are your future plans with this editor and your game?

Great job 8)
Keith

I was looking for an editor like this, it looks excellent.

Keep up the good work!

Currently working on a set of tiles for a riverbank

I was seriously considering changing the map format to use XML for a while. :slight_smile:

It has been sitting in my computer for a few years actually, only recently i added the ability to shift tiles and resize the scene. That was a burst of spare time and interest that i rarely have for it, so i don’t have any plans as such. I do want to make a game of some sort, probably an RPG, eventually… but it won’t happen anytime soon

The scenery i did with Macromedia Fireworks, pretty basic stuff. i didn’t care about colour pallettes and pixels too much, i just drew a nice area of texture that looked ok and then chopped it up into a grid. (i cheated a bit: if you turn the colour saturation all the way down to greyscale, you can’t tell the grass apart from the dirt)

a friend of mine made this sprite sheet for me and said it was ok to give it out as well:
Fri Feb 15 2008 Christopher James Doman:

Hey Juddman, I have been trying to do something like this as well. I love the screenshots, but that’s all I got. I downloaded the most recent edition. I tried compiling it in Netbeans and it wouldnt let me. It did compile in BlueJ (Yes I am a noob), but then threw a bunch of exceptions when I tried to run the jar file. Same thing happens when I try and open it from the desktop, only without as specific error info. I’d love to use and customize this app but until I can open it all is lost.

new-host:~XXXXXXXX$ java -jar MapEdit.jar
grass dirt
5 0 tiles/gd1.gif
6 0 tiles/gd2.gif
7 0 tiles/gd3.gif
8 0 tiles/gd4.gif
9 0 tiles/gd5.gif
Exception in thread "main" java.lang.NullPointerException
	at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
	at GraphicsBank.<init>(GraphicsBank.java:68)
	at Scene.loadScene(Scene.java:81)
	at MapEdit.<init>(MapEdit.java:42)
	at MapEdit.main(MapEdit.java:539)

I don’t think It matters but Im running Mac OS X 10.5.2

It was a file name in uppercase. (tiles/GD5.gif) I fixed it in this version.
Didn’t notice it because the windows filesystem is case insensitive, and that’s what i use.

Other than that it looks like you compiled and ran it fine. I don’t use netbeans myself, i just use the command line, you can build and run it by browsing to the directory of the .java files and typing:

javac *.java
java MapEdit

on either linux or windows.

New version. Actually, just some new tiles - a riverbank. For the map shown below, open bigScene.dat in the editor

Those look great, thanks. Artistic and programming abilities are pretty rare.

I’m trying to make a diablo-style rpg now.

Phew!

Thanks,
Keith

Currently working on some larger trees and tree stumps.
Next coding task i think is to add a tileset editor so that the ‘outdoors.dat’ etc. files don’t need to be edited by hand to add new tiles to the list.
and after that, try to add some smart painting so the user just selects the base tile and the edging is done for them

Thanks again for sharing this JuddMan. I did indeed get it open but now I have an entirely different question that may need to be moved to a different thread but here goes. I see that the scenes are saved as .dat files but how does one parse or load a .dat file in Java? I mean I understand XMl maps, but I have no clue what a .dat file even looks like in the raw. How do you plan on displaying/loading the .dat file into your game?

All files this editor saves are in plain text. (the file extension means nothing, you can use whatever you want. i have used .bak for some older maps for instance)

To read them try Notepad.

got Linux? try Emacs, pico, nano, cat, more, less, kate, vi, or vim.

This is not production quality stuff, so what you see there a simple series of numbers.
There is currently no game, no sprites, no logic, just an array of numbers representing one of the tiles listed in outdoors.dat

Let’s take a look at bigscene.dat:

100 100 outdoors.dat
colorization 1.0 1.0 1.0 0.0 1.0
.
26 16 14 14 14 14 20 26 4 10 6 4 26 2 .......

100 100 = width height
outdoors.dat = file describing the tileset
colorization r g b h s= red-multiplier, green-multiplier, blue-multiplier, hue-adjustment (0 - 1 being a full hue cycle), saturation-multiplier

26 16 14 14… = Tile ID’s. should be ordered on the map from left to right, top to bottom, layer 1 to layer 3.

Let’s look at the outdoors.dat file:


Tiles{
26 0 grass
tiles/grass.gif
0 0 null(Erase)
tiles/null.gif
1 0 dirt
tiles/dirt.gif
2 0 flower
tiles/flowr.gif
...
}

Edges{
grass dirt{
5 0 tiles/gd1.gif
6 0 tiles/gd2.gif
...
}

Looking at the second line:
26 = Tile ID (what you see for grass in the map file)
0 = can walk on it in any direction
grass = descriptive name to put on the tooltip.
tiles/grass.gif = the image file.

The edges are not really implemented properly yet, and for instance the river tileset has all of its edges just dumped in tiles. it makes no difference. but anyway:

grass dirt { = names of the two base types these are edges between. Map editor will name the tiles specified within the block ‘grass dirt 0’ ‘grass dirt 1’… and so on…
5 0 tiles/gd1.gif = tile ID “5”, walkable, image file is “tiles/gd1.gif”

This was all thrown together as it was made, and probably needs to be thought out and re-done. Maybe in XML ;D

Ahh… I see. I did know that there was no game architecture, just a map, but I was wondering how you would load it in the long run. I suppose that you’d just do it the same way you load it here, so I can just take a peek at the source myself, though after seeing you explain what the file has in it (and looking myself) I can pretty much guess. Thanks again, this is a wonderful project that I’ll definitely be using and probably tweaking.

[quote]This was all thrown together as it was made, and probably needs to be thought out and re-done. Maybe in XML
[/quote]
I do like the possibility of using XML for something like this, but as for being thrown together, Rome wasn’t built in a day… and a lot of it was torn down to make way for better.

XML is not particularly quick to parse. Not really a problem till you hit a few megs of data in one file.

But it does have well thought out formatting rules which are something to follow and probably better remember how it all fits together four months down the track, rather than turning your files into token soup like mine :slight_smile: (eg. in outdoors.dat, there is a whole ton of random text before the first Tiles{ block that looks like it is important but is actually ignored completely

i don’t expect this to become rome.

really good job on the tile map editor. Im now using it to manage my tile maps, for my game. instead of manually typing out the tile number, im using your tilemap program to do it. I had to tweek the code a bit.

its now something like this.
base layer sets up the Tile (instead of 32 size its 32*6) only can use tiles of type 0 on base layer
layer 1 manages the entity positions. (collision entities trees, rocks). can only use tiles types > 0
layer 2 mangages the particle positions, constant non collision effects. can only use tiles types > 0

dude this is sooo neet.

Glad you’re finding it useful :slight_smile:

One day i may start an actual game too… one day… perhaps.
But at least i’ll have a map maker handy!

On another note, there’s a new version - 0.8

You can now zoom in and out.

Actually this feature just sort of happened. i hadn’t planned it. i was bored and looking through the code. It’s probably done incredibly inefficiently.

http://juddman.googlepages.com/zoomzoom.gif

You can still edit the map at any zoom level. It’s handy to zoom right out to see what your map looks like overall, or to do rough planning of the layout of large areas. Zooming in is maybe not so useful, but if you have an ultra-high resolution monitor, or are working with small tiles, it could be handy.

Now it needs a flood-fill tool.

screenshots & download: http://juddman.googlepages.com/

I am also now just uploading the JAR file rather than a zip. A jar is a zip, but you can double click it to run it. (unless WinRar stole the file association >:() If you unzip the JAR, and then run ‘make.bat’, it will recompile a new JAR from the source. (handy if you want to compile against an older JDK).

Edit: added this thingy to tileset:

New version - 0.9

Added flood fill

Added the missing night time scene to the scenes pack.

RGB, hue and saturation sliders now move to the correct values when a scene is loaded

Now has two toolbars (toolbar was getting too wide). I think the buttons are too big, and may make them smaller.
Unfortunately i haven’t found out how to do them properly so although you can dock a toolbar to any edge of the window, you can’t put them side by side on the same row. If anyone knows how to do that, please let me know.

Zoom icons are now yellow. easier to see:

Todo:
eliminate use of anonymous inner classes (makes an ugly mess of Blah$13.class files)
tileset manager
automatic edging

Hi JuddMan,

Thanks for putting effort into this. I’ve made an editor once before, but
yours is much better. I like especially the layered technique.

I have one request: Undo button

Best regards from

M.E.

It shouldn’t be too hard.

i’ll put that in next time i’m working on it.

I agree, this editor is great

if your taking suggestions :smiley:

some of the additions iv made that might be handy to most users.

when increasing the tile map, maybe set the new tile to be either the same as the tile connected to it, or my way of setting the new tile as the “theme” of the scene. (grass, dirt…)
also when i click on new, i set up a input dialog, to ask for the new scene size x*y.

once again juddman brilliant work. love the zoom :smiley:

Zooming and flood fill make using this much easier, thanks.

By the way, I found heaps of free graphics here: http://reinerstileset.4players.de/ (especially check out the terrain graphics here http://reinerstileset.4players.de/environmentE.html. He also does very nice trees http://reinerstileset.4players.de/animatedE.html)

Your tile sets are great so I’ll use them, just thought you might want to know about all the free content which could be used.

This tile map editor rocks, great work 8)