This plugin for Unreal helps you to reduce your game's power consumption by adjusting several settings if no input gets detected over some time.
What does the plugin do?
Every frame, the plugin checks how long it has been since the player made any input. After certain thresholds, it throttles the frame rate and the screen percentage to save energy, assuming that the player isn't actively playing the game anymore. If enough time has passed, the plugin can even disable the game's rendering completely, resulting in a black window. As soon as any input is noticed, the game returns to the previous settings, so it doesn't affect the actual gameplay experience.
Why is that a good thing?
Especially on handheld devices, reducing the power consumption can improve the player experience as the battery lasts longer. But it also helps to avoid overheating and reduces both the player's energy bill and the game's carbon footprint.
Why does this plugin exist?
Game development can be quite stressful and most games aren't shipped on time. Features that are not strictly necessary to ship are usually the first ones to get cut as the deadline gets closer. The idea behind this plugin is to make it easier for developers to make their games energy-efficient without having to find extra time for it in the production schedule. If you notice that the plugin is not doing that for you and you have any idea how to change that, please reach out to me.
How to use the plugin
After enabling the plugin, you can configure it using several cvars: EnergySaver.TimeThresholdForEnergySaving is the time after which the frame rate and screen percentage get throttled. EnergySaver.TimeThresholdForDisabledRendering is the time after which rendering gets disabled completely.
Both settings exist in two versions: PluggedIn and OnBattery, allowing you to use more aggressive settings in situations where power consumption really matters to the user. EnergySaver.MaxFps and EnergySaver.MaxScreenPercentage are the settings used while the energy saving mode is enabled.
EnergySaver.WhenWindowInactive controls whether the energy saving mode should also be enabled while the window is out of focus.
I recommend exposing these cvars as settings to the player, and have sensible defaults that make sense for your game.
When and how to disable the plugin
In typical gameplay situations, it's usually safe to assume after some time without input that the player isn't paying attention anymore. That is not the case during cutscenes, though. To avoid the energy saving mode kicking in during cutscenes, you can use the bIsEnergySavingAllowed property of the EnergySaver subsystem. Just set bIsEnergySavingAllowed to false when starting a cutscene and set it back to true afterwards. This property should only be used for temporary overrides. When giving the player the option to disable the energy saving mode, set the time thresholds to 0 instead.
Sources and further reading
The implementation of the energy saving mode leans heavily on this paper covering Fortnite's energy saving features, and I recommend checking it out. To learn more about the energy saving techniques used in this plugin and other possible improvements, check out my blog post about the topic.