High "engine" CPU usage when using families.

  • I am worried the consequence of this thread is people telling each other "don't use families", which would be poor advice. As ever the most critical thing in performance is to make measurements. The only reason you should ever remove a family is if doing show measurably increases performance enough to warrant the increased complexity of events. It's also possible that you have thousands of instances in a family, but you run so many events on them that the overhead of the family is negligible; in this case removing the family doesn't bring any meaningful performance improvement but still causes people's events to get much more complicated and difficult to maintain.

    This is by far the most important point and the tutorial doesn't mention it. It instead says things like "families is something that you should be using quite sparsely". There is no reason to use them sparsely, if they don't measurably impact performance. Not everyone has 10,000 instances in a layout. This kind of advice could end up making beginners needlessly avoid useful features and end up making their events far messier.

    The same goes for behaviors and animations. There's a time and a place to say "have you tried everything else and do you have a project with thousands of instances? Well, you can try these advanced options..." But right now I think making simplistic statements like "behaviors have a 40% performance impact" does more harm than good, especially when it's not entirely accurate (e.g. behaviors which do actually need to tick, are doing useful work, so that 40% is useful work and not wasted).

  • I agree. My game have single layout mini games and I'm not worried about performance drops due to my use of families for example. Without families my project would be so messy. But it is good to know that if you are having performance issues there are things you can test and see if it solves your problem.

  • I can correct it a bit, but the point of the Tutorial and the thread is to identify possible slowdowns, if there is any, and how to deal with them in the case these features are actually the cause. But i still think it's good to inform people of the impact of using some of the features if used extensively. The tutorial is not aimed towards beginners anyway.

    I for one suffered big performance hits because of this on my own projects which I now need to completely restructure to reach my target performance. It could have saved me a lot of work trying to identify what was causing the bad performance if I knew about these issues beforehand, and design my game accordingly. As I'm developing for mobile and is also targeting lower-mid range phones this made huge difference for me. I've spent countless of hours trying to squeeze every time bit of performance out of the game in the wrong areas when it was just a matter of removing Families. I even payed plugin developers to make custom plugins for me just to squeeze out a few % better performance. About every single sprite in my game was a member of a Z-order family and a that big of performance hit to use the family feature is just not acceptable for my goals. Simple tests showed clear improvements in my games performance by removing most families all together.

    At the current state of families in C2 wouldn't recommend anyone to use it for large projects, or mobile projects targeting lower-mid range phones due to these new findings. (Project depending of course)

    I agree if you don't have any issues don't bother, but if people are experience performance issues it's good to at least let them know, what might be the cause. It's pretty easy to test, but can be a lot of work to redo if you're far in to the project. I've been taking long development breaks from my main projects doing other stuff, because I simply couldn't reach my performance goal... Families turns out was the issue. I wanted to use animated tree canopy, and grass etc in my project as well, but scrapped that because my game was already at the limit of what a low-mid range phone could handle. Now i can finally implement that and other things because I know how to get those extra resources available.

    I'll do some editing to the tutorial, as I don't want to promote any bad practices. And make it more clear that IF they have issues. This might or might not be causing it.

  • tunepunk N1 Grate work, Thanks for sharing really good info in there

    [quote:247nnno4]but if people are experience performance issues it's good to at least let them know, what might be the cause.

    +1

    All those things that happen internally in c2&c3 that can affect performance it should be public for everyone to at list give the chance for developers to check if those are the one causing the performance drops to fix it because it may you end up losing huge amount of time looking in the wrong places, I had to stop a project after worked on it for 10 month none stop because of the performance issues that I couldn't resolve It uses Families everywhere and mostly checking distances because I couldnt use The Line Of Sight, I guees is time to go back and check if that was the main problem causing poor performance I would love if is this the case so I can carry on with it and finished , was a lot of work done in there it was for Mobile thogh

    Anyways thanks for the heads up and please keep it coming if you find any more stuff like this

    Thanks to jed Rose for sharing swell

  • NetOne

    Looks like you'll be in for a treat when the c3 runtime drops. I'm not using nearly that many families but most of my sprites are in a family or two. I'm actually thinking of waiting until then instead of wasting too much time on further optimizations.

  • I am worried the consequence of this thread is people telling each other "don't use families", which would be poor advice. As ever the most critical thing in performance is to make measurements. The only reason you should ever remove a family is if doing show measurably increases performance enough to warrant the increased complexity of events. It's also possible that you have thousands of instances in a family, but you run so many events on them that the overhead of the family is negligible; in this case removing the family doesn't bring any meaningful performance improvement but still causes people's events to get much more complicated and difficult to maintain.

    This is by far the most important point and the tutorial doesn't mention it. It instead says things like "families is something that you should be using quite sparsely". There is no reason to use them sparsely, if they don't measurably impact performance. Not everyone has 10,000 instances in a layout. This kind of advice could end up making beginners needlessly avoid useful features and end up making their events far messier.

    That is what I was thinking. Some would spend countless hours getting rid of families to find no performance change. Some things you can't do easily without families.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That is what I was thinking. Some would spend countless hours getting rid of families to find no performance change. Some things you can't do easily without families.

    Although this doesn't take hours to test. For families it's as simple as editing the family and removing or replacing the family members with a low count sprite. If you don't notice any significant performance increase, no need to worry.

  • >

    > That is what I was thinking. Some would spend countless hours getting rid of families to find no performance change. Some things you can't do easily without families.

    >

    Although this doesn't take hours to test. For families it's as simple as editing the family and removing or replacing the family members with a low count sprite. If you don't notice any significant performance increase, no need to worry.

    Exactly!

  • Hey tunepunk

    I have another one for you to added to the List, I have been Four weeks Hunting this one like crazy I recreated the set up for the Game that I'm doing like 5 times checking every detail and recreating on different ways the same thing and couldn't find what was causing that much poor performance and today I remember this post and started to loock in places that I would have never guess if I didn't see this post before, so I finally after going absolutely mad at last chance I spotted the Problem (Containers).

    Is a really really weird problem as puts the Draw calls through the roof for no reason just by touching the controller I say weird because in the controller event sheet there is no code related to anything for the graphics or sprites, it just has the events for the controller but the Draw calls gets affected I don't know how

    Here is the Capx

    https://www.dropbox.com/s/zwu9q5s1xu9hwgq/ContainersBug1.capx?dl=0

    1-Play the capx with only the first group Active and no containers watch cpu+ fps + Draw Calls, keep touching and moving the controller

    2-Then after deactivating the first group and Activate the second group but this time add the (Rouds Object) in a container to the Tiles and watch cpu+ fps + Draw Calls going crazy keep touching and moving the controller, you will notice this test more on phones like iPhone 4

    the Fps drops from 20 to 30 and on iPhone 6 CPU jumps to 90+ plus fps Drops

    Honestly, I spend more time hunting what is causing poor performance than actually making the Games can you please Ashley Recheck all these things

  • I could not measure any significant difference between the two. Could you produce a minimal .capx demonstrating the problem? It also helps to provide two already-prepared .capx files so there don't need to be instructions to follow to modify them, I could have done something wrong (and people often forget a step). Also a good approach as tunepunk discovered is just to modify the quadissue performance test and measure the difference when you add something to the main sprite.

  • I could not measure any significant difference between the two. Could you produce a minimal .capx demonstrating the problem? It also helps to provide two already-prepared .capx files so there don't need to be instructions to follow to modify them, I could have done something wrong (and people often forget a step). Also a good approach as tunepunk discovered is just to modify the quadissue performance test and measure the difference when you add something to the main sprite.

    Sure Ashley I thought about it first but here you go two capx, Both capx are identically in objects and set up it only varies in >> one uses containers and the other one doesn't.

    How to reproduce: just keep touching and Moving the controller with the touchpad will be easier to see the difference if you test it on a phone like Iphone4

    1-This is the good one Doesn't use Containers

    https://www.dropbox.com/s/7si1khcldvfhin4/ContainersBug-1.capx?dl=0

    2-This is the Bad one uses Containers

    https://www.dropbox.com/s/27r14ancwcidbae/ContainersBug-2.capx?dl=0

  • Both of them measure 5-10% CPU for me. The iPhone 4 is pretty old and is stuck with iOS 7 - now four versions behind - so if you only see a difference there, it may just be that old versions of Safari don't optimise the JavaScript so well.

  • Both of them measure 5-10% CPU for me. The iPhone 4 is pretty old and is stuck with iOS 7 - now four versions behind - so if you only see a difference there, it may just be that old versions of Safari don't optimise the JavaScript so well.

    I don't think so if it was Anything related to JavaScript it will perform the same (with or without) Containers here you can see very clear just by adding an object to a container without any picking involving between this two objects it affects the performance Badly so I think is a bug from C2 and looks pretty serious

    I mentioned Iphone4 because there you can see very clearly the performance drops but the truth all the phones are affected by this, the only difference is that are more powerful phones and they can handle it better but it shouldn't happen that because if you notice there is only code for the controller we don't even move the player yet and still the CPU goes really High so when you ad more events for the Game Logic then is when you will notice the Fps Drops even on Newer phones.

    If you cant Reproduce it let me reproduce it for you:

    Look for when I touch the screen and start moving the Pad controller how the Cpu goes Up and the sooner I stop touching the Cpu goes to normal plus I recorded on Debug Mode so you can see how the Draw calls is the one causing the problem it may help you more to debug the problem

    Results are With Containers Cpu perform Double & sometimes more than that

    Tests:

    ==========================================================

    Iphone 4

    No Containers

    Normal Mode:

    https://www.dropbox.com/s/o5em0xb7d9k9b9v/Iphone4%2BNo%20Containers%2BNormalMode.mp4?dl=0

    Debug Mode:

    https://www.dropbox.com/s/a97sfiaki735gjh/Iphone4%2BNo%20Containers%2BDebugMode.mp4?dl=0

    With Containers

    Normal Mode:

    https://www.dropbox.com/s/1195dsia704oz9m/Iphone4%2BWith%20Containers_NormalMode.mp4?dl=0

    Debug Mode:

    https://www.dropbox.com/s/kffbn5vyclzzkzo/Iphone4%2BWith%20Containers%2BDebugMode.mp4?dl=0

    ========================================================================

    Iphone 6

    No Containers

    Normal Mode:

    https://www.dropbox.com/s/2m0vpnafu7ut5e3/Iphone6%2BNo%20Containers%2BNormalMode.mp4?dl=0

    Debug Mode:

    https://www.dropbox.com/s/2ez47lm2o1j4d7l/Iphone6%2BNo%20Containers%2BDebugMode.mp4?dl=0

    With Containers

    Normal Mode:

    https://www.dropbox.com/s/pzxrdfv9d8tspri/Iphone6%2BWith%20Containers%2BNormalMode.mp4?dl=0

    Debug Mode:

    https://www.dropbox.com/s/zvzfb3eec65h2bl/Iphone6%2BWith%20Containers%2BDebugMode.mp4?dl=0

    ======================================================================

    Iphone 7 Plus

    No Containers

    Normal Mode:

    https://www.dropbox.com/s/imfq887ei5om32m/Iphone7%2BNo%20Containers%2BNormalMode.mp4?dl=0

    Debug Mode:

    https://www.dropbox.com/s/5lecaoremra7apl/Iphone7%2BNo%20Containers%2BDebugMode.mp4?dl=0

    With Containers

    Normal Mode:

    https://www.dropbox.com/s/zu3zxklmh5sbq20/Iphone7%2BWith%20Containers%2BNormalMode.mp4?dl=0

    Debug Mode:

    https://www.dropbox.com/s/ob1o2btafom65pn/Iphone7%2BWith%20Containers%2BDebugMode.mp4?dl=0

    =====================================================================================

    Iphone 8 Plus

    No Containers

    Normal Mode:

    https://www.dropbox.com/s/ztfl8xzqye3shj7/Iphone8%2BNo%20Containers%2BNormalMode.mp4?dl=0

    Debug Mode:

    https://www.dropbox.com/s/k66wgkfpyf5wt5u/Iphone8%2BNo%20Containers%2BDebugMode.mp4?dl=0

    With Containers

    Normal Mode:

    https://www.dropbox.com/s/mhurt2tc156du2c/Iphone8%2BWith%20Containers%2BNormalMode.mp4?dl=0

    Debug Mode:

    https://www.dropbox.com/s/7h256djmgrtttlv/Iphone8%2BWith%20Containers%2BDebugMode.mp4?dl=0

  • Ashley,

    Will Construct 2 ever see the benefits from optimization related to polymorphism ? Because I work on a project for more than a year and struggle to optimize it. I had results but spent lot of time on it and never really solved stutters that shouldn't be present. For that I started to think porting the project on Unity (very hard on large project, already done). Even if C2 projects were compatible with C3, I use some plugins that doesn't exists for C3.

    Thanks

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