开发团队通过多种策略解决了这些挑战,包括组建一支由经验丰富的消费类游戏开发者组成的团队来进行问题排查(因为他们在低级图形 API 或自定义引擎方面拥有丰富的经验),以及与 Google 和 Unity 团队合作来解决个别问题。为了扩大设备兼容性,测试涵盖了中高端设备(发布 2-3 年)和旧款高端设备,以确定建议的设备规格。
Vulkan 的优势
采用 Vulkan 为《Pokemon TCG Pocket》带来了诸多优势:
缩短了着色器编译时间:Vulkan 显著缩短了着色器编译时间,即使是大量着色器也是如此。例如,OpenGL ES 编译时间可能会超过 1 秒,但对于 Vulkan 渲染,这已不再是问题。
[null,null,["最后更新时间 (UTC):2025-05-16。"],[],[],null,["# Pokémon TCG Pocket: Adopting Vulkan-only development for casual games\n\nThe Pokémon Trading Card Game (TCG) has been enjoyed across the globe for nearly\n30 years. The recently released Pokémon TCG Pocket is designed to let players\nexperience Pokémon collections and battles anytime, anywhere, without the need\nfor physical cards. The game's accessibility on smartphones has contributed to\nits widespread popularity among users.\n\nWhile it may appear to be a casual trading card game, Pokemon TCG Pocket utilizes\ncomplex shaders, posing a significant challenge in reducing compilation time. To\naddress this and ensure high-quality graphics and a smooth gaming experience, the\nAndroid version of Pokémon TCG Pocket has embraced Vulkan, the next-generation\ngraphics API.\n\nThis document delves into the Pokémon TCG Pocket development team's adoption of\nVulkan, the challenges encountered, and the advantages Vulkan offers.\n**Figure 1.** Pokémon TCG Pocket game play scenes.\n\n#### Reasons for adopting Vulkan\n\nInitially, the Pokémon TCG Pocket development team planned to use OpenGL ES.\nHowever, they decided to adopt Vulkan, a graphics API with a promising future.\nThe primary reasons for choosing Vulkan were:\n\n- **Long-term app management**: Recognizing the trend of Vulkan becoming the dominant graphics API for Android, the team determined that Vulkan is the optimal choice for long-term app management.\n- **Stable performance on low-spec devices**: To provide a smooth experience for a wide range of users, stable performance on low-spec devices is essential. Vulkan's ability to reduce CPU load is expected to improve frame rates and battery consumption.\n- **Avoidance of large-scale post-release changes**: Switching from OpenGL ES to Vulkan after release would entail extensive modifications, potentially disrupting the user experience. Adopting Vulkan from the outset mitigated the need for such significant changes.\n\n#### Implement Vulkan with Unity\n\nPokémon TCG Pocket uses Unity as its game engine. Unity offers a streamlined\nprocess for implementing Vulkan with a single click. By using Unity, the\ndevelopment team seamlessly integrated Vulkan without requiring specialized\ntraining. Additionally, the lack of Vulkan-specific adaptations for development\nenvironments and tools contributed to cost-effectiveness.\n**Figure 2.** Auto Graphics API in Unity.\n\n#### Challenges in implementing Vulkan\n\nWhile Vulkan implementation was relatively straightforward, the development team\nencountered some challenges afterward:\n\n- **Device-specific issues**: Compared to OpenGL ES, some manufacturers' drivers exhibited lower stability with Vulkan, leading to device-specific issues.\n- **Incomplete Vulkan support in middleware**: Some middleware lacked full Vulkan support, requiring the team to wait for middleware updates.\n\nThe development team addressed these challenges through multiple strategies,\nincluding assembling a team of experienced consumer game developers for\ntroubleshooting (as they were well experienced in the low-level graphics API or\ncustom engine) and collaborating with Google and Unity teams for individual\nissue resolution. To expand device compatibility, testing included mid- to old\nhigh-end devices (released 2-3 years ago) to determine the\n[recommended device specifications](https://app-ptcgp.pokemon-support.com/hc/en-us/articles/39076135557145-What-is-the-recommended-smart-device-for-this-app \"Recommended device specifications\").\n\n#### Advantages of Vulkan\n\nAdopting Vulkan brought several benefits to Pokémon TCG Pocket:\n\n- **Reduced shader compilation time**: Vulkan significantly reduced shader compilation time, even for a large number of shaders. For example, the OpenGL ES compilation time could exceed 1 second, but this is no longer a concern with Vulkan rendering.\n- **Expanded range of supported devices**: Improvements in frame rate and battery consumption allowed for a wider range of supported devices, ensuring a smoother experience for more users.\n- **Better telemetry with Vulkan validation layers** : The [Vulkan validation layer](/ndk/guides/graphics/validation-layer) was very useful in identifying the root cause of problems, supplementing the data provided by Vitals ANR/Crash reports.\n\n#### Message to developers\n\nThe Pokémon TCG Pocket development team offers the following advice to\ndevelopers considering Vulkan for their projects:\n\n- Beyond shader compilation time reduction, Vulkan offers substantial performance benefits.\n- Using [vkQuality](/games/engines/unity/unity-vkquality) to fall back to OpenGL ES could potentially expand device support, even though Pokémon TCG Pocket is not using it yet.\n\n#### Conclusion\n\nBy embracing Vulkan, the Pokémon TCG Pocket development team was able to\noptimize graphics across a broad range of devices to ensure a smooth and\nengaging experience for every player. With ongoing feature additions and\nevolving future potential, Vulkan is expected to bring even more benefits\nover time."]]