> Ashley
> As I said upthread, I was hoping to get feedback on what potential issues could be causing it so I could fully test/tweak as much as possible before reporting it as a bug .
>
When talking about performance, measurements are *everything*. Still, if you're looking for guesses, check the parts of Performance tips about tilemaps.
Ashley
Yep, and I've run it through every measurement tool that I can get my hands on that works with C2 - this isn't my first rodeo on optimization, just my first with C2 .
I had started putting together an example of what seemed to be causing the issue, but to be honest it started to seem like it'd be just as much work as making the game itself. Through a few of the tests I tried it seems to be due to a combination of using WebGL shaders with the Tilemap object, as with no WebGL shaders (Wave, Tint, etc. - the effects shaders) there wasn't really much of a performance hit, but as soon as any shaders showed up then performance would degrade drastically with the addition of more shaders and/or Tilemap objects.
There were fps drops/collision increases compared to not using Tilemaps if any objects in the layout were colliding, like the player standing on a platform, even though no tileMaps should have been testing for collision. The expected behavior would be collisions being the same as when not using Tilemaps.
Because the player objects use both WebGL to tint various pieces of the character and needed to collide with platforms, this obviously presents a problem.
I also tried a test based on the suggestion shinkan made about exporting the json files C2 creates when a .tmx is imported: I compared the Tilemap object data between the json C2 creates in the editor when you import a .tmx file to what was happening when the TMX Importer by rexrainbow imported the .tmx file at runtime: the json tile data matched exactly, so the same optimization is being done, which I also thought could be the culprit: however, it doesn't seem to be, seeing as how the results of the 1st and 3rd party importers matched.
I'm pulling in a lot of data from the .tmx files outside of just the tilemap - object variables, where to put spawn points, collision types, what in-game layers to spawn tilemaps/objects on, etc. I completely lack the desire to write my own in-game stage editor when Tiled already has all the features I need and works just fine (even though there's no evidence the 3rd-party TMX plugin is the issue), so I guess I'm just going to have to deal with load times between stages. Even if the memory requirements are 4x as much, I'm at a rock-solid 60fps on pretty much any system with enough GPU memory to handle it (more than 1GB), and there's more optimizations I know I can make there than I've been able to figure out with the Tilemap object. I don't think I can pinpoint the root cause to make a bug report with any accuracy unless I rebuild the game step by step and that's just too much.
***EDIT: I had a thought that maybe because C2 treats optimized sections of Tilemaps as different draw calls that the increased draw calls over using giant textures on Paster objects (big, but one call) is causing issue with the F2B rendering because it has more objects to draw when layers with WebGL effects on them behind the Tilemap layers is causing too great an overhead. This seems somewhat unlikely on the card I'm testing on (as mentioned above, a 980Ti), but it's another shot in the dark. The fps slowdown happens regardless of the size of C2's window - as in, fullscreen at 2560x1440 experiences the same amount of slowdown as 640x360 - so who knows. I also see that C2 has divded the tilemaps up into a LOT of collision checks, even though no Tilemaps should have collisions enabled. There's just so many variables involved, but Tilemap objects are still seeming to be the root cause to the issues I'm having with performance. Issues with, again, only occur when Tilemap objects are in use and large portions of them are available on-screen at the same time. Quite possibly still not a bug, and maybe the optimizations applied to the way Tilemaps render, which works just fine in other scenarios, is simply not the right approach for the game I'm making.