digitalsoapbox's Forum Posts

  • > 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.

  • >

    > > A .capx is worth 1000 posts. If you have a performance problem, reproduce it in a minimal .capx and share that. Then I can profile it and get some actual data on what is going on, rather than just aimlessly speculating. You should also not use any third party plugins in such .capx files (as per bug reports). If the performance problem is caused by a third-party plugin, it's not our problem at all.

    > >

    >

    > 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 .

    >

    > Since I'm loading a TMX at runtime, which C2 doesn't support, I'm using a 3rd-party plugin to bring in the files - though there's no reason it should impact the performance in this case since it's not active after loading the file, and hasn't previously affected performance. The performance issues can be traced directly to how much of a tilemap is on-screen combined with how many tilemaps are on-screen at the same time with nothing else going on other than loading the TMX and setting the tiles on the appropriate tilemap objects. Performance is also affected by what portions of a tilemap are on-screen, and when portions of the tilemaps are visible that don't have a lot of repeating areas of a single tile, there's a hit to the framerate. Using tilemaps versus not using tilemaps is the only variable in the scenario I've described in above posts, with tilemaps affecting performance vs. no tilemaps not affecting performance.

    >

    And still, a capx is worth a thousand words..

    Sharing a capx isn't the same as filing a bug-report..

    Can you recreate this framerate drop in another capx?

    Maybe you could import the tilemap from tmx and then export asjson, so in a new layout you can load the tilemap from asjson to see if the problem persists..

    Thanks for the suggestion. I thought about that, but I think it might be a roundabout way to present something I can show in a simpler fashion. Looking at the manual on tilemap objects, it looks like I can import layers one at a time from an existing tmx into the tilemap object, which might be the simplest way to show what happens when there's 8 or 9 layers of tilemaps...but I probably need a nap first.

    ***EDIT: I'm getting an error when trying to import the TMX into C2: "Error parsing TMX file. Check the file is a valid Tiled TMX file." Which, obviously it is. I'm saving in CSV format, so compression shouldn't be the issue either. Is there a preferred version of Tiled to use to create & save maps for C2? I'm currently using Tiled 12.3.

  • A .capx is worth 1000 posts. If you have a performance problem, reproduce it in a minimal .capx and share that. Then I can profile it and get some actual data on what is going on, rather than just aimlessly speculating. You should also not use any third party plugins in such .capx files (as per bug reports). If the performance problem is caused by a third-party plugin, it's not our problem at all.

    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 .

    Since I'm loading a TMX at runtime, which C2 doesn't support, I'm using a 3rd-party plugin to bring in the files - though there's no reason it should impact the performance in this case since it's not active after loading the file, and hasn't previously affected performance. The performance issues can be traced directly to how much of a tilemap is on-screen combined with how many tilemaps are on-screen at the same time with nothing else going on other than loading the TMX and setting the tiles on the appropriate tilemap objects. Performance is also affected by what portions of a tilemap are on-screen, and when portions of the tilemaps are visible that don't have a lot of repeating areas of a single tile, there's a hit to the framerate. Using tilemaps versus not using tilemaps is the only variable in the scenario I've described in above posts, with tilemaps affecting performance vs. no tilemaps not affecting performance.

    EDIT: All that said, I'll see if I can find a way to accurately reproduce the issue. I've probably been up way too long trying to optimize layers of tiles and I might be feeling a bit cranky .

  • Update

    Add "condition: for each layer" to retrieve each layer name / layer properties.

    digitalsoapbox

    Done

    Wow! That was fast. Thanks so much rexrainbow!

  • My "Main Map" in the game (and all neccesary tiles for that map) is in the layout from the start. but every sub levels/maps are loaded from external json files at runtime.

    That's the same thing I'm doing, just loading .tmx files instead of json files.

    But then i never used TMX, ever. I've created my own level editor in C2 to create all maps for my game - so maybe that continuality in saved/loaded files have something to do. maybe there is an issue with TMX->C2.

    There's no continual save/load, it loads the TMX once, parses it, creates the necessary tilemaps on the proper layers, then sets the tiles - probably no different than you're doing with json files.

    In your stages, how many tiles would you say you have on-screen at once? I see a small hit when the camera is zoomed in, which increases with each Tilemap object I have on-screen, but it's when there's a lot of tiles visible that I see the worst performance hit.

  • I was also using 64x64 tiles on 900x900 tile grid and bigger (depending on current game level) Could you reproduce that in brand new project? if so you could upload it as a bug for Ashley to investigate, cause it really sound very strange from your descriptions,

    That's definitely a larger grid than mine, which is only a tilemap grid of 80x47 (right now, 11 of them in total) tiles that are each 64x64. I'm not entirely sure it's a bug in C2 yet, even if it seems like it is. Maybe the tilemap is unable to optimize because the tiles in the tilemap are being set at runtime and not in the editor? That seems unlikely but I'm grasping at what it could be at this point, but the performance drop is similar to creating a few thousand objects to represent the tiles and not pasting them into a Paster object & then deleting them (what I was doing before).

    I suspect because I'm loading in the TMX using a third-party plugin, even a new project stripped of everything else would violate the bug report rules Ashley has set .

  • rexrainbow

    Is there a way to get the names of all the layers/layer properties separate from the tile array? For example: I want to get a list of layers, as well as access layer properties, without having to use "on each tile cell" to step through the tile array and get the names of all the layers.

  • There must be some kind of issue on your side or some other weird thing going on. I have a projects with dozens of tilemaps on different layers (some share same texture, some are instances of same tilemap, different sizes etc - basically all combination you could think of) and never had any problems with them, even on mobiles.

    I didn't check how they works in new 219 beta cause don't have time for that currently. but in 217 (i believe) never had any problems with objects or performance.

    I'm using r216, which I've had no performance issues with in the past, because of issues with the debugger not working in r219, though when I tried the project in 219 there weren't any performance differences. The framerate drops the more tilemaps there are on-screen and even more when the camera zooms out to show the full tilemap, which is why I think the performance issues are related to tilemaps - nothing else has changed at all and the object count is being reported as more or less the same. All the code that creates the tilemap objects and places the tile is deactivated after they're created, so there shouldn't be any overheard there that didn't exist before when I was using Paster objects.

    I'm also using fairly large tiles - 64x64 - so maybe it could be due to that?

  • Not sure about the rest of your questions, but if I use a system repeat 10 times create tilemap, I get 10 tilemaps..

    If I create a tilemap every tick, the count rises by 1 every tick, so there doesn't seem any limitation on the amount of tilemaps..

    Thanks for responding! I'll look to see if there's another efficient way for me to create the tilemaps. That just leaves the performance issue, which is probably the bigger concern.

    ***EDIT: Issue Solved. This just leaves the performance concerns, which get worse & worse with the addition of each Tilemap Object:

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok, thank you for the info. I don't use physics but I guess it might have some performance hickups anyway. I have never tried to export as an universal app so I'll have to experiment a bit. Does the C2 gamepad mapping translate correctly for you when played after export?

    I'm not using much physics either, which is why I think it's probably something to do with collisions. C2 gamepad mapping translates correctly for the main face buttons, analog sticks, bumper/trigger & d-pad but not for the additional buttons on the gamepad like the xbox symbol, which it doesn't really handle properly on desktop either.

    The biggest issue I'm running into right now - and it's a C2-specific issue - is that support is just flat-out broken for Edge, and it tosses an error when even an empty C2 project is launched. This, of course, causes problems on the UA builds, because it's using the Edge webview. Hopefully this will be resolved in an upcoming C2 update.

  • digitalsoapbox Great work on Sombrero! I like it Have you tried the game on xbox one? Is the process of exporting it from C2 to xbox easy or do you have to do a lot of workarounds?

    So far it's been pretty painless. Sadly, performance in Edge doesn't quite match up with NW.js in terms of physics/collisions, which seem to be dragging the framerate down when exporting as a Windows Universal App. This is also an issue on desktop with exporting to Windows 10 UA - at least, according to the Profiler in Visual Studio. I can't tell if it's an issue with C2 or with that export option itself, though I don't remember it occurring when exporting for Windows 8. Maybe Ashley is aware of some differences in the export process for 10 and could comment? There seems to be some shortcomings in C2's export for setting Window size/full-screen options in Win10 UA as well.

  • I see this button when i build my app with vs 2013 for windows 8.1 app but for windows 10 when i build it with vs2015 it does not show any button on the file menu ... In order to make it full screen i have to set the mode to tablet mode and i have to make task bar auto hide. Same app if i build it with vs 2013 for windows 8.1 app it works fine and get full screen.

    I'm having this same issue. Ashley, is there a way to make apps go full screen in Windows Universal app builds directly in C2?

  • Enjoy 20 minutes of SOMBRERO gameplay!

    Subscribe to Construct videos now

    More info here: http://sombrerogame.com

  • Wow! It's been awhile since I've posted an update here. So, time to fix that!

    For the last few months I've been cranking hard on Sombrero, while bringing it to various East Coast events to show off and get feedback from those who matter: Gamers!

    And on that note, here's 20 minutes of gamers enjoying the latest update to Sombrero at GameACon, a new indie game show in Atlantic City, NJ:

    The most recent additions are a new stage, while all of the older stages have been tweaked, new characters and powerups have been added, and a new 2D lighting system that takes advantage of texture rendering and different masked blend modes (like Source Atop) that can to help give it some depth instead of just slapping a circle on top and setting the blending mode to additive.

    There's still a few bugs, mostly in the GUI/in-game HUD, but otherwise Sombrero is bug free.

    Another exciting piece of info is Sombrero's approval for Microsoft's IDevk@XBox program, meaning that if all goes as planned, Sombrero will be coming to XBox One as a Universal App! Microsoft has been great to work with and I look forward to continuing that relationship as Sombrero nears release for early 2016.

    Did I mention user-generated content is also supported for new stages? In hopefully not too long a time, Ashley will work out C2's Steam support so I can add Steam Workshop to make downloading and adding new stages easier for those who purchase the game.