Lighting Up XCOM 2 on Android with Galaxy GameDev
XCOM 2 is a turn-based strategy game sequel to XCOM: Enemy Unknown. Originally developed by Firaxis Games, it has now been developed for Android, including all DLC and expansion packs, by Feral Interactive. As well as all of the original content, it has a new touch screen friendly interface for mobile devices. It is also the third game following GRID Autosport and Company of Heroes that Feral has released on Android that works exclusively on the Vulkan graphics API.
Samsung’s Galaxy GameDev team assisted the developers by making sure that any driver issues that they came across were fixed and also provided workarounds for existing drivers to ensure that the game could work ahead of any updates. We also made a number of recommendations to improve the performance of the title.
XCOM 2 is relatively unusual for a mobile title in that it uses deferred rendering in order to get the best lighting for the scenes. This is a common technique on the desktop and console, but until recently has been considered too slow to run on mobile. With the increasing power of mobile GPUs, Feral has shown that deferred rendering is now a viable technique on high-end devices.
In relation to this, one of our recommendations was about ensuring that the most appropriate buffer formats were used to get the best performance. Deferred rendering uses a number of intermediate buffers to store information for use when rendering the lights. On the desktop, it is common to use 16-bit floating point values for the colour channels in these buffers, resulting in a 64-bits per pixel buffer. On mobile, we recommend the use of smaller data types (11 bits red, 11 bits green, and 10 bits blue) which give a 32-bits per pixel buffer. This has a loss of precision but the range is still big enough to store the required values; and it halves the bandwidth required to read and write the buffer. Memory reads and writes take a noticeable amount of power, which is always limited on battery-powered devices.
As well as the straightforward bandwidth reduction gained by switching from 64-bits to 32-bits per pixel, a side benefit can be found on certain GPUs where they are also able to use additional buffer compression features on these smaller buffers, which isn’t always possible on 64-bit types. On Arm Mali GPUs this is AFBC (Arm Frame Buffer Compression) and on Qualcomm Adreno GPUs this is UBWC (Universal Bandwidth Compression).
Written by Lewis Gordon, Principal GameDev Engineer at Samsung Research UK