Working with Texture Atlas in Tiled


(Quentin Raphaneau) #1

Hi,
I’m actually working in a game project(libgdx) where I will have to store a lot of sprites in memory .

So, I’m wondering how could I import tileset/tiles in Tiled via a texture atlas to optimize the memory taken by sprites?
Or at least could I code an editor from scratch using tmx format for saving, in order to use the libgdx tmx loader?

Thanks


(Thorbjørn Lindeijer) #2

Assuming you’re using tools to generate your texture atlas, as is generally the case, this is not something you’d want Tiled to use as input. Instead, the input to Tiled would be the same as the input to your atlas generation tool, which are the source images. You can do this using a “Collection of Images” tileset.

More information (though not specifically for libgdx) at:


(Quentin Raphaneau) #3

Thanks for answering, I understand what you mean. Definitively easier to load directly pictures to the map editor.
About how to pack assets used for creating map before rendering, I finally found the answer (I finally read the manual …).

To complete your answer about libgdx and if someone is stuck as I was. Have a look here :

PS: I saw you answer pretty much every answer on the forum, thanks for that.


(Thorbjørn Lindeijer) #4

Thanks for the additional links!

No problem, I enjoy helping out and I feel responsible for it regarding Tiled usage. But I do think I should try to do less of that to free up more time to actually improve the software or its lacking documentation. There are some people, like @Ablu and @TilemapKit, who are helping to answer questions, which is very releaving.


(Erik Schilling) #5

But usually when i come home all questions are already answered :frowning: P

Regards,
Ablu


(Rileyrg) #6

The ability to reference regions in a packed texture via its atlas would be a good enhancement. Currently I add the full sprite image in the image layer “image” property but also add a userdefined “region” field which my code then uses to relate a textureregion to the map-layer which I then render in an overloaded draw() method.


(Thorbjørn Lindeijer) #7

Why would you not just use the source image that was packed into that atlas in Tiled? Is it not available?


(Allen Moon) #8

What if I am using a tile-set that all the tiles are not perfectly sized say 64 x 64? Say some are 128 X 12 or something else. I am running into problems importing some kenney tile-set assets because some of the tiles are of different size and the can’t be captured correctly.


(Thorbjørn Lindeijer) #9

Tiled currently can’t work with pre-packed images. Either the tiles should be all aligned to a fixed grid, or they need to be used as individual images. The following issue tracks this feature: