How do I decrease my CPU usage? It's currently at 30%!

0 favourites
  • 4 posts
From the Asset Store
30 high-quality 2D monsters. This asset is perfect for a side scrolling game, or even a turn based RPG type game.
  • Hey there!

    I am developing a game for 3.5 years now, and there is already a bunch of events, sprites and animation in there.

    My main event sheet causes a CPU usage of 20% (it includes every other event sheet), but I can't figure out why it's so incredibly high. The events are put in different groups, but they only add to a total of 2-3%.

    What else can cause that to happen? For clarification, every layout uses my "Event Sheet 1", but that shouldn't be an issue, since you are only ever on one (+HUD) layout.

    Can Global variables or the "include x Event Sheet" cause anything like this? I do have 60fps on my computer, but the game runs noticable worse on my notebook (~10-20 fps).

    Tagged:

  • we would need to see a lot more information to be able to tell...

    the number of objects doesn't seem too bad, and 30% isn't bad as well (depending on what is going on in the game). The lower fps on the notebook is the most concerning part - but what kind of notebook is it?

    It could be behaviours on objects, it could be too many collision checks, it could be unnecessary events, or events structured in an inefficient way... it is impossible to say without seeing more.

  • AllanR

    I have some sort of enemy wave spawning in my game and read that things like "for each instance" might be very performance heavy.

    In the project I also use the Canvas Plugin for Splitscreen and Photon for online multiplayer. (in this screenshot, both of these are currently disabled though)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "for each instance" may not be bad if you don't have too many instances and not running this event on every tick.

    Generally, try to avoid events that are not triggered, i.e. run on every tick.

    Break your code into separate event sheets and groups. (EDIT: Sorry, didn't notice that you've already done this). Don't include unnecessary event sheets. For example, in your game layout don't include an event sheet from the main menu layout.

    Use Inspector in debug mode to identify which sheets/groups are using most CPU. Try temporarily disabling big parts of your code and see if this improves CPU usage. When you find most CPU-hungry events, rewrite them.

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