Tag Archives: GameDev

Improve Your Game with Texture Compression Format Targeting

Posted by Yafit Becher, Product Manager & Dan Galpin, Developer Advocate

Play Asset Delivery downloads the best supported texture for the device

Google Play Asset Delivery allows you to publish an Android App Bundle to Google Play containing all the resources your game needs. It offers multiple delivery modes, auto-updates, compression, and delta patching, all hosted at no cost to you.

As of today, you can use Google Play Asset Delivery to include textures in multiple texture compression formats in your Android App Bundle and Google Play will automatically deliver the assets with the best supported texture compression format for each device. With Texture Compression Format Targeting, you can start using ASTC for devices that support it while falling back to ETC2/ETC1 to devices that don’t. The Adaptive Scalable Texture Compression (ASTC) format offers advantages, such as improved rendering performance, faster load times, a smaller in-memory footprint, better battery life, and improved visual quality. You can even dramatically reduce your download size and on-device footprint by optimizing the tradeoff between size and quality.

Higher bandwidth version of much of this information

Android App Bundle will be the required publishing format for all new games and apps as of August 2021, which means that Google Play Asset Delivery will be required for new games that want Google Play to host more than 150MB of assets. Texture format targeting provides value even for smaller games due to the advantages of newer texture compression formats.

Texture compression

Texture compression is a form of lossy image compression that allows the GPU to render directly from the compressed texture using specialized silicon blocks, reducing the texture memory and memory bandwidth required to render the texture. As GPUs have gotten more advanced, more sophisticated texture compression formats have been developed, but not all GPUs can take advantage of them.

ASTC was released in 2012 to give developers more flexibility in trading compression size vs image quality. It compresses using fixed 128-bit block sizes, but allows for variable block footprints from 4x4 (8 bits per texel) to 12x12 (.89 bits per texel).

Texture compression format image  Texture compression format image Texture compression format image

Googleplex from Google Earth at 12x12 (.89 BPT), 6x5 (4.27 BPT), 4x4 (8 BPT)

This allows almost any type of texture to be used in compressed form, and allows for textures to occupy much less space in RAM — up to 36x less space compared to uncompressed 2D textures depending on quality. Smaller textures also take less time to load, making games start faster.

Memory bandwidth

Since the GPU needs to do fewer reads from texture memory in order to render the texture, the memory bandwidth required to render the scene is reduced, often substantially when texture caches are taken into account.

Texture compression formats in Android

The top compression formats in Android are ETC1, ETC2, and ASTC.

texture compression image

Top texture compression formats with device penetration as of September 2020

ETC1 is supported on practically all devices. It has no transparency support; games can use a second texture for the alpha component. It has quality issues with sharp transitions such as edges and text.

ETC2 is supported by all devices that support GLES3. It supports multiple transparency modes and improves quality compared to ETC1.

ASTC is a more recent format that's more flexible; it supports many different kinds of textures, allowing for just about any texture in your game to benefit from compression. In addition, it supports various block sizes with different associated compression ratios. Using this format is a good way to optimize the size, image quality, and performance of your game.

Asphalt Xtreme Gameloft image

When experimenting with ASTC on Asphalt Xtreme Gameloft found that they could reduce the size of their game by up to 30%

Using texture compression format targeting

Once you've implemented Google Play Asset Delivery in your game, adding texture format targeting is an incremental step. Inside your asset packs, make sure you have a directory that holds just your textures, such as [assetpackname]/textures. This directory will be used to hold default textures (probably in ETC1 or ETC2 format).

Then, create additional texture directories with a suffix representing the additional formats you wish to support.

[assetpackname]/textures#tcf_etc2
[assetpackname]/textures#tcf_astc

Finally, update your app build.gradle file to enable texture splits in asset packs:

// In the app build.gradle file:
android {
    ...
    bundle {
        texture {
            enableSplit true
        }
    }
}

Google Play strips off the texture suffixes so your game reads its assets from the default directory, regardless of what textures are delivered to the device.

If you're using Unity, our Play Asset Delivery plugin for Unity is ready to create app bundles with texture-targeted packs.

Texture compression format targeting is available now

We're committed to helping you serve your entire game through Play with customized dynamic delivery and features such as texture compression format targeting. Documentation at d.android.com will walk you through the integration process depending on the game engine you use, and we also have codelabs ready for both C/C++ and Unity games. We have more information on all of our game related developer resources at d.android.com/games and stay up to date with Google Play Asset Delivery and other game developer tools by signing up for the games quarterly newsletter.

Android GPU Inspector Open Beta

Posted by Jay Kong, Gaming and Graphics Product Manager

With the rollout of Android 11 on Pixel, Android GPU Inspector (AGI) has graduated from a limited developer preview to an open beta. During the preview, AGI has been helpful in finding performance bottlenecks for developers we've been working with, and we're looking forward to hearing your feedback.

What is Android GPU Inspector?

AGI is a graphics profiling tool that allows you to look into the GPU of Android devices to better understand graphics bottlenecks and optimize the performance of games and apps that leverage 3D graphics APIs. It shows a timeline of events for your running game or app, which includes system activities, high frequency GPU hardware counters, and, if you are using Vulkan, GPU activity information.

Android

What devices can I use it on?

AGI relies on updated firmware and video drivers to get information it needs; the first devices to support it are the Pixel 4 and 4XL running Android 11. While we are working with device manufacturers and SoC vendors to enable more supported devices, the key insight we’ve learned on our journey is that being able to look into the GPU—even on a single device—creates a lot of value.

Working with Blizzard Entertainment Inc. and NetEase, Inc., AGI helped pinpoint 45% vertex bandwidth savings for the upcoming Diablo Immortal, a dark gothic action RPG game.

Diablo:

Diablo: Immortal

Working with King, AGI helped improve GPU frame time from 11-16ms to a stable 8ms for the upcoming Crash Bandicoot: On the Run!, allowing the game to reduce battery drain and run faster for a smoother experience.

Crash Bandicoot: On the Run

Crash Bandicoot: On The Run

In collaboration with Jam City, AGI helped reduce GPU frametime by 45% on World War Doh: Real Time PvP.

World War Doh: Real Time PvP

World War Doh: Real Time PvP

Optimization tutorials

Stay tuned for more information on how to use the tool and address common issues we’ve seen when working with real games. We’ll begin by demonstrating using AGI to indicate optimizations to make in your game’s textures.

You can also read about this topic on Medium, here.

How do I get started?

You can download AGI here, and the setup instructions are here. AGI is in beta, so there will be issues. Check out the release notes, and let us know if you see any issues here.

To learn about new device support, you can check this page. Stay up to date with AGI and all of our game developer tools by signing up for the games quarterly newsletter.

Introducing Google Play Asset Delivery

Posted by Dan Galpin, Developer Advocate

Two years ago, we introduced the Android App Bundle, a new publishing format that allows Google Play to help optimize your app delivery. The app bundle is now Play’s recommended publishing format; with almost 50% of all top apps & games already using it.

It replaces the traditional monolithic APK at publishing time, allowing you to package all of your languages, screen densities and device architectures into a single artifact. The bundle itself can't be installed; Play takes care of generating APKs optimized for each requesting device from the single bundle that you publish.

Dynamic Delivery with App Bundle Produces Optimized APKs

Dynamic Delivery with App Bundle Produces Optimized APKs

Apps have seen great success with app bundles, but games often have different delivery challenges.

Today, large Android games rely on APK Expansion Files and custom Content Delivery Networks (CDNs) to deliver content. APK Expansion Files, also known as OBBs, support large resources but require you to maintain an additional publishing artifact, which causes many developer issues. Using CDNs for resource delivery often results in a suboptimal user-experience; users install and open the game just to face a long progress bar as they wait for additional resources to be downloaded. Users may also have to wait for updated resources, rather than having them delivered as part of the game auto-update. Finally, CDNs usually aren’t free, so this way of delivering game assets also involves extra cost that needs to be accounted for.

To handle the unique needs of games, Play is introducing Play Asset Delivery, giving you dynamic delivery of the right game assets to the right devices at the right time at no additional cost. To achieve this, we extended the Android App Bundle publishing format by adding asset packs.

The contents of an Android App Bundle with one base module, two dynamic feature modules, and two asset packs.

The contents of an Android App Bundle with one base module, two dynamic feature modules, and two asset packs.

Asset packs contain non-code game content such as textures, materials, and sounds. They are served from Google Play with large size limits that are ideal for games, and you can customize how and when each asset pack is downloaded onto a device.

Keeping assets up-to-date

Play Asset Delivery (PAD) lets you rely on Google Play to take care of updating your assets, just like it does with your game binary. When your app auto updates, the entire game gets updated, including all assets. When your users open the game, they will already have the freshest binary and assets, and they won’t need to wait for resources to get updated. Play also takes care of delta patching for you, minimizing the download size and the update time.

To handle cases when the user opens the game before it has had a chance to update, you can trigger updates within the context of your game with our In-App Updates API.

Play Asset Delivery engine support

  • Version 4.25 of Unreal engine supports building App Bundles with asset packs instead of APK expansion files and includes a plugin that provides function calls for managing downloads and requesting information from Play Asset Delivery.
  • We have built a Unity plugin that takes care of packaging your Unity Asset Bundles into asset packs and lets you build an Android App Bundle that includes them. The plugin is now available in our Package Registry and is compatible with Unity 2017.4 and higher.
  • For other engines, that Android Gradle plugin 4.0 release lets you combine your asset packs and your binary into an App Bundle. Just update your gradle plugin version and configure the delivery mode in the build.gradle file for each individual asset pack.

Customizing when asset packs are installed

You can customize when asset packs are installed according to three delivery modes: install-time, fast-follow, and on-demand.

  • install-time asset packs allow you to deliver up to 1GB of game assets as part of the initial game installation. To your app, this works like a large APK, with no need for expansion files or special API calls. Just package your assets in asset packs and publish to Play.
  • fast-follow asset packs are automatically downloaded as soon as the app is installed, allowing the user to start playing while important assets are still downloading. The app doesn't have to be opened for the download to start.
  • on-demand asset packs are downloaded upon request by the app.

Both on-demand and fast-follow assets are delivered as raw files and placed in your game’s internal storage. You can track download progress with the PAD API and access the assets directly using file system calls.

Extending Android App Bundle for Games

When using Play Asset Delivery, you get to take advantage of the App Bundle format, which allows Play to optimize the binary for the device, making it easier to support both 64-bit and 32-bit devices and different CPU architectures such as ARM and X86. We also want to help you serve the optimal set of assets to each device, and the first step in this direction is texture compression format targeting.

In an upcoming release of Play Asset Delivery, you'll be able to package textures in multiple texture compression formats, relying on Play to serve optimal assets per device model. This means you won't need to compromise by using suboptimal texture compression formats, and your users will always get the best assets suitable for their device without wasting network bandwidth or having suboptimal loading performance.

Better retention with an improved install experience

image of car racing from Asphalt 8 game by Gameloft

Asphalt 8 by Gameloft

Gameloft integrated Play Asset delivery into Asphalt 8, Asphalt Xtreme, and Minion Rush. Asphalt Xtreme was easy to switch from using APK expansion files to using PAD with install-time delivery. Asphalt 8 and Minion Rush both originally used a custom CDN, which Gameloft replaced with PAD. They were able to leverage fast-follow and on-demand delivery by replacing their custom CDN calls with calls to the PAD API. They saw the expected reduction in CDN costs, but with fast-follow delivery, they have also seen a significant increase in the number of users who completed the secondary download to start playing the game. This resulted in better user retention, with 10% more new players compared to their previous CDN asset delivery system. With the promising early results and seamless implementation process, Gameloft plans to use PAD in more of their upcoming releases. Read more about their experience.

Improved user experience with cost savings

Puzzle Kids - Animals Shapes and Jigsaw Puzzles game

Puzzle Kids - Animals Shapes and Jigsaw Puzzles by RV AppStudios

US-based developer RV AppStudios has over 200 million downloads to date across their portfolio of casual games, educational kids apps, and utility apps. Their Puzzle Kids app delivers over 23 MB of assets as players progress through the levels. When they switched from a third-party CDN to using Play Asset Delivery’s on-demand mode, they saw a 4.7% increase in 15-day retention and 21% reduction in crashes & ANRs. Overall, these changes helped improve the user experience by offering more stable, transparent, and secure downloads, while also saving costs for RV AppStudios. Read more about their experience.

Play Asset Delivery is available now

We're committed to helping you serve your entire game through Play with customized dynamic delivery. Play Asset Delivery, with the new app bundle format for games, along with its three delivery modes and updates + patching are all generally available. You can find documentation at d.android.com that will walk you through the integration process depending on the game engine you use.