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.
Asked
Active
Viewed 832 times
2
-
You could capture a large background into a single texture, but that would waste a huge amount of memory. The point of setting up a tiled approach is so that you do not need to waste all that memory on a solid background. – MoDJ Jun 11 '16 at 22:50
1 Answers
1
You are most definitely better off having a single PNG/node as your background. There are some benefits of doing this:
You have just one node.
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.

sangony
- 11,636
- 4
- 39
- 55
-
-
@Krekin - You should contact Skyler and talk to him about joining the SKA. It might be beneficial for your project. http://stackoverflow.com/users/851041/skyler-lauren – sangony Jun 13 '15 at 20:34
-
I'm already very excited for the SKAToolKit you guys have created and I've been following Skyler's "Old Frank" game he's currently developing & placing on GitHub. My plan is to create 1 fully functional map (AI & so forth) with JSTileMap to have a thorough working prototype for display. Then I want to delve into SKAToolKit & figure out how to get that bad boy started. Currently, I have a lot more documentation at my disposal in regards to JSTileMap because of "iOS Games by Tutorials" from RW. Which is my safety rope for the time being (2nd game ever. 1st one being Tiled). – Krekin Jun 13 '15 at 20:42
-
1@Krekin - SKA is a small group of Indie SpriteKit developers. You might want to talk to him about joining. – sangony Jun 13 '15 at 20:44
-
2@sangony Actually you can save a layer to PNG in Tiled by making sure it's the only visible layer and then using "File -> Export as Image...". It would be rather unfortunate if such strategies are actually necessary when using SpriteKit, though. The whole point of using a tile map is to avoid the large amount of memory for such a big image. SpriteKit would need to provide a way to work with textured geometries rather than just sprites, and I'm now unsure if it does. – Thorbjørn Lindeijer Jun 13 '15 at 21:04
-
1@ThorbjørnLindeijer - Thank you, I was not aware of that. I am a big fan of your Tiled app. Thank you so much for all the effort and time you've put into this awesome app. I agree that SK still has some way to go but it is still young and thankfully Apple is providing a lot of improvements. – sangony Jun 13 '15 at 21:10
-
@ThorbjørnLindeijer I get "The given filename does not have any known file extension." when I try to name the layer I'm exporting to "Background.png". There doesn't seem to be any .png file extension in the list of file extensions. Only 8 extensions. – Krekin Jun 13 '15 at 21:30
-
1@Krekin You need to choose "Export As Image...", not "Export As...". – Thorbjørn Lindeijer Jun 14 '15 at 20:33
-
@sangony It's my pleasure! And indeed lets hope SpriteKit will improve further, or maybe SceneKit is the way to go. – Thorbjørn Lindeijer Jun 14 '15 at 20:33