How do I reduce the cpu usage within an app

0 favourites
  • 15 posts
From the Asset Store
Create your own casino app and import it to Google Play and the App Store.
  • I've made a simple game that runs just 3-4% cpu on my desktop but once its implemented into the app its using about 90% and crashing the app. The developers are telling my it is cpu heavy but everything is as small as possible, script minified and its a simple game so I'm unsure what more I can do...

  • Whats the number of collision checks?

    How many objects usually on the screen?

    In debug profile window what shows to use most of the processor?

    Do you use behaviours/plugins that are not by default in C2?

  • Are you one of the developers?

  • Hi,

    I just have an 'on collision with' set between the phone and apps - can i reduce how often it checks for them?

    Also though about lowering the fps but doesn't look like you can do this.

    Probably max 10 items on screen...

    This is the game:

    http://appcatcher.connect-api.io/

    (If you're on desktop you'll need to resize browser to portrait)

    I've built the game in C2, I'm not an app developer...

    Hope you can help!

  • Simple question:

    Might you have forgotten about destroying the sprites when they've left the bottom of the screen?

    If you have, the object count will constantly increase, which might be the reason of the overload..

    A simple game like this shouldn't be a problem..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • They are set to destroy outside layout through the behaviors panel...

    The apps fall due to being assigned the bullet behavior, may be better to use this method do you think?

    https://www.scirra.com/tutorials/67/del ... dependence

    And also wanting to reduce how often it checks for collisions, but i can't work out how? <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

  • Bullet behaviour is already framerate-independant..

    It's impossible for us to see what is causing the issue, without seeing the events and/or the capx..

    Try opening the app in debug mode to see what is using the most cpu..

    Look at the amount of collision-checks..

    See how many objects there are..

    (The debugger should be your best friend if you have these kind of issues)

    Look if you don't have unnecessary every tick events..

  • I think it is the collision checks... it varies up to about the highest like this 816 (~13/tick)

    I can't find anywhere how to reduce how many checks it does... do i need to put it as a sub event of system every 0.X seconds or something?

  • Attached is my source file...

  • I can see no reason why this app should have cpu issues.. (some minor things could be improved event-wise, but won't make much difference)

    Try playing it as a web app through the internet and you'll see it works just fine..

    The problem seems to be with the wrapper "The Developers" are using.. (Do you know which one they use?)

    Could be you'll get better results when exporting without minifying, but the problem seems not to be in your app..

  • Is 60% CPU usage on Windows Phone is normal? Despite it being 3-4% on desktop?

    Extra info from the developers on this:

    When you run the game immediately after opening the app when CPU utilisation is virtually 0% you see that running the game results in a 60% uptick in CPU usage. This happens whenever you run the game which is why the game runs ok sometimes and not other as the 60% uptick sometimes takes the total over a hundred and sometimes it doesn't.

  • Could you answer these questions?

    • What kind of wrapper are you using to play the game on windows phone?
    • How did you get the 60% CPU usage number?
    • What are the specs of the phone compared to the specs of the desktop?

    Like I said before:

    I can see no reason this game should have issues if exported, wrapped and distributed in the right way.

    • What kind of wrapper are you using to play the game on windows phone?

    The game is hosted on an external URL and loaded into a webview control on the phone. Embedding the game locally in the Windows Phone app using the Construct2 plugin results in the same performance.

    • How did you get the 60% CPU usage number?

    Using the Visual Studio CPU usage monitoring tools.

    • What are the specs of the phone compared to the specs of the desktop?

    I don't know for sure CPU will be many times slower, it is for various windows phones so that will vary. My computer is high spec but all the C2 sample games use a more CPU than mine does if that helps!

    • If you play the game through the browser itself, does it have the same issues?

    You've probably already read these tutorials which might be of help (ordered by publication date newest-oldest):

    1- https://www.scirra.com/tutorials/993/ho ... store-apps

    2- https://www.scirra.com/tutorials/593/wi ... onstruct-2

    3- https://www.scirra.com/tutorials/429/ho ... hone-8-app

  • No, it's fine. Also fine if you go straight to the game on the app, if you deviate round the site, or play again that when it freezes...

    I've seen those posts but was advised that they won't make a difference and better to use a hosted html5 version. Do you think that's incorrect and i should be doing it like the links suggest. We exported a version early on as Windows 8, which didn't help, but I think it's worth doing it with this plugin if the app allows...

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