0 Favourites

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

  • 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?

  • 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.

  • 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.

  • 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.

    [attachment=0:kq1dj62i][/attachment:kq1dj62i]

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Silverforce I must have a memory leak somewhere. What other reasons could be causing such high CPU usage?

  • 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.

  • 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.

  • 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.

  • Colludium Ashley

    Great suggestions, thank you. Both work very efficiently and the problem has been solved!

  • Hi guys,

    I also have a CPU/FPS problem with my Space invader clone.

    My game CPU consumption is around 30% and the framerate drop sometime very low (and it's a problem because there are sounds associated with).

    The game is still under cosntruction but I can't see what is taking so much resources.

    I have around 140 objects, is that normal?

    Is that the droplets (because they are destroyed at one point)?

    Thanks for the help!

  • Nice game! I wonder where all those CO2 emissions from the explosions go?

    I don't experience any problem at all in my 7 year old PC. The fps are almost always 60 (with occasional drops to 58 or so) and the CPU usage is between 0 and 2 %...

  • Ahah Thanks

    So I guess the problem is coming from me because I have the following results:

    • Firefox: 55 FPS/20-25% CPU (with sometime drop to 5FPS with 5% CPU)
    • Chrome: 60 FPS/8% CPU
    • Opera: 60 FPS/15% CPU

    It a bit better with Chrome then but still much more than you (and I have a great computer (P35W v2 Gigabyte))...

    So, how do you get 1% of CPU usage????

    Is there something special to do or just the regural export???

    Thanks so much for the answers.

  • I don't know where is the problem coming from...

    In my PC with an old intel core 2 quad I have the following stats:

    Firefox: 58-60 fps, 0-2% cpu.

    Chrome: The same as above

    IE11: 60-67 fps (!). 4-7% cpu.

    Please mind that I also play the game in a 2660-1440 monitor and it is huge in size (since you have set the game to letterbox scale) and even at this resolution I have no problems.

    Perhaps something is up with your graphics card? Have you installed the latest drivers?

    I read your code and I didn't find any loopholes or something. Everything looks like it won't cause any problems. I think that your event sheet will greatly improve if you use families (include all enemies to one family for example), and some actions could be made calling a function. Also, you could use very small sprites and lessen the download size and since the game's aesthetic is pixel art, it could benefit from point sampling and pixel rounding (at the project settings/parameters). Also, try not to use too many sprites if you can avoid it. You can use the same sprite with an instance variable to check for collisions, also, the life bar system can be replaced with a single tilledBG object. And finally, use actions to create/spawn the enemies, you don't have to use placeholder sprites: See the events 16 and 36 inside the attached capx.

    Cheers

  • Hi there,

    Sorry for the late but I couldn't worked on my game this week

    So I manage to do everything to told me to optimize my game and that works brilliant ! I even make the sprite in low rez all over again!

    The only thing I haven't done is about the respawn of the enemies (because I don't really understand your solution )

    I'm still have 10-20% of CPU consumption but frame rate is great.

    So now I still have to figure how to post a score on Facebook and to store highscores online... 90% done still 90% to go

    Thanks and cheers

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