games

Optimizing display size

In the ChromeOS settings tool, users can change the display settings. For built-in displays, generally it is not possible to adjust the output resolution. Instead, the user adjusts the relative size of elements on the screen using the “Display Size” slider. The value shown under “Looks like” is in device-independent pixels⁠, and not raw pixel values.

"Display Size" slider in the settings

For external displays, users will have more options, normally being able to adjust both the output resolution and the size of elements on the screen.

External display setting options

What is important to remember as a game developer when working with the rendering engine is that the values returned by the Android APIs, like getSupportedModes() and getRealMetrics() will be in raw pixel values and not device-independent pixels.

For example, a device with a built-in screen with a raw resolution of 1920x1080 may show 1536x864 in the ChromeOS settings tool if the device’s screen has a density of 160dp. This is expected. If the “Display Size” is set to the default setting, this difference in pixel numbers does not mean that some of the pixels generated by a game rendering at 1920x1080 will somehow be lost - it is simply a different way of showing the same information with density taken into account.

If a user has the “Display Size” settings turned higher than the device’s real panel resolution, it is possible the Android API will return a seeming resolution higher than what can actually be rendered to the screen, resulting in poorer performance. For games, it is recommended that users set their “Display Size” to the default setting for maximum performance.

Performance

Games will likely be producing many more pixels on ChromeOS devices than on phones. If performance is not adequate, consider one of the following solutions:

  • Having a default game resolution ceiling, perhaps 1024 width or 1/2 of resolution returned by the Android API, whichever is higher, with a setting to allow the user to increase or decrease resolution in game.
  • Consider adjusting frame-rate: having a configurable 30fps/60fps setting and/or dynamic in-game heuristics that adjust the frame-rate based on current actual performance.
  • See performance profiling for more tips.