Android Game Development Kit를 사용하여 ANR 발생률을 35% 줄인 2K
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
배경

Cat Daddy Games는 워싱턴주 커클랜드에 본사를 두고 있으며 전체 지분을 소유한 2K 스튜디오이며 NBA 2K Mobile의 개발업체입니다.
팀은 특히 '애플리케이션 응답 없음'(ANR) 오류를 줄여 게임의 전반적인 품질과 안정성을 개선하고자 했습니다. Android 앱의 UI 스레드가 너무 오랫동안 차단되면 ANR이 발생합니다. 이 경우 UI 업데이트를 담당하는 앱의 기본 스레드가 사용자 입력 이벤트를 그리거나 처리할 수 없어 사용자의 불만을 초래합니다.
앱이 포그라운드에서 실행 중이면 시스템에서 사용자가 앱을 강제 종료할 수 있는 대화상자를 표시합니다.
진행한 작업
Cat Daddy에게는 ANR을 줄이는 것이 매우 중요한 과제였습니다. QA팀은 끊임없이 노력하여 일반적인 ANR 패턴을 정립했습니다. 앱이 일시중지되었다가 빠르게 재개되면 대량의 터치 입력이 ANR을 일으킬 수 있다는 사실을 발견했습니다. Firebase Crashlytics를 추가로 조사한 결과 이 ANR은 NBA 2K Mobile에서 가장 일반적인 ANR 유형인 android.os.MessageQueue.nativePollOnce 유형이었습니다.
Cat Daddy는 GameActivity의 입력 처리를 개선하면 이러한 유형의 ANR을 방지할 수 있다는 것을 확인했으므로 GameActivity로 이동하기로 결정했습니다.
GameActivity는 Android Game Development Kit의 구성요소로, 애플리케이션의 C/C++ 코드에서 앱 주기 명령어, 입력 이벤트, 텍스트 입력을 처리하는 데 Android 게임을 지원하도록 설계되었습니다. GameActivity는 Fragment
, SurfaceView
렌더링, 인기 게임 개발 관련 라이브러리 지원 등 NativeActivity
에 관한 여러 게임 중심 개선사항을 제공합니다.
또한 GameActivity는 입력 버퍼에 이중 버퍼링을 사용하므로 입력 볼륨이 큰 경우 게임에서 더 잘 처리할 수 있습니다.
결과
Cat Daddy는 GameActivity를 구현하여 게임의 입력 처리를 크게 개선하여 ANR 오류를 35% 줄일 수 있었습니다. 이는 사용자 환경을 개선하고 더욱 안정적인 게임플레이 환경을 만들었습니다.
또한 GameActivity는 FragmentActivity
에서 상속되므로 CatDaddy는 가장 많이 사용되는 일부 소셜 게임 통합에 필요한 EmbeddedWebView 및 EmbeddedVideoView도 통합할 수 있었습니다.
시작하기
GameActivity 및 Android Game Development Kit의 나머지 부분을 사용하여 자체 게임 환경을 개선합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2022-12-09(UTC)
[null,null,["최종 업데이트: 2022-12-09(UTC)"],[],[],null,["# 2K reduces ANR rate by 35% with the Android Game Development Kit\n\nBackground\n----------\n\nCat Daddy Games is a wholly-owned\n[2K](https://play.google.com/store/apps/dev?id=6681606924556273560)\nstudio based in Kirkland, Washington and the developer of NBA 2K Mobile.\nThe team wanted to improve the overall quality and stability of their games,\nspecifically by reducing \"Application Not Responding\" errors (ANRs). ANRs\noccur when the UI thread of an Android app is blocked for too long. When\nthat happens, the app's main thread, which is responsible for updating the\nUI, can't draw or process user input events, causing frustration to the user.\nIf the app is running in the foreground, the system displays a dialog that\nallows the user to force-quit the app.\n\nWhat they did\n-------------\n\nReducing ANRs has been a high priority for Cat Daddy. The QA team worked\nrelentlessly and nailed down a common ANR pattern: they found that when the app\nwas paused and then quickly resumed, a large amount of touch input could cause\nan ANR. Further investigation with\n[Firebase Crashlytics](https://firebase.google.com/docs/crashlytics) showed\nthat this ANR was of type android.os.MessageQueue.nativePollOnce, the most\ncommon type of ANR for NBA 2K Mobile.\n\nCat Daddy also saw that the improved input handling in GameActivity could avoid\nthis type of ANRs, so they decided to move to GameActivity.\n\n[GameActivity](/games/agdk/game-activity) is a component of the\n[Android Game Development Kit](/stories/games/games/agdk), which\nis designed to assist Android games in processing app cycle commands, input\nevents, and text input in the application's C/C++ code. GameActivity offers a\nnumber of game-focused improvements over `NativeActivity`, such as\n[`Fragment`](/reference/androidx/fragment/app/Fragment), rendering to a\n[`SurfaceView`](/reference/android/view/SurfaceView), and other support\nfor popular game development-related libraries.\n\nGameActivity also uses double buffering in its input buffer, allowing the game\nto better handle this case of high input volume.\n\nResults\n-------\n\nBy implementing GameActivity, Cat Daddy was able to significantly improve the\ninput handling of the game, leading to a 35% reduction in ANR errors. This\nimproved the user experience and created a more stable gameplay experience.\n\nAs an added bonus, because GameActivity inherits from\n[`FragmentActivity`](/reference/androidx/fragment/app/FragmentActivity),\nCatDaddy was also able to integrate EmbeddedWebView and EmbeddedVideoView,\nwhich were required for some of the most popular social game integrations.\n\nGet started\n-----------\n\nImprove your own game experience with [GameActivity](/games/agdk/game-activity)\nand the rest of the [Android Game Development Kit](/games/agdk)."]]