Make Tileset working with Texture Atlas

It would be useful to be able to create tilesets from a single texture Atlas.
Texture atlas is useful to put on the same image tilesets, sprites, picto etc.

Currently, AFAIK, a tileset is bound to an image with parameters: width, height, spacing, margin.

The following additional parameters would be welcome:

  • offset x and y to locate the beginning of the tileset (replacing the margin parameter ?)
  • total number of tiles in order to deduce the number of rows and columns in the tileset.

That way, I can create my tilesets in the Atlas, put sprite sheets in another area of the image without impacting the tilesets.

Would it be difficult to implement ?

Kind Regards,

Z.

Nothing prevents you from doing so using Tiled as-is: you just need the tileset properties (width, height, spacing, margin) and your atlas to match so the grid in tiled is correct, then just ignore parts of the image that are not tiles.

Jon.

Hello Jon,

Not exaclty.
Firstly, the margin parameter is currently the same for horiz and vert margin.That means we can’t locate the tileset arbitrarely in the atlas. => waste of space.

Secondly, if a tileset (256x256) is used into an atlas (2048x2048), you’ll have a ton of uneeded tiles in the tileset view. Not very conveniant.
That’s why setting the tileset width and height could fix it.

Z.

That’s because it is not the purpose of the margin property.
A ton of unneeded tiles in the tileset view is the only problem here. Sure, that’s not very convenient, but that’s the only way to use a texture atlas with Tiled currently.

The only thing you can do is create an issue on github to ask for that specific functionality to be implemented.

It’s already been purposed, and I’m eager for it also. It would allow users to add and remove tiles easily. Also a solution to tile sheets with different sizes. Discussed here: https://github.com/bjorn/tiled/issues/1008