如何将帧同步实现到 Android 游戏应用中。

huangapple go评论82阅读模式
英文:

How can I implement Frame Pacing into an android games app

问题

我是一名业余应用程序开发者,一直在调整我的一个项目,通过减少过度绘制、删除不必要的代码并确保屏幕更新仅在必要时发生来提高性能。我的应用程序运行良好,我没有发现任何错误,但是当我分析GPU渲染时,除了偶尔出现的无法解释的GPU峰值外,结果都很好。我一直在研究帧同步,但没有取得任何成功。我主要使用三星GS4设备进行测试,我遇到的问题是GPU渲染的一致性。在大多数情况下,令牌移动到新位置的动画是平滑的,我看不到任何问题,但是有时动画似乎会跳动。

GooglePlay的预启动报告显示,一些设备存在VSync错误/较慢的UI线程和较慢的绘制命令,但预启动报告中的大多数设备没有报告相同的性能错误。

我已经在YouTube和Google上进行了大量搜索,以获取实施帧同步(Swappy)的任何帮助,我也下载了Android开发者的“games/sdk”。我发现很难按照开发者的帧同步准则进行操作,而且我无法找到一个我能理解的帧同步示例。

https://developer.android.com/games/sdk/frame-pacing/opengl/update-build-settings

我使用的是Android Studio 4.0.1版本,Gradle 6.1.1版本,我的代码是Java,并包含了以下依赖项,这些依赖项没有被我的应用程序引用,我怀疑这些依赖项包含了解决我应用程序性能问题的答案。

// To use the Android Frame Pacing library
implementation "androidx.gaming:gaming-frame-pacing:1.5.0-alpha01"

// To use the Android Performance Tuner
implementation "androidx.gaming:gaming-performance-tuner:1.0.0-alpha01"

我希望我不需要学习C/C++,也不需要将我的代码转换为Unity,因为我刚刚开始熟悉Java。

如果能够提供有关如何将Swappy用于OpenGL的帮助、建议或示例,我将不胜感激。

英文:

I'm an amateur app developer and have been tuning one of my projects to improve performance by reducing overdraw, removing unnecessary code and ensuring screen updates only occur when necessary. My app works well and there are no bugs that I'm aware of but when I profile the GPU rendering I get good results with the exception of occasional unexplained spikes in the GPU profile display. I've been investigating Frame Pacing without any success. My main testing is done using a Samsung GS4 device and the problem I'm struggling with is the consistency of the GPU rendering. On most occasions the animation of the token moving to the new position is smooth and I can't see any problems but intermittently the animation seems to be jumpy.

The GooglePlay pre-launch report on some devices is indicating VSync errors / Slow Ui Thread and Slow Draw commands across a small set of devices, most devices in the pre-launch report do not report the same performance errors.

I've searched you tube and googled as much as I can for any help to implement Frame Pacing (Swappy) and I've downloaded the Android Developer "games/sdk". I'm finding it difficult to follow the developer Frame Pacing guidelines and I've been unable to find a Frame Pacing example that I can understand.

https://developer.android.com/games/sdk/frame-pacing/opengl/update-build-settings

I'm using Android Studio at version 4.0.1 with Gradle 6.1.1, my code is Java and includes the following dependencies which are not being referenced by my app and I suspect these dependencies hold the answers to the performance problems in my app.

// To use the Android Frame Pacing library

implementation "androidx.gaming:gaming-frame-pacing:1.5.0-alpha01"

// To use the Android Performance Tuner

implementation "androidx.gaming:gaming-performance-tuner:1.0.0-alpha01"

I'm hoping that I don't need to learn C/C++ or convert my code to Unity as I'm just getting comfortable with Java.

Any help or advice / examples to help implement Swappy for Open GL into my app would be appreciated.

答案1

得分: 1

来自谷歌的Android游戏团队,我是Will。

Android游戏SDK是专为C/C++和Unity游戏提供的解决方案,因此对于Java应用程序的帧速率同步无能为力,恐怕无法提供帮助。

我们建议查看Firebase性能监控工具:
https://firebase.google.com/docs/perf-mon/screen-traces
这将希望能够为您提供关于帧率卡顿出现的位置和原因的见解。

最诚挚的问候。

英文:

Will here, from the Android Games Team at Google.

The Android Game SDK is a solution for C/C++ and Unity games only, so it won't help you with frame pacing in a Java app, I'm afraid.

We suggest looking at the Firebase Performance Monitoring tool:
https://firebase.google.com/docs/perf-mon/screen-traces
This will hopefully give you insights as to where and why your frame jank is occurring.

Best regards.

huangapple
  • 本文由 发表于 2020年8月19日 15:00:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/63481604.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定