Hi all,
Long story short, I have created my own tile engine some time ago and want to extend its functionality by supporting multiple tile sizes within the same map (eg. map-tilesize = 16x16, tileset1 = 16x16, tileset2 = 32x64, etc…)
This introduces a new “functionality”: being able to have tiles overlap each other. In the screenshot below you can see tree tiles, they are all placed on the same tile-layer. The display order of these tiles are apparently defined in Tiled, as tiles placed at a higher x-index are placed above tiles with a lower x-index, same with the y-index.
Previously I have already implemented this for just the y-index, by making some kind of depth buffer. This consists of a displayGroup, with a table of displayGroups inside of it. (Pseudo code found below)
local layer = display.newGroup() for i=1, #amountOfVerticalTilesInMap, 1 do layer[i] = display.newGroup(layer) end
Now when I spawn a tile, I would insert it in the correct y-index as defined in Tiled. This makes all tiles with a higher y-index overlap the tiles with a lower y-index. In a map of 100x100 tiles this would create just 100 displayGroups, which is not that big of a number for what it is worth.
When I’d also create a depth buffer for the x-index, the number of displayGroups that would need to be created is a lot higher: 10.000 (100x100). I did check the memory impact and it was not that high, around 2.7MB system memory and 0 texture memory. But i’m afraid this could cause some other issues I am not overlooking at the moment? Could any developer verify me how this would affect the performance of the Corona engine other than memory usage? For example, when moving the complete layer, would the ~9000 empty layers use a lot of processing power?
