What are normal FPS rates, CPU usage for Node Webkit?

Discussion and feedback on Construct 2

Post » Fri Jun 27, 2014 11:34 pm

Hey Construct Community,

My alpha (80 events) had 30%+ CPU Usage, 72% memory usage, and slowly decreased in frames per second to a minimum of 30 fps during a short playtime. I know what the problem was: I was spawning raindrops every 0.01 seconds, but I thought Construct 2 could handle a large amount of objects on screen.

After changing the value to every 0.1 seconds, the frame rate decrease stopped, but I still have at least a 20% CPU usage and around the same memory usage. Is this normal? What are your projects yielding in regards to the FPS, CPU/Memory usage?
B
22
S
4
G
1
Posts: 153
Reputation: 1,938

Post » Fri Jun 27, 2014 11:54 pm

Care to post a capx? There are smarter ways of doing rain. For example, I'm doing dust in my levels, and I'm easily hitting 60fps.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 963
Reputation: 10,721

Post » Sat Jun 28, 2014 12:04 am

B
22
S
4
G
1
Posts: 153
Reputation: 1,938

Post » Sat Jun 28, 2014 2:52 am

Form my experience always check your project with final export and don't judge with preview mode.
You may set a text object : Every tic - Set text to :
fps & " FPS (" & renderer & ") " & round(cpuutilisation * 100) & "% CPU "

Then export and test your game with different Pc's.
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Sat Jun 28, 2014 5:06 am

I spawn raindrops that collide on surfaces (spawning droplet particles) and water (droplets & splash sprite) every 0.1 seconds and I get 60 fps with 1% CPU use.

This is on an i5-3570K CPU.

Raindrops.jpg
You do not have the required permissions to view the files attached to this post.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,614

Post » Sat Jun 28, 2014 8:26 am

@Silverforce I must have a memory leak somewhere. What other reasons could be causing such high CPU usage?
B
22
S
4
G
1
Posts: 153
Reputation: 1,938

Post » Sat Jun 28, 2014 8:29 am

awmace5 wrote:@Silverforce I must have a memory leak somewhere. What other reasons could be causing such high CPU usage?


Take a screenshot of your game running in debug mode, with watch menu active and show the objects, collision checks etc.

Also if you ever want to spawn a lot of things, don't ever use every 0.01 because thats below the individual frame threshold which is 0.0167, its just wasted cycles for nothing. Use everytick instead.

If your raindrops have a WebGL effect associated with it, or blend mode that's not default normal, have it all spawn one a single layer (new layer called Rain for example) with that effect or blend & remove those effect/blend from ur raindrop sprite. This way works a lot faster.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,614

Post » Sat Jun 28, 2014 11:33 am

@awmace5,

You do indeed have a memory leak. Your Water sprites are not being destroyed and are accumulating at a rate of approx 30 per sec (I stopped the debugger after a few secs with more than 1500 of them....). I didn't see 30 appear on screen each second, so there's a bit of unnecessary cpu work going on there (perhaps only spawn them where they will then be seen) and the hit-solid-destroy system doesn't seem robust. You could do this a couple of easy ways - the quickest would be to add a Fade behavior to them that is active on start and then time them to fade out after, say, 5 secs - where they will be off screen or already destroyed by what you have in the events already.

Edit - I just tried the adding Fade behavior and it doesn't work. There are just too many Water sprites... I suggest only spawning them where they will be seen and then destroying them when their y value is > layoutHeight + a bit.

Edit 2 - The above y value check works and caps their number at ~120 without managing where they are spawned which would also allow you to reduce the spawn rate.
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,206
Reputation: 43,834

Post » Sat Jun 28, 2014 11:42 am

The most efficient way to do rain is to re-position raindrops back to the top when they go off the bottom of the screen. Then you never actually create or destroy any objects, you just cycle round the same few.

Obviously if you regularly create objects and never destroy them, you will fill up memory and the game will grind to a halt.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Sat Jun 28, 2014 7:35 pm

@Colludium @Ashley

Great suggestions, thank you. Both work very efficiently and the problem has been solved!
B
22
S
4
G
1
Posts: 153
Reputation: 1,938

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Refeuh, SaRaB, tdcostas and 12 guests