Power Management
Lots of players use mobile computers, powered with batteries.
So, to be polite, your game should respect power issues.
Here go the most important recommendations.
Limit FPS
For most games there's no need to use all the computational power of CPU. To reduce power consumption and thus make
batteries live longer, limit the FPS of your game using HGE_FPS
system state:
hge->System_SetState(HGE_FPS, 50);
Detect low batteries level
Use HGE_POWERSTATUS system state to
monitor the power status:
- HGEPWR_UNSUPPORTED value means OS doesn't support power status reporting and we can't help.
- HGEPWR_AC value means we have a constant AC power source and there's no need to worry.
- Values 0-100 reflect the current batteries level in case the computer is powered with batteries.
For example, to detect if batteries level is lower than 5% you may use the following code:
int pstatus = hge->System_GetState(HGE_POWERSTATUS);
if(pstatus != HGEPWR_UNSUPPORTED)
{
if(pstatus != HGEPWR_AC && pstatus < 5)
{
// warn player with an icon or message
// secure player's data
}
}
If you have detected batteries level lower than 5% it is recommended to:
- Warn player with an overlay icon or message
- Save all player's data and progress to prevent losses
Acknowledgement
We'd like to thank Intel Corp. and Victoria Zhislina, who kindly
helped us to implement the power management features in HGE.
|