How high is high CPU usage?

Discussion and feedback on Construct 2

Post » Mon Dec 15, 2014 3:27 am

Right now I'm making my game to work mainly on node-webkit platform and I've realized that the game seems to be eating about 30% of CPU use on my quad core constantly even on idle. The layout has only 84 objects and 90% of them are just static sprites with no events or effects connected to them. The usage doesn't drop even if I remove all particle generators and disable WebGL. Is this normal for C2 games? Also for some reason the debug layout seems to cap my FPS to 50 and makes it feel very laggy, but I don't think it's connected to the CPU usage since it happens on all my projects.

Also does other layouts eat CPU even if they aren't rendered? I have one layout just for objects, containers etc. to make spawning them easier and to keep the project more organized.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Mon Dec 15, 2014 4:00 am

how are you determing CPU use if you are running in debug mode it adds CPU usage quite a bit if your in the inspect page i
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Mon Dec 15, 2014 4:04 am

Hasuak wrote:Also does other layouts eat CPU even if they aren't rendered?


no
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Mon Dec 15, 2014 8:00 am

Yeah, debug will butcher your framerate on the inspect tab, especially if you have a lot of arrays or objects.

One thing about cpu usage: the best thing to do is to export your project, either as html or as node-webkit. Sometimes your cpu will go down drastically on export, sometimes it won't, but it's best to see what happens. Be sure to have 'minify' checked.

If you are still using around 30%, something is almost certainly wrong.

Best way to figure it out: fire up debug and go to the 'profile' tab. See how much cpu is being used. If you have any groups, you can see aprox how much cpu is being used by each group. This is another reason why it's a great idea to break your logic up into groups and sub-groups; makes it easy to spot what events are lagging you down.

Also, check for extra behaviors on objects that you don't need, or loop logic going awry.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Mon Dec 15, 2014 10:50 am

Debug Watch or Profile mode is pretty accurate.

Also its extremely high for a PC quad core to be that highly used in a small project, I think you have a code-leak somewhere. It's NOT normal for C2 games to abuse your CPU unless you set it to do it on purpose or accident. ;)
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616

Post » Wed Dec 17, 2014 11:07 am

when you export your final game - use brutal png re compression. it will though take time.

and about the CPU usage - i have quad 3.4GHz, currently uses 1-5%, and i have tiled water background with 250 frames color map, 250 frames normal map (these are 2 sprites with 2x250frames, infinite looping, bump mapping effect) with effect over them, one 2kx2k image that scrolls under water, 360 frames boat, and static clouds. it's 5 layered layout and still more to come. uses around 180MB by debugger and 5% cpu, 7% when driving boat. but since i use "average" data for mobile / CPU's i'd double that value and say it's 14% usage for average CPUs. we'll see how much it will be once the level is complete.
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,450

Post » Wed Dec 17, 2014 3:20 pm

From the sound of that it must be that I'm just creating my events wrong and causing some weird loops that eats up my CPU. My game has very little animated content aside from the actual characters that usually have 4-5 animations with at least 4 frames and at most 12. I'm gonna start disabling chunks of events and see if that shows me the way to the problem.

EDIT: Alright, I got a question. Which CPU usage I should trust? The one that shows when the Profile tab is open or the one in Inspect? The game uses about 10% of my CPU when the Profile is enabled but jumps up to 35% when in Inspect? Could it be that the Inspect itself hogs the CPU? This also happens on both node-webkit mode and in Chrome.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Wed Dec 17, 2014 9:28 pm

As has been stated, inspect can seriously impact your framerate. You can put your own cpu/fps meter into your project using a spritefont object, and look at the reading from a node-webkit export. That would be the most accurate way of going about it.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Wed Dec 17, 2014 9:59 pm

quick question, how are you getting 30% usage... a single core of a quad-core maxxed out should yield 25% cpu (at least that's how window's will report it, I'm not sure how C2 reports it).

so if you have a maxed out core, then you are going to hit frame-rate issues.
assuming a lot of games are played on laptops... a simple issue is that they'll get hot and noisy as fans power up. so that sounds high to me.
R
B
7
S
3
G
1
Posts: 184
Reputation: 1,352

Post » Thu Dec 18, 2014 5:04 am

On multi-core's, node-webkit splits into 3 processes. Chrome can do the same thing. I'm not sure which thread does what, but chromium certainly has some multi-threading capabilities.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 19 guests