Is it wise to export a Tiled layer into 1 big png file to save memory?

862 views Asked by At

I just made the background layer in Tiled for my map for Sprite Kit. The main layer is the background layer where the grass, dirt, water & the lot is drawn - this what the player character "walks on". This map is consisted of tiles that are 16x16 (keeping them this small for having better control over the little details during design of the map). The map it self is 100x100. So it's pretty decent size wise. I have roughly between 757-778 nodes just because of these background tiles. That's too much and I haven't even added a single tree to the second layer. Since I'm using Tiled as the map editor with JSTileMap to display it, can I just somehow export the ready background layer from Tiled into a .png file and load that into the game as 1 big picture to drop the node count to 1. Wouldn't this drastically help performance and memory? The others layers have their images spread across & there's a layer that's responsible for the boundaries. Is this a clever way of going about making the game or am I missing something? If it is, does anyone know how to export the layer into a .png file? I checked Tiled & couldn't find anything like that.

1

There are 1 answers

9
sangony On BEST ANSWER

You are most definitely better off having a single PNG/node as your background. There are some benefits of doing this:

  1. You have just one node.

  2. You can add the node to self and place it behind the rest of the action. This way it will always be there regardless of you moving any other nodes.

In the picture below I added a background to the view and have 3 other tile layers plus 1 object layer. My node count is still substantially less than 700.

As for exporting what you already have, I don't think there's a way to save an entire tile layer as one PNG. As a hack you could take a screenshot, crop the background part and work with that.

enter image description here