2D Tile Editors

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
BlackAura
DC Developer
DC Developer
Posts: 9951
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

2D Tile Editors

Post by BlackAura »

I've been looking into these recently, and so far I've not been able to find any that don't suck. Basically, I'm looking for something that could be used on multiple platforms (the most restrictive of which are the DS, and the Dreamcast), supports colour palettes, multiple layers, and can be used as an actual game editor, rather than a simple map editor. For example, having the ability to insert objects into the map, set up different terrain types or collision masks, and so on.

The most obvious ones I've found are Mappy, Tiled, and Tile Studio, but I really don't like any of them much. They're all far too clumsy to actually use for any real game.

The basic problem I have with those editors is that they're far too generic. They're completely unaware of the limitations of the platforms you're targetting (particularly in regard to things like colour palettes, which are important for a DS game), they're completely unaware of game you're building, and they usually only provide two primitives to work with - a tile map, and an extremely basic object system (only in Tiled as far as I can tell). There's no way to tell the editor anything at all about your game. You end up resorting to using specially numbered tiles on a special layer to implement collision masks, different specially numbered tiles on a different special layer to represent regions (triggers, death areas, water, ice, whatever), and some other crazy mechanism to represent objects. At best (in Tiled) you end up having to build each object, including size, ID, graphics, and any other properties, by hand. I wouldn't have a clue about how to put objects in a map using Mappy.

So, two questions.

1 - Am I missing something blatantly obvious with the existing editors, that would allow them to be used for an actual game?
2 - Does anyone know of any other editors that might actually be usable?

Failing all that, I might have to go with my initial impulse - writing my own.
User avatar
BB Hood
DC Developer
DC Developer
Posts: 189
Joined: Fri Mar 30, 2007 12:09 am
Has thanked: 41 times
Been thanked: 10 times

Re: 2D Tile Editors

Post by BB Hood »

Can you explain what you mean by objects?

Collisions can be done in different ways with Mappy. Here is a thread from the tile map forum to give you ideas.

There is a pretty good tutorial for Mappy at the bottom of this page. Click on "Mappy Tutorial 1". This might help explain different ways to work with objects.

I agree that Mappy is completely unaware of the game you're building but it looks flexible to me from what I have seen.

"Mappy has been used to create many retail (commercial) games, some of which you might have played. I personally know of several developers who have used Mappy to create levels for retail games for Pocket PC, Game Boy Advance, Nokia N-Gage, and wireless (cell phones). MonkeyStone's Hyperspace Delivery Boy for Pocket PC and Game Boy Advance is one example" - Jonathan S. Harbour (Game Programming All-in-One). Here is a review for the game mentioned which includes pictures.

I personally don't know about the other map editors. I only worked with Mappy to learn about the PVR and graphics...

What type of game are you trying to build?

Wo0t - Post 100 :P
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: 2D Tile Editors

Post by BlueCrab »

I wrote a tilemap editor that at least supports a bit more in the collision side of things, but its in a bit of a sorry state right now. I can try to dig up the source code (I know its on this computer, I've just got to find it), if you'd like to take a look at it. You're welcome to work with it, improve it, etc.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: 2D Tile Editors

Post by BlackAura »

Can you explain what you mean by objects?
Ever tried, for example, a Quake level editor?

Basically, you can place down markers that tell the game where to create various in-game objects. The player's start location is an obvious one. Enemies, collectible items, hazards, doors, moving platforms. They don't even have to be visible - Quake uses invisible objects to describe the path of moving platforms, for example.

Tiled has something like this - you can create an object layer, and place objects on it. The objects have a name, and a size, and can have a list of named properties. The catch is that there's no way to provide it with a list of objects or properties, so you have to manually type them in each time. In Mappy, the common way seems to be to use a special object layer, and have tiles represent the objects. Which is a pain in the neck to set up.
I agree that Mappy is completely unaware of the game you're building but it looks flexible to me from what I have seen.
The flexibility isn't so much the problem. Yes, you could create a layer to use as a collision layer, and use the last few tiles (with special graphics) to mark the shape of the level. You could also use an object layer to represent object start locations. That'd get you a usable editor, even if it is a bit hacky.

The problem is that, for each level, you have to set that up again. You have to make sure you're set the layer up correctly, that you've set the tiles up correctly, that you're using the right tiles, that the tiles match up with whatever they're supposed to be doing, and that you're using them correctly.

None of this is terribly hard to do as a programmer. I can probably come up with some way to represent almost everything I want to do in Mappy, and keep it all in my head while editing a level, and be able to fix it if I do something wrong. It is, however, time consuming, and requires me to concentrate on something other than the task of building a level. If I gave a copy of Mappy to somebody else (an artist, or an actual level designer, for example) and asked them to build a level, they wouldn't be able to, no matter how much instruction I gave them.
What type of game are you trying to build?
Your basic 2D platform game, essentially.
BlueCrab wrote:I wrote a tilemap editor that at least supports a bit more in the collision side of things, but its in a bit of a sorry state right now. I can try to dig up the source code (I know its on this computer, I've just got to find it), if you'd like to take a look at it. You're welcome to work with it, improve it, etc.
Might be worth a look, if it's not too much trouble.

Edit: Just had a go at doing a basic tilemap renderer using .Net. and Windows.Forms. Ugh. The API for loading images is kind of nice, but actually drawing things on the screen is glacially slow. That means that I'd end up writing huge chunks of the thing using either SDL or OpenGL, and plenty of mucking about with moving data back and forth between them. Well, that's three minus points (slow drawing speed, limited portability, and having to actually use Windows.Forms), and only one plus point (the image API is kind of nice), so sod that. Maybe Qt would work a little better.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: 2D Tile Editors

Post by BlueCrab »

BlackAura wrote:
BlueCrab wrote:I wrote a tilemap editor that at least supports a bit more in the collision side of things, but its in a bit of a sorry state right now. I can try to dig up the source code (I know its on this computer, I've just got to find it), if you'd like to take a look at it. You're welcome to work with it, improve it, etc.
Might be worth a look, if it's not too much trouble.
I haven't had a chance to look yet unfortunately for the code (its been a busy couple of day), but I will try to soon.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: 2D Tile Editors

Post by BlueCrab »

Ok, I've dug up what I think is the last version that I had that worked of my map editor. It uses wxWidgets to compile, as for what version, I'm not positive. The source to the tilemap editor is attached, and my old libcrabclaw should be able to display the maps produced.

libcrabclaw can be had here: https://sourceforge.net/projects/ljsdcd ... 2/download ... That's the latest version of it that I still have, sadly.

I don't know if it'll be of any help, but it is a bit simpler than most map formats, I think, and should be pretty easy to extend.
Attachments
ccmap-0.9.2.tar.bz2
(974.63 KiB) Downloaded 135 times
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: 2D Tile Editors

Post by BlackAura »

Thanks - I'll have a look at it.

From a superficial glance over the code (and not having run it - I'm on my Macbook which doesn't have wxWidgets), it looks a lot like what I'd have written anyway, except using wxWidgets instead of Qt.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: 2D Tile Editors

Post by BlueCrab »

I actually wanted to rewrite it using Qt the next time I actually came around to using the code, so that might still happen, or at least if you're willing to do it, I'll be happy to help. :grin:
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: 2D Tile Editors

Post by BlackAura »

I couldn't get your editor to compile on Linux using anything newer than wxWidgets 2.4. The experience was... "painful", I think, would be a good description. wxWidgets 2.4 on Linux seems to still be using GTK1, looks hideously ugly, and is almost unbearably slow.

I think I may have a go at a simple Qt-based map editor. I have a basic map viewer embedded in a QScrollArea so far, and a couple of dialogs mocked up in Qt Designer. When I get something a little more interesting happening, I'll post it somewhere.

Edit: Would I be correct in assuming that the libcrabclaw version you posted is older than the editor? It looks like the editor supports a few things (texture formats, layers) that the library doesn't.

Just so I've got the model right:

A map consists of tiles, layers, and animations. The map has a width and height, some global tile settings (tile size, texture format, colour key). Each tile contains an image, 12 bytes of userdata (one 32-bit value, two 16-bit values, and four 8-bit values). It also seems to have a 1-bit collision mask. Each animation consists of a delay, and then a list of tile indexes. Each layer is a simple 2D array of tile indexes. Positive numbers are tiles, negative numbers are animations. Layers also have a scroll speed, which I presume is intended for parallax scrolling.

That all sound about right?

What I was going to do is basically similar, with a few main differences:

The map itself doesn't have a size. The map size is determined by the size of the first layer, which is assumed to be the main layer. Layers don't have an explicit scrolling speed. Parallax scrolling is handled by setting a repeat value (number of times the layer repeats, basically - separate values for X and Y), and determining the scrolling speed based off that and the layer size. So a layer that's half the size will scroll at half the speed of the main layer. A layer that's half the size, but repeats four times, will scroll at twice the speed of the main layer.

I think most of the collision stuff is entirely different than what I was planning, but probably not too different. Essentially, I was planning to do collision and tile attributes as a separate layer, so that the attributes weren't tied to the graphics. I was also planning to allow you to set defaults for each graphical tile, which is basically what you've done.

I wasn't planning on using a collision mask either, but thinking about it, it's probably not a bad idea as well.

Ultimately, I think those kinds of differences could be included as part of the game profile. I'm not doing any of that stuff immediately - I think I'm just going to do the basics (loading graphics, splitting them up into tiles, and painting on the map) first, and work out all the fiddly stuff later.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: 2D Tile Editors

Post by BlueCrab »

BlackAura wrote:I couldn't get your editor to compile on Linux using anything newer than wxWidgets 2.4. The experience was... "painful", I think, would be a good description. wxWidgets 2.4 on Linux seems to still be using GTK1, looks hideously ugly, and is almost unbearably slow.
Its not surprising that it needs such an old version to compile. I haven't touched the code since 2005, so I guess it was to be expected. As for the slowness, I never noticed it back then, so that's a bit odd to me.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: 2D Tile Editors

Post by BlackAura »

BlueCrab wrote:Its not surprising that it needs such an old version to compile. I haven't touched the code since 2005, so I guess it was to be expected. As for the slowness, I never noticed it back then, so that's a bit odd to me.
nVidia's drivers, more likely than not. A couple of driver versions ago, just running a GTK1 application was enough to crash the entire X server.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: 2D Tile Editors

Post by BlueCrab »

BlackAura wrote:Edit: Would I be correct in assuming that the libcrabclaw version you posted is older than the editor? It looks like the editor supports a few things (texture formats, layers) that the library doesn't.
Actually, I'm pretty sure its the other way around, the editor is older than the version of the library. The library should support layers just fine (they don't draw by default when you call the draw() function off the class since they might fall into different primitive lists, but drawLayer does them just fine). As for texture formats, that was probably just me being lazy.
Just so I've got the model right:

A map consists of tiles, layers, and animations. The map has a width and height, some global tile settings (tile size, texture format, colour key). Each tile contains an image, 12 bytes of userdata (one 32-bit value, two 16-bit values, and four 8-bit values). It also seems to have a 1-bit collision mask. Each animation consists of a delay, and then a list of tile indexes. Each layer is a simple 2D array of tile indexes. Positive numbers are tiles, negative numbers are animations. Layers also have a scroll speed, which I presume is intended for parallax scrolling.

That all sound about right?
Yup, that all seems about right. I was aiming for simplicity with the format. Later versions (for which I can't find the map editor, but I do have loading code for) did things slightly different (the collision mask was updated to handle 8-types of collision, so you could have, for instance, walking, flying, boat, etc)), but they're all pretty similar.
What I was going to do is basically similar, with a few main differences:

The map itself doesn't have a size. The map size is determined by the size of the first layer, which is assumed to be the main layer. Layers don't have an explicit scrolling speed. Parallax scrolling is handled by setting a repeat value (number of times the layer repeats, basically - separate values for X and Y), and determining the scrolling speed based off that and the layer size. So a layer that's half the size will scroll at half the speed of the main layer. A layer that's half the size, but repeats four times, will scroll at twice the speed of the main layer.
Seems like a pretty good idea.
I think most of the collision stuff is entirely different than what I was planning, but probably not too different. Essentially, I was planning to do collision and tile attributes as a separate layer, so that the attributes weren't tied to the graphics. I was also planning to allow you to set defaults for each graphical tile, which is basically what you've done.

I wasn't planning on using a collision mask either, but thinking about it, it's probably not a bad idea as well.
The funny thing is that I don't think I ever actually used the collision mask in my actual game code. I just used one of the tile-attributes and only did tile-based collision. I was pretty lazy with all this stuff...
Ultimately, I think those kinds of differences could be included as part of the game profile. I'm not doing any of that stuff immediately - I think I'm just going to do the basics (loading graphics, splitting them up into tiles, and painting on the map) first, and work out all the fiddly stuff later.
Well, good luck to you with it all. If there's anything you can use of my code, feel free. I'll try to dig up some other bits of code later, but I can't guarantee much.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: 2D Tile Editors

Post by BlackAura »

The funny thing is that I don't think I ever actually used the collision mask in my actual game code. I just used one of the tile-attributes and only did tile-based collision. I was pretty lazy with all this stuff...
Yeah, sounds about right. Tile-based collision is much simpler to use and edit. The collision mask is still not a bad idea though - I can think of a few uses for it (something like the Sonic games, for example). I might think about adding that one in later.

I'm going to see if I can get the basics of an editor running over the weekend - creating a new map, loading a tileset from a sliced-up image, adding layers, editing the layers. Maybe loading and saving, if I get time.
User avatar
hilltopper06
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 26
Joined: Mon Sep 21, 2009 10:39 pm
Has thanked: 0
Been thanked: 0

Re: 2D Tile Editors

Post by hilltopper06 »

Bumpity Bump Bump Bump! Any update on this. I was liking the sound of a simple 2D engine/editor for DC. Maybe something that consisted of DC libraries that you could add your files to and run your homebrew games on. (Like Fenix but more GUI, less code). Probably just wishful thinking, but I know a lot of us non-coders would love to have a tool to make Dreamcast games (eg. BoR sparked a ton of spinoff games, but that engine kinda limits the genre to beat em ups.) Thanks.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: 2D Tile Editors

Post by BlackAura »

There's nothing much that I'd want to release at the moment. It's also probably a bit too programmer-centric for non-coders to be able to use straight off at the moment.
User avatar
hilltopper06
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 26
Joined: Mon Sep 21, 2009 10:39 pm
Has thanked: 0
Been thanked: 0

Re: 2D Tile Editors

Post by hilltopper06 »

Sure thing. I wasn't expecting any grandiose release this early in the development process. I was just curious if that was were this project was eventually heading, or if your engine was going to be more for private use. Thanks again.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: 2D Tile Editors

Post by BlackAura »

I did want to do a release of some kind, yes.

The general idea was to have a fairly simple, cross-platform 2D game engine. The game parts are then written in a scripting language, most likely Lua, using a component system. The engine comes with a set of components, but you can write new ones (and share them if you want). Assuming I can build a decent UI, it'd be possible to build new types of object in the game by combining components. The same thing applies to the game itself - you could have one set of components that allows you to build a platform game, and another that allow you to build a shmup.

There would still be code to write. However, there wouldn't be nearly as much of it as there is in a Fenix game. It should be possible to provide a GUI for all of this, but I've not really given that much thought.

Before all that, of course, we need the basic tools, and the basic game engine. Still working on those, on and off.

I do have a couple of specific games in mind for this thing, so whatever I build will probably be pretty biased towards a 2D platformer / shooter.
User avatar
hilltopper06
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 26
Joined: Mon Sep 21, 2009 10:39 pm
Has thanked: 0
Been thanked: 0

Re: 2D Tile Editors

Post by hilltopper06 »

Thanks for the update. It sounds really great. I have been searching for a good tool/way to make a game for DC and so far I had really only found BoR and Fenix. BoR kinda limits your game type and Fenix is a little buggy from what I can tell. Anyway, thanks again for the update. I do not know if this would help you or not but what you are looking to do sounds a lot like Verge 3.

http://verge-rpg.com/

I have not been able to find the source code on the site, but it looks like someone made a GP2X port so the source may be available on request.

http://gp2x-emulation.dcemu.co.uk/appli ... 22591.html

Just might be something to look into and possibly glean ideas from along the way. It would be cool if at some point someone could post Verge 3 to DC as it would give us users a huge new library of games, but that is a post for the Development Ideas forum.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: 2D Tile Editors

Post by BlackAura »

Hmm... I'd never heard of that one. Neat.
Post Reply