demiculus Posted November 7, 2018 Share Posted November 7, 2018 I don't have many animations & most of my game UI is static(its a board game). So correct me if my understanding is wrong. Even when nothing moves on the screen PIXI draws everything on the canvas constantly, right? So it means every second PIXI draws everything 60 times. I have implemented this solution but my computer still heats up when I'm playing the game: https://stackoverflow.com/a/43426419/4204919 What optimizations can I do? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 7, 2018 Share Posted November 7, 2018 If you look at pixi ticker, you'll see that there's setting for target FPS count, but you already implemented your own solution. While Flash had "cacheAsBitmap" setting that AUTOMATICALLY cached ui every time you change it, pixi doesnt have that , you have to use separate canvas or renderTexture to store it. However, if the problem is fragment shader, it'll persist even through cacheAsBitmap. No, there are no other optimizations on pixi side. demiculus 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 7, 2018 Share Posted November 7, 2018 Switch antialias to false if you use it. (its off by default, so its ok if you dont know what am i talking about) demiculus 1 Quote Link to comment Share on other sites More sharing options...
jonforum Posted November 7, 2018 Share Posted November 7, 2018 i good way to check if your doing something wrong. you can also check other big game. example here starcraft , is hold my cpu between. ~13 ~20 % in the static menu. and my project on pixi `nwjs` 6~16% in game. It a little nice way to check if you do something wrong. If you little 2d game get cpu over AAA game, maybe you need some optimisation. Quote Link to comment Share on other sites More sharing options...
Exca Posted November 9, 2018 Share Posted November 9, 2018 One really great way of reducing gpu/cpu utiliziation is to skip rendering when nothing has changed. Especially good if you have lots of static content. Easiest way to do that is to have some global flag and everytime you update something set it to true and when rendering set it to false. Then just check before render if it's true or not. Skip rendering on false. That way you only get rendering when it is actually needed. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Rob Morris Posted November 9, 2018 Share Posted November 9, 2018 13 hours ago, Exca said: One really great way of reducing gpu/cpu utiliziation is to skip rendering when nothing has changed. Especially good if you have lots of static content. Easiest way to do that is to have some global flag and everytime you update something set it to true and when rendering set it to false. Then just check before render if it's true or not. Skip rendering on false. That way you only get rendering when it is actually needed. Any pointers on how to skip rendering cleanly? I like the idea, and given my architecture (where everything is wrapped by accessors) it would be easy enough to set a global "dirty" flag, but I'm not clear on how to explicitly skip a render using the PIXI.Application model. Where can I trap the "I'm about to render" event/call? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 9, 2018 Share Posted November 9, 2018 > Any pointers on how to skip rendering cleanly? I like the idea, and given my architecture (where everything is wrapped by accessors) it would be easy enough to set a global "dirty" flag, but I'm not clear on how to explicitly skip a render using the PIXI.Application model. Where can I trap the "I'm about to render" event/call? PixiJS application class is a mashup for hello-worlds and simple demos. For a serious project you have to copy it and make changes: https://github.com/pixijs/pixi.js/blob/dev/src/core/Application.js Everything in this article except interaction ( its still part of "renderer.plugins.application" and not moved separately) is true: https://github.com/pixijs/pixi.js/wiki/v5-Custom-Application-GameLoop Quote Link to comment Share on other sites More sharing options...
Rob Morris Posted November 10, 2018 Share Posted November 10, 2018 Thanks Ivan, that's very helpful. I'll go refactor my main app and see if I can't improve things. Much appreciated! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.