C3 vs C2 Spritesheeting and Mobile Performance

0 favourites
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • I was tried my game was running good with C2. Just tried C3 export but something really bad. Because spritesheeting not good in C3. When you change layout on mobile export. It is waiting like 5 secs. Everything works perfectly in Contruct 2 because I use seperate sprites for memory optimisation. So it is loading only what I used in layout. But C3 loading all other assets which include in spritesheet.

    Why don't you give us a choice? Why we can't select spritesheeting algorithm? C3 really not mobile friendly.

    Just try this example with Construct 2 and Construct 3. You will see, C2 is better at layout loading.

    C2 Layout switch - 1 sec.

    C3 Layout switch - 4~6 secs.

    Tested with ZTE Blade S6 - Android 5

    System Webview updated latest version.

    Ashley can we have something mobile friendly? Please.

    We can't use C3 with this, also C2 outdated we can't use that too.

    Test Project and Android apk files.

    drive.google.com/file/d/1GXJStBvggAYwYPGRrPaKBYrtDpin4_sA/view

  • Spritesheeting had a number of upgrades in C3. However it's extremely complicated and involves endless tradeoffs. It's pretty much the case that any change we make at all to spritesheeting, half of games get better in some way, and the other half get worse. We've played this game of whack-a-mole for some time and I don't think there's much more we can do to improve things for everyone.

    The key changes in C3 are preview mode also uses spritesheets - C2 does not in preview mode so you have to export to get a fair comparison; and C3 can combine more kinds of objects on to single spritesheets, whereas C2 never does. This means in C2 you often have far more separate image files, which in some cases can slow down downloads and loading, and reduce rendering performance at runtime, however it offers more granularity in memory management. In C3 the objects combined on to the same spritesheets are the ones most commonly used together on layouts across the project, the idea being that when it loads a spritesheet it's most likely all those objects are being used at the same time, thereby minimising the likelihood that a spritesheet is loaded with some content that won't be used. From what I've seen this does tend to scale pretty well to large real-world projects. (This doesn't tend to work so well with dummy projects, because they're not realistic examples of objects being re-used across multiple levels.)

    Also, C3 does already provide options to control this. The max spritesheet size setting lets you alter the performance vs. memory use tradeoff. According to my tests with the provided .capx I get:

    Exported C2 project: ~26mb image memory

    C3 project with max spritesheet size 1024: ~29mb image memory

    That's near enough to the C2 memory usage, so it seems that option is already there and working for your case.

  • I get best results when using 4096 as maximum sprite sheet. and if Exporting as runtime 2 with that my RAM usage drops from 850 MB to 555 MB.

    setting max spritesheet to 1024 estimated RAM usage jumps to 1.35 GB

    Isn't this backwards? Or I guess it depends on a game, how many sprites. In my case most of the images are within a single sprite.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley We tried all 3 settings (1024, 2048, 4096), C2 still better at loading time. People don't want wait in mobile game when they try to go shop or game layout.

    This just example, I just made it to show how C3's spritesheeting on mobile. Actually you are talking about memory but did you look how many sec layout change?

    And don't change any option in my example because I add all asset with C3's "view spritesheets" tool. So layout have only 6 objects but it is loading all assets. If you change that you need add some assets for real test. Like what I do.

    So for real 1024x1024 option not good too. We need chose something for project based. If we need improve download speed we can use 4096 option, if we need memory optimisation we can select C2 export style.

    If we have something...

  • It is connected. If you can reduce RAM usage you will reduce loading times. I've had the same thing you describe happen with my game even with Construct 2, As I added more teams, loading times increased, until eventually, one day it started crashing, would not load at all.

  • It is connected. If you can reduce RAM usage you will reduce loading times. I've had the same thing you describe happen with my game even with Construct 2, As I added more teams, loading times increased, until eventually, one day it started crashing, would not load at all.

    I know it is connected, but Ashley not used my example. He is changed spritesheeting setting.

    Exported C2 project: ~26mb image memory

    C3 project with max spritesheet size 1024: ~29mb image memory

    My example using 2048, I can make one example for 1024 option. You can see what is different.

    That problem only this; Construct 3 loading (1024x1024)png files. So when you need one object, it is loading all png file. When you need only 10x10 sprite object.

    Do you understand now what is problem?

  • Why don't you give us a choice?

    And don't change any option in my example

    You first asked for an option, then insisted that any options must not be changed in your project. So I don't know what I can do to help you any more.

  • That problem only this; Construct 3 loading (1024x1024)png files. So when you need one object, it is loading all png file. When you need only 10x10 sprite object.

    Do you understand now what is problem?

    I do. I have tested all this a few times. Speitesheeting algorithm in Construct 3 is different and uses up more RAM no matter what.

    So far I have only one game with real potential problems.

    RAM usage

    Construct 2 export = 450 MB

    Construct 3 usin9 runtime 2 and 4096 as max sprite sheet 555 MB ( best I can get from Construct 3 )

    Construct 3 using runtime 3 usually 850 MB, I can drop it to under 700 MB if max spritesheeting set to 4096

    Construct 3 using runtime 3 and 1024 max sprite sheet. 1.35 GB ( worst scenario )

  • > Why don't you give us a choice?

    > And don't change any option in my example

    You first asked for an option, then insisted that any options must not be changed in your project. So I don't know what I can do to help you any more.

    Well, I will do one example for 1024 option too. Just wait please.

  • Ashley just add new project it is using also 1024x1024 option. You can choose what you want. It is good example to show you we don't have any control on spritesheeting with C3. But with C2 we can do something.

    Just want to show you. (You know this already)

    With Construct 2;

    • If we use one frame sprites in project it is exporting only that sprite as (one).png file.
    • If we have animated sprites in project this time it is exporting that frames using max spritesheet size (1024 for C2)

    But we don't have any option for that with C3.

    You can say use 1024 option. It is not really help on mobile.

    Just made example for that. We don't have any control on sprite sheet exporting. with Construct 2 we can do something, but you know C3 don't have any option.

    Layout changes really bad because it is using all assets which I don't use in layout. Because spritesheeting algorithm.

    I hope you understand what we need now for mobile.

    Just best option if we can choose that spritesheet exporting like C2's way.

    Example:

    drive.google.com/file/d/1ZW8XdsznXtuST-3vSrnBSAQxtluu2IIO/view

  • You can choose what you want. It is good example to show you we don't have any control on spritesheeting with C3.

    I'm totally confused because these two sentences directly contradict each other.

    If we have animated sprites in project this time it is exporting that frames using max spritesheet size (1024 for C2)

    C2's max spritesheet size is hard-coded at 2048 and there is no option to change it. C3 has an option to change it, and smaller sizes tend to use less memory, so C3's 1024 setting can help.

    You can say use 1024 option. It is not really help on mobile.

    I made actual measurements and demonstrated it got pretty close to C2's memory use.

    FYI C2 loads images one after the other, but the C3 runtime loads images in parallel, which is faster. At the time I wrote it I took some measurements that showed C3 could indeed switch layouts faster than C2. But as noted it depends on the memory use, since using more memory also requires loading more memory. Given similar memory usage though, the C3 runtime should be significantly faster at loading.

  • I made actual measurements and demonstrated it got pretty close to C2's memory use.

    Thats my mistake (the first one), can you try everything with last example.

    C2's max spritesheet size is hard-coded at 2048 and there is no option to change it. C3 has an option to change it, and smaller sizes tend to use less memory, so C3's 1024 setting can help.

    We can do this (look at image) with Construct 2 but C3 don't allow and this what we need for mobile. You can see in example project. I use all object one frame. Because it is best way for memory optimisation with C2. C3 don't allow this it is using every time what you choose, lower option only 1024 and it is really big for mobile.

    Please look image. Did you see they all only 256x256 px. And if sprite size lower than 256x256, C2 will export that images lower size too.

    image: i.imgur.com/PGnfJoc.png

    You can give us 64x64, 128x128, 256x256 options for mobile but not 1024x1024. You can see and you can try last apk, it doesn't help. Layout changes took 4-6 sec with 1024 option too.

    Actually best option;

    if sprite only one frame export it one file.

    If sprite have a lot of frames than export it using max file size (what we choose, like 1024)

  • Ashley

    Okay, I do totally fair test example.

    How?

    C2 and C3 using same objects in layout, C2 and C3 using same exported files - (15 x (1022x1022) png files + 1 spritefont file)

    C2 RAM Usage: 66.92 MB

    C3 RAM Usage: 59.93 MB

    Phone Resolution: 1280x720

    Phone: ZTE Blade S6

    Test Project

    drive.google.com/file/d/1XZWhEduAxyyAGLLkc0e43QEIuL0x4E1Z/view

    Results

    I do so many tests. I get best result with C3 only 0.954. C2 still better, I get only witch C2 0.827 (max result)

    as you said;

    FYI C2 loads images one after the other, but the C3 runtime loads images in parallel, which is faster. At the time I wrote it I took some measurements that showed C3 could indeed switch layouts faster than C2.

    It is not true. You can test yourself too. You can see my results, C2 still faster and it is using more memory. "C3 runtime loads images in parallel" this not good for mobile. I think mobile CPUs can't handle this, thats why C2 loads faster than C3 on mobile.

    Also I used some edits with C3, I do export option 256x256 and do compare layout switch. So C3 export files (256x256).

    With my game (So maybe you want see some real project results):

    C2 Game Layout switch: ~3 sec. - 70 MB RAM usage - ~150 objects

    C3 Game Layout switch: ~5-6 sec. - 76 MB RAM usage - ~150 objects

    I'm thinking the problem only this: "C3 runtime loads images in parallel"

    or maybe you can explain what is wrong with mobile?

  • I tested your project on a Pixel 3 and got the following results:

    C2: first switch ~232ms, later switches ~100ms

    C3: first switch ~170ms, later switches ~100ms

    So according to this, the C3 runtime is faster in this case. I don't know why other devices would be different, maybe specific hardware is better or worse in different cases.

    Besides, C3 has a new feature that helps you hide this from the user - there's a built in memory management action "Load layout images", so you can load the next layout's images in the background while the current layout continues to run, and then switching layout will be instant. This feature is not available in C2. If I use "Load Layout 2 images in to memory" on start of layout in Layout 1, then it can switch layouts in around 5ms, which is far faster than you can ever achieve in C2.

    So as far as I can tell C3 is both faster at loading layouts and it has a feature to help guarantee that layout switching will be instant, which works here.

  • The problem could lie in the fact that this is a Construct 2 project being imported into Construct 3 and switched to runtime 3.

    There are apparently many problems with this approach ( Importing into Construct 3 and staying with runtime 2 seems fine )

    First thing I notice is that it doesn't go straight to bar and logo screen then jump into my own loader layout. There is just a bar that pops up before it goes to bar and logo loader, but often it does not go there at all, just black screen.

    My custom loader text or bar seem not to work either, so you can click on continue before anything is really loaded.

    Often if you do get to theis loader layout clicking on continue just shows a black screen, reloading the app or browser then seems to make it work sometimes.

    In the latest betas, all of my particles do not show up for some reason when playing it on a phone, but everything seems fine on PC. Opening an empty new project in Construct 3 then copying/pasting asteroids and particles + code used in Construct 2 game, works fine. So, maybe something lost in translation between Construct 2 file and Construct 3 ( In stable version 148 this works fine )

    Most of the games do not work at all on my phone when using remote preview, if switched from runtime 2 to 3 ( stable 148 does not have this problem, ).

    I know I should file a proper bug report, but I don't have time to re-create simpler versions of these projects. Right now I will either use Construct 2 to export, or Construct 3 using runtime 2. Weirdly enough a problem with janky physics on some phones disappears when using Construct 3 / runtime 2 combo.

    By the way, I have never used any 3rd party plugins, only Construct 2 events/behaviors

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)