Hopefully this is the right forum to post this in. If not, Kyatric, please move it to the right place.
Backstory:
Up until now, I've been importing TMX files at runtime using the TMXImporterV2 by rexrainbow and pasting sprites as tiles into a Paster object. While this works just fine, pasting a few thousand tiles requires the use of a longer loading screen than I'd like, and since we now have the Tilemap Object (which didn't exist when I implemented the previous method) and based on Ashley saying they're pretty well optimized, I thought I'd try switching over to that to create faster/more efficient stage loading. However, I'm running into some surprising limitations and performance issues I haven't seen mentioned elsewhere on the forum, so I thought I'd try to get some clarification before reporting the issue as a bug.
[SOLVED: Typo in TMX File, totally my fault] ***First Issue: Can't create more than 3 Tilemap Objects on a Layout at runtime.***
***Second Issue: Tilemap Object performance seems to be kind of terrible when there's a lot of tiles on-screen.***
While Ashley mentions in his blog post on the Tilemap Object that they're well-optimized in terms of draw calls (https://www.scirra.com/blog/ashley/3/te ... ap-tidbits) that doesn't really seem to be the case if there's a lot of tiles on screen. The camera in my game zooms in and out a lot, and when it reaches it's outer zoom bounds, showing the full tilemap on-screen, I get a performance hit of 15-30fps - on an EVGA 980Ti with watercooling, which seems like a bit of a heavy impact for what amounts to a 2D platformer. Again, this issues does not occur when using large Paster objects to accomplish the same goal (though with significantly higher memory requirements), so the performance issues are surprising - especially since they're occurring with only 3 Tilemap Objects on screen versus up to 15 Paster objects with very high resolution textures on some stages.
Please note that no Tilemap Objects, at any point, should be triggering any kind of collision checks - invisible objects are used for that functionality, and while I can see/set in the Debugger for the Tilemap Objects to not use collision, sadly there seems to be no way to set collision to false in the C2 IDE or through actions, so I'm assuming the engine doesn't really check for collisions unless explicitly told to do so - though again, that is an assumption:
Performance when zoomed in:
Performance when zoomed out:
For comparison, here's the stats when using multiple high-res Paster objects to build the stage tilemap, zoomed out all the way, with the framerate pinned at 60fps. Far higher memory requirements, but also a far better framerate:
Interestingly, the draw calls are slightly higher when using the Paster objects, making the performance issues related to the built-in Tilemap Object even more confusing:
So, while it says in the blog post made by Ashley that the additional draw calls of the Tilemap Object shouldn't be causing any framerate issues, even on a mobile device, they're managing to drag down a top of the line GPU, which is confusing to say the least. Using Tilemap Objects instead of high-resolution Paster Objects is the only code change I've made from the previous build of the game, which had no trouble sticking to 60fps at all times on GPUs with much, much less horsepower.
Why I think it may be a C2 issue:
It seems like for the time being I'm going to have to go back to using multiple Paster objects to load in my stages which, while drastically increasing load time because of the unique high-resolution texture each instance uses, seems to somehow perform better during gameplay than a native object type designed specifically for the kind of Tilemaps I'm using to create stages. Unless I've missed something? This looks like a pretty severe issue, so Ashley, if you have the time, I'd love some insight on what could potentially be going on here with the Tilemap Objects that are causing such a huge performance hit compared to using giant textures created at runtime with the Paster object.