How to lower cpu usage in Cocos Creator build?

Hi, I am currently working on a company project, however I’ve run into an issue with CPU usage. I am using Cocos Creator v2.4.3.

My issue is high CPU usage when my project is run on the Chrome browser on Windows.

Does anyone have any advice or tips on how to reduce CPU usage?

I have tried:

  • disabling unused modules in project settings > module config
  • using texture packer instead of individual images for project assets
    (but no real improvement in CPU usage)

I can ask engineering to have a look at this topic.

1 Like

Is your game using a lot of frame animation or tweening, or is there a lot of collision detection or physics effects in the game? If you are doing a lot of calculations in the update callback this could also cause this problem.

My project has only 1 scene, and the transition between different pages are done by setting nodes to active or inactive.

For animation/tweening:

  • I have a slide in/out animation for a node using the Animation component (only happens when I transition between different nodes), just modifying the X position of the node
  • A looping animation from left side of the screen to right side of the screen, also using the Animation component and modifying X position of node
  • A loading screen with a GIF that I converted into individual frames (56 frames, each frame is 900x900), and animated the SpriteFrame in the Sprite component using the Animation component.

For collision detection/physics effects:

  • does the scrollview component count as collision detect? I have a scrollview where I instantiate 50 prefabs, each one has 5 label nodes and 1 sprite node (1920x2), and I will detect if the scrollview has reached the bottom, it will instantiate another 50 new prefabs in the scrollview

For update:

  • Detects if the current device is on PC and if the current window aspect ratio is too thin or wide

This should be optimized if you implement scrollivew using the reuse item scheme.
You can do this by referring to the items in this repository:

1 Like

Likewise you need to properly reduce the number of simultaneous animations in the game.

Are there any general guidelines that I should follow to properly reduce the number of simultaneous animations in the game? Or things that I should avoid/not do when doing animations?

Thank you, will check it out

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.