Using Tiled as a map editor

A place for your artistic side. Discuss techniques and tools for pixel art on the NES, GBC, or similar platforms.

Moderator: Moderators

Post Reply
rox_midge
Posts: 91
Joined: Mon Sep 19, 2005 11:51 am

Using Tiled as a map editor

Post by rox_midge »

gauauu wrote: Thu Jan 23, 2020 4:49 pm I can't speak for this project, but I'm someone who uses and loves Tiled, and would be happy to talk about strategies for making it work for NES with metatiles and palettes. If so, we should branch that out into a different thread.
I'd like to hear more about this, so I thought I'd go ahead and create the thread that gauauu mentioned in this thread!

My project is (tentatively) using 8x8 tile chunks for its map, so having the ability to organize them in something like Tiled would make things a lot simpler.
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: Using Tiled as a map editor

Post by gauauu »

First, the main thing to keep in mind is that Tiled's goal is to let you assemble your map tiles into a bigger map. So things outside of this (generating metatiles, palettes etc) are a bit beyond the scope of the core of what Tiled is good for. That said, there are still useful ways of handling these things.

In a couple of my projects, what I've done is create my metatiles outside of Tiled. I've built a really janky tool for doing so, but it lets me define 4x4 metatiles, and associate palette and collision data for each metatile. So for these games, each metatile has palette/attribute information baked in. You can't apply different palettes to the same metatile. My janky tool then spits out a new image of my new "meta-tileset" -- an image that's only used in Tiled for helping me draw maps.

I then draw the maps in Tiled. My build script then reads the Tiled files and turns the map data into data for my rom. So it's stored in rom by metatile ids that Tiled uses. The build script also processes my metatile defintions, so they're available in the rom data. At rendering, it reads a metatile id, then looks up the actual tile definitions for it. Palettes/Attributes are easy, because I'm using 4x4 metatiles, so I just look up the attribute byte in my metatile definition. For collision checks, I read the metatile id, then look up the collision data for it.

If you want to read more about this, I explain it a little more at https://anguna-dev.blogspot.com/2019/10 ... eline.html

That all said, since I started this, Tiled has now added some simple support for metatiles in the application itself. I haven't used them, so take this with a grain of salt, but you can create a metatile set by creating a new map, and just drawing tiles into it in groups, arranged into your logical metatiles. Then, when you start creating your "real" map, you can load that first map as the tileset (instead of loading an image as a tileset). When loading it, you can specify the tile size, and then you can draw with those metatiles. In this case, the big question becomes "how do you handle palettes"? I'm not sure the answer to this question here.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Using Tiled as a map editor

Post by tokumaru »

gauauu wrote: Thu May 28, 2020 2:45 pmyou can create a metatile set by creating a new map, and just drawing tiles into it in groups, arranged into your logical metatiles. Then, when you start creating your "real" map, you can load that first map as the tileset (instead of loading an image as a tileset). When loading it, you can specify the tile size, and then you can draw with those metatiles.
Interesting! Can you do this recursively? I mean, can you have metatiles made of metatiles made of metatiles and so on?
turboxray
Posts: 348
Joined: Thu Oct 31, 2019 12:56 am

Re: Using Tiled as a map editor

Post by turboxray »

gauauu wrote: Thu May 28, 2020 2:45 pm In this case, the big question becomes "how do you handle palettes"? I'm not sure the answer to this question here.
Either put your palette info in a metablock that exists outside of Tiled, but mirrors what you see in Tiled. Or have an extra layer hold the palette "number". Since you can export any layer as a CSV, it's trivial to do whatever you want with that data. The first approach is the easiest though.
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: Using Tiled as a map editor

Post by gauauu »

tokumaru wrote: Thu May 28, 2020 4:07 pm
gauauu wrote: Thu May 28, 2020 2:45 pmyou can create a metatile set by creating a new map, and just drawing tiles into it in groups, arranged into your logical metatiles. Then, when you start creating your "real" map, you can load that first map as the tileset (instead of loading an image as a tileset). When loading it, you can specify the tile size, and then you can draw with those metatiles.
Interesting! Can you do this recursively? I mean, can you have metatiles made of metatiles made of metatiles and so on?
No idea. Would be fun to try tough.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Using Tiled as a map editor

Post by tepples »

Blaster Master uses 64x64-pixel metatiles made of 32x32-pixel metatiles, which are in turn made of 16x16-pixel metatiles, which are made of 8x8-pixel tiles.
rox_midge
Posts: 91
Joined: Mon Sep 19, 2005 11:51 am

Re: Using Tiled as a map editor

Post by rox_midge »

gauauu wrote: Thu May 28, 2020 2:45 pm That all said, since I started this, Tiled has now added some simple support for metatiles in the application itself.
By "now added" you mean "literally started landing in snapshots on Wednesday." That's serendipity!

I've just spent a few minutes futzing about with it, and this feature is absolutely golden, IMO. I'm nowhere near the point of actually putting together a real map - much less anything approaching an actual tileset - but I can literally have one tileset based off my source bitmaps, which is used to put together my 64x64 pixel chunks, which is then used as a tileset for my world map. It automatically updates as the underlying sources are tweaked!

Now if I could just get the @&$# attribute bytes to update properly when I scroll...
yaros
Posts: 47
Joined: Tue Aug 28, 2018 8:54 am

Re: Using Tiled as a map editor

Post by yaros »

gauauu wrote: Thu May 28, 2020 2:45 pm That all said, since I started this, Tiled has now added some simple support for metatiles in the application itself.
Thanks! I definitely missed that reading changelogs since last time I used it. I almost decided to say screw it and write my own map editor instead. This saved me a lot of time, and after an hour of scripting I have automatically generated metatile table and the map.
haseeb_heaven
Posts: 20
Joined: Wed Mar 17, 2021 4:40 am
Contact:

Re: Using Tiled as a map editor

Post by haseeb_heaven »

I created my game using Tiled map editor using my custom plugins i wrote i want to share with all.

Tiled export to Assembly code :
https://github.com/haseeb-heaven/RoboRu ... tFormat.js

Tiled export to C/C++ code :
https://github.com/haseeb-heaven/RoboRu ... tFormat.js

For meta-tiles converter you can use :
https://github.com/haseeb-heaven/RoboRu ... meta2c.exe

You just need to include these files in your project and you are good to go.
Post Reply