Jump to content

Atlas and Tiled


jeancode
 Share

Recommended Posts

Hello,

 

I'm starting to think about performances, and I've read here and there that having a big atlas with all the sprites is way better performance wise. At the moment I use different images or spritesheets because it's easier to test things during the development, but I clearly want to optimize the performances of my game so I will definitely use an Atlas in the end. I will probably use texturepacker as it is recommended here quite often.

 

I'm using tiled to generate a map, and I'm wondering how it'll work with an atlas. In the tiled editor, I've just uploaded a little spritesheet with all the tiles I need, then I load this spritesheet in Phaser. Quite straightforward.

But as I understood, you have to upload each tile (image) in an atlas, not the whole tileset. Plus the atlas will contain all the tiles and differents animations / sprites. So I wonder how you can tell Phaser which images in the atlas match the tiles from the json export. If I understand clearly the json has a big array "data" which represents  the map, where each tile have an id. From what I understood this id is simply the position of the tile in the tileset used. Does that mean I have to keep the same order in an Atlas or something like that ? I don't know where do you set this up (Phaser / tiled / Texturepacker). Sorry if that might sound stupid, I've never used an atlas before so I don't really know how they actually work.

 

Thanks in advance !

Link to comment
Share on other sites

For tilemaps you just use the same tilesheet images that you use in Tiled (Spritesheets is not supported by Tiled, as the tiles has fixed dimensions which makes spritesheets kind of pointless unless perhaps implemented for the objects layers somehow).

I add enemies in tiled by adding an object layer with a placeholder tilesheet representing enemies (one frame per enemy scaled to tilesize). In the game I identify enemies in the object layer and construct them using a spriteatlas that has nothing to do with Tiled or the tilemap but allows me to refer to frames as strings, use different sprite sizes and pack all enemy frames into one image (the spriteatlas). In the game I just ignore the placeholder graphics for enemies I use in the editor.

Hope that helps. I suggest you try a making a smart folder in Texture packer with all your sprites, when done it really saves time even during development.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...