0

I'm going to be using sktilemapnodes for my 2d iOS platformer. What is better or more efficient?

Using a single size sktilemapnode that is the entire level or breaking the area up into multiple sktilemap nodes.

Example: I have 3 layers of backgrounds that I'm going to use for a parallax background effect.

1st Layer (furthest back) is just a gradient sky. I have it broken up into 512x512 px tiles. I only have 8 different tiles that can be used as a 1x8 grid of tiles. I could then continue this pattern left/right or up/down in order to have the sky be as large as I need it to be.

Question: My question is whether I should use 1 tile map node for the entire sky, or if I should break it up into smaller chunks that are repeatable (like the 1x8 grid). If I break it up into smaller chunks I wouldn't need it to be so big, and as the camera moves around in my game I can move these chunks around.

I'm wondering if this would consume less resources this way.

2nd Layer are hills. I have about 8 different tiles that are 128x64 px each. I can arrange them into a repeatable pattern to my liking. So again I can have a tilemapnode that is the size of the pattern that I can repeat, and I can create multiple nodes or I can just create the entire map in 1 node.

3rd layer is a little different because it is basically a pattern image of trees that holds 27 512x512 px tiles. 9x3 grid. But again, I can use 1 node, or multiple.

I'm just concerned with efficiency. What is going to give me the most bang for my buck so that I can have room to process other game objects. This is just the background u know....

With the Tilemapnode, I'm not sure if tiles that are not visible are not processed each cycle or if I need to do some sort of check manually. I want to have the options of having massive maps on certain levels. I'm new to using sktilemapnodes, so I'm trying to figure out how I would use them in the most efficient way possible.

Discoveringmypath
  • 1,049
  • 9
  • 23
  • I don't really understand your question, but from my experience, it's easier to use a tile map that covers what you want it to. I don't know why you would use multiple unless for a specific aspect of the game. Also, it depends on the size of the map. If it gets to the point of needing a long time to load, you'll have the choice of preloading it or loading it small chunks – Nik Apr 30 '17 at 14:19
  • I guess I'm not exactly sure on how to use the tile maps. I will update my question to add more details. – Discoveringmypath Apr 30 '17 at 20:14

1 Answers1

2

Each SKTileMapNode is a single node. Apple does a good job of making sure that multiple map nodes don't use too many resources. That is why there is a single node for a map instead of a node for every tile in a map. It is common practice to layer multiple SKTileMapNode(s) to create a parallax effect or simply to create layers.

For example, a platform game with mountains in the background and clouds behind that would use a single SKTileMapNode for the mountains and a single one for clouds. This gives the added benefit of being able to use transparency in tiles.

Alec O
  • 1,697
  • 1
  • 18
  • 31