Unreal Engine development on laptops. Tips to maximize battery life

 

Right when Unreal Engine 4 was released I promptly downloaded it on my Macbook Air.  Obviously I wasn’t expecting exceptional performance but where I was truly staggered was battery life.  When I started my battery was showing 9 hours remaining.  51 minutes later my machine died.  Wow.  Of course any machine running intensive CPU and GPU activity is going to drain fast, but for comparison, running Unity on the same machine lasted about 4 hours.  For developers like me, who are constantly on the go but not necessarily next to a plug, this is a bit of an issue.

 

The problem is that Unreal Engine editor is essentially an Unreal Engine game, running at nearly full clip.  The problem is, this is happening all of the time, even when you don’t need realtime rendering.  At the end of the day, Unreal Engine is designed to be run on a desktop machine, so power consumption is mostly an afterthought.  Fortunately there are some things you can do to maximize battery life.  Of course every single tip I am about to share comes at the cost of performance!  Generally though, this isn’t really all that big of a deal… you don’t need UE4 running at full speed if you are working on Blueprints or testing some new C++ code for example.

 

So, what follows is some tips to maximize your battery life as much as possible.

 

First let’s take a benchmark of battery usage.  This is Unreal Engine 4 running using the Twin Stick shooter example with the editor completely idle but focused.

Ss1

 

Obviously this value fluctuates based on being focused or not and various other factors, but it gives us a starting point.

 

Turn off Realtime Update

 

The easiest first step is to turn off realtime updating for your viewport.  In the top left corner of the viewport, drop down the menu and unselect Real Time Rendering.

Ss3

 

This setting prevents the viewport from constantly rendering, instead only updating when you change the view or update the scene.  You can use the hotkey combo CTRL+R or CMD+R to turn this off.  There is a similar setting when editing Blueprints as well.

 

 

Make sure Use Less CPU when in Background is selected

 

This one should be enabled by default, but lets make sure.  Go to Unreal Settings  (Unreal Editor->Preferences on Mac, File->Preferences on Windows), select Miscellaneous then under Performance verify that Use Less CPU when in Background is checked:

Ss4

 

This one does exactly what you would expect, when Unreal Editor isn’t in focus (isn’t the active application) it massively lowers the CPU consumption and thus battery usage.

 

 

Turn off Realtime Thumbnails

 

There is a nifty option in the content browser that it will generate realtime thumbnails of your assets.  This gives you quick previews of your models, textures, etc… but is also a pretty meaningless CPU sink.  You can turn if off by selecting View Options in the bottom corner of the Content Browser window and unselecting Real-Time Thumbnails.

Ss5

 

Set a Maximum Framerate

 

You can set a maximum rendering framerate for the viewport which can have a positive effect on CPU/GPU usage.  There are two ways to perform this action, one is temporary and the other will effect the editor every time you load it.

 

Temporary setting max framerate:

Hit the ~ key to bring up the Console

Enter “t.MaxFps 10″Ss6 

 

This will cap the framerate at 10FPS.  Play with this value to strike the best balance between performance and CPU usage.

 

Permanently setting max framerate

Open the config file ConsoleVariables.ini.  In my case on MacOS it is located at 

/Users/Shared/UnrealEngine/4.7/Engine/Config

Then locate [Startup] and add the line t.MaxFPS=10 below it.

Ss7

 

 

Throttle the CPU for the Unreal Editor PID

If all of these options don’t work enough, you can take the somewhat more draconian step of throttling the resources available to Unreal Engine.  If you are running a nVidia graphics card using Optimus, you can set Unreal to run using the Intel GPU instead of the nVidia, which should reduce GPU and thus battery usage.  You can also set the thread priority lower.  Here is an example with Mac OS.

 

First download and install cpulimit

Next locate the PID of the running Unreal Editor.  

You can get the PID from the terminal using the command 

ps -ef |grep “UE4Editor.app”

The PID is available in the results indicated below:

Ss9

 

Or you can simply locate it via Activity Monitor

Ss8

 

Now from a terminal enter the command sudo cpulimit —limit=30 —pid=numberfromabove —verbose

Ss10

This command will run in the terminal and hard limit the CPU available to Unreal Engine to 30%.  Obviously this is going to have a MAJOR impact on performance, but will also greatly limit battery drain too.  Obviously you can set the limit to whatever value you wish.  To stop throttling hit Ctrl+C in the terminal window.  As you can see from the results above, CPU throttling only has an effect if the CPU actually hits the specified threshold.

 

The Result

 

So, after all these tweaks… what is our current energy impact?

Ss11

 

Much much much better!  Less than 1/4 what it was!  That said, once you start doing things that require realtime feedback, you are going to want to undo everything you just did!  Thankfully it’s an extremely simple process.


Scroll to Top