Mike22 Posted July 21, 2014 Share Posted July 21, 2014 I have a simple game with less than 10 sprites. I'm using CANVAS rendering. The problem is, when I add a backdrop and scale it to fit whole screen(by doing on the sprite : bg.width = game.width), the CPU usage grow from 8% to 30% and keep there.... I'm wondering if this is because maybe Phaser is scaling on each frame ? What can I do to avoid this CPU usage ? Thank you Link to comment Share on other sites More sharing options...
rich Posted July 21, 2014 Share Posted July 21, 2014 How big is your game? It may be because you're creating a texture too large for your GPU to handle, so it's having to do lots of work breaking it down, rendering in chunks, etc. Link to comment Share on other sites More sharing options...
Mike22 Posted July 22, 2014 Author Share Posted July 22, 2014 Thank you for your help. The fixed background sprite is a 800x600 png file. And I scale it to 1024x768 using "sprite.width". Is it too large ? What can I do ? Link to comment Share on other sites More sharing options...
jamessimo Posted July 23, 2014 Share Posted July 23, 2014 http://pangolingames.com/how-to-audit-image-ram/Pretty good write up about how ram is used with image sizing. Link to comment Share on other sites More sharing options...
Mike22 Posted July 24, 2014 Author Share Posted July 24, 2014 Thanks for the interesting article on RAM usage with images. Unfortunately, my problem is not RAM but CPU.RAM usage is perfectly normal and fine. The problem is : when I scale the bg (800x600 sprite) to fullscreen, CPU usage start going crazy... Even if the game is doing nothing, and have only 6 other sprites (200x200). To this day I still have no solution. I tried with the latest phaser version but it's the same. Link to comment Share on other sites More sharing options...
Nick Posted July 24, 2014 Share Posted July 24, 2014 If your background is mostly static you can try adding it to the background of your <body> or a <div> element sized to the full screen using CSS. Then keep the game canvas transparent so it shows though. Link to comment Share on other sites More sharing options...
Recommended Posts