Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In addition to the checks already listed in Optimize GDK games for handheld Windows devices, there are several other considerations a developer should keep in mind when developing their games to work on handheld devices.
Docked behavior of a handheld
Some handhelds might be played when docked. While there isn't a simple API to check if the handheld is docked, a docked device will likely have an external display attached. Developers can check for an external display by using the EnumDisplayDevices and EnumDisplaySettings APIs.
Note that there are many other ways to also determine that there are external displays.
When a handheld device is docked:
- Check for additional gamepads. The built-in one from the handheld will be there; however, the user might have connected additional gamepads.
- Check the screen sizes of attached displays.
- Virtual keyboard recommendations remain as the gamepad is still the primary input mechanism.
- Some players might connect a mouse and keyboard, just like they do on consoles.
Guaranteed input
While different gaming handhelds might have additional input options, developers can rely on gaming handhelds to have the following inputs:
- A, B, X, Y buttons
- Left and right bumpers
- Left and right triggers
- Left and right thumb sticks
- D-pad
- Menu button
- View button
While it was mentioned as something to check for when docked, in all instances, docked or not, developers should always make sure to check for all attached gamepads and input devices.
Power
Games wanting to know if the handheld is using AC power instead of the battery can call the GetSystemPowerStatus function. This function shows whether the device is using AC power and provides a summary of the battery charge state (high, low, critical, charging).
Developers should also consider the impact on battery life of the device, as it's not obvious how much power a given game might require. There are general recommendations on possible power savings in the Xbox Sustainability Toolkit, which can also apply to handhelds.
The biggest power savings come from:
- Enabling VSync to help the GPU have more idle time and save power.
- Reducing the internal rendering resolution and using an upscale pass.
- Reducing the frame rate to save power. This might impact the gameplay.
- Stop rendering the world when full screen menus or UI elements are shown (or when the game is paused).
- Pause the game when input idle is detected, in cases where the player has walked away.
Screen dimensions
While different gaming handhelds have varying screen resolutions, you can rely on the following:
- The screen size will be at least 7 inches.
- The screen will have an aspect ratio of either 16:9 or 16:10.
Developers wanting to know the screen size for a display physically integrated into the device can call the GetIntegratedDisplaySize function. This function will report diagonal screen size for the display physically integrated into the machine.
Handheld Experience Best Practices Samples
For more insights on building & optimizing your game for handheld devices, we have released two samples, a native C++ sample and a Unity managed C# sample. Both provide a similar set of best practices around how to leverage APIs to manage your games handheld experience easily.
- Determine if a device is a handheld.
- Determine if a device is running on battery power, charging or using external power.
- Look up device specific properties, including integrated display properties.
- Handle DPI changes and scale UI accordingly.
- Leverage Virtual Keyboards for text entry.
- Look up network devices & types.
- Determine network and Bluetooth connectivity.
- Handle input from Gamepad, Keyboard and Mouse.
- Determine input modality (i.e. latest input device used).
These samples will continue to be updated as Windows enhancements are made that are beneficial to Windows handheld gaming scenarios and as we gather feedback from game developers who build for these devices.
To acquire these samples, please see:
- Native C++ Sample: C++ Sample on GitHub.
- Unity Managed C# Sample: Unity Managed C# Sample on GitHub.