- Home /
Power consumption optimization
Hi guys,
Currently my game is sucking up lots of power from the device. From 90% battery down to 10 in 45 minutes, and the phone became very hot. Do you have any suggestion to optimize this?
Thanks in advance.
BTW, I've just remembered that once in a while my game is trying to connect to the internet. I'm using these plugins: Facebook SD$$anonymous$$, Soomla Profile, Soomla Store, GPGS, and NGUI. So it's probably one of those plugins that did it. How do I check if it is actually trying to connect to the internet or not and which part of the code did it? Thanks.
Answer by Hullu · Sep 22, 2015 at 01:26 PM
Thanks for the answer. I actually have read that, but that's not exactly what I have in $$anonymous$$d. What I was asking is how do you make a game to not eat lots of power from the device's battery? $$anonymous$$y game has been optimized pretty well and can run smoothly around 40-60 FPS. But it turns out, it sucks up the battery of the device like Cookie $$anonymous$$onster eating up cookies. In 45 $$anonymous$$utes, the battery dropped like 30 - 40%. And it became very hot.
In many cases, game engines try and get all the performance they can out of available resources on the device (computer, phone, etc.).
If you cut back on scene and script complexity, the game will attempt to run at the highest framerate possible (unless vertical sync or other means are capping it). If you increase scene and script complexity, the game may run poorly and still be working the device. There's no answer which can satisfy all circumstances, really.
For a phone, it's a combination of the engine and script processing, the video processing, and the backlight on the screen which all drain away the battery life. Simultaneously, you're working it hard, so the electronics heat up.
There's not any simple solution to offer without knowing what kind of game you're making. The only advice I can offer, essentially, is to lighten the computational workload (scripts), the visual workload (any complex shaders or large polygon counts) and the final workload, as necessary (framerate).
That said, when you say your game runs around 40-60 FPS, that means you're working it to the fullest and it's not exceeding a potential 60 FPS threshhold that you'd have processing power to spare. If it ran at a constant 60 FPS, you would more likely have processing power to spare and, therefore, not be working it as hard.
Agree with @$$anonymous$$o $$anonymous$$haon - if your frame rate is varying, your phone is maxing out the resources it has, desperately trying (but failing) to maintain 60fps.
What happens if you explicitly limit the application targetframerate to 30? You should see battery life improve.
Ok, I'm accepting this because of the comments. Thanks guys.
Answer by JamsCenter · Apr 20, 2020 at 03:01 PM
Just saying, if you game run at 40-60 fps it is not optimized.
With Gear VR and Oculus Quest we need 60+fps minimum to be accepted to store and contest.
There are hundred of ways to make run your game on an potato with Unity.
Most of those way are "pain in the ass" and affect the quality of your game rendering.
- Don't use lighting
- Don't use shader without knowing if they are optimized and useful to your game
- Don't use shadow
- Don't underestimate the garbedge collector by recycling you object - Reduce batching the maximum you can - ...
If you do that your game will be ugly as hell (and will take your 2-6 times more to do it). So you need to be creative and use art design choose to make your game beautiful.
But it will run at 60+ on a potato leading to not overheat and significant less power consumption.
Here are for example a video talking about it:
https://www.youtube.com/watch?v=w0n4fuC4fNU&t=4s
Hope it helps people that will fall on this post ;).
May the code be with you.