Play 게임즈 PC SDK를 사용하면 Google Play 서비스에 액세스하여 PC에서 게임을 빌드하고 수익을 창출할 수 있습니다. Play 결제를 사용하여 디지털 콘텐츠를 판매하고, Play 게임즈를 사용하여 원활하게 로그인하고, Play 무결성을 사용하여 사용자가 애플리케이션에 대한 유효한 권한을 보유하도록 할 수 있습니다.
게임의 시작 시퀀스 중에 SDK를 초기화합니다. 이는 사용자 상호작용 없이 자동으로 실행되어야 하며 게임 창을 렌더링하기 전에 초기화가 성공했는지 확인하는 것이 좋습니다.
이렇게 하면 가능한 한 빨리 오류를 표시하고 해결하여 최상의 사용자 환경을 제공하며 게임 프로세스를 종료해야 하는 경우 게임 창이 잠시 표시되지 않습니다.
GooglePlayInitialize를 호출하여 API를 초기화하여 SDK 사용을 시작합니다. 이렇게 하면 전역 상태가 설정되고, SDK 런타임과 연결되며, 애플리케이션이 올바르게 시작되었는지 확인합니다. 이 메서드는 다른 API를 사용하기 전에 호출되어야 하고(MUST) 연속 콜백이 InitializeResult::ok()이 true와 같도록 완료되어야 합니다.
// Initialize the SDK as part of the startup sequence of your application.autopromise=std::make_shared<std::promise<InitializeResult>>();GooglePlayInitialize([promise](InitializeResultresult){promise->set_value(std::move(result));});autoinitialize_result=promise->get_future().get();if(initialize_result.ok()){// The SDK succeeded with initialization. Continue with the startup sequence// of the game.// ...}elseif(initialize_result.code()==InitializationError::kActionRequiredShutdownClientProcess){// The SDK failed to initialize and has requested that your game process exit// as soon as possible.exit(1);}else{// The SDK failed to initialize for an alternative reason. It is still// generally recommended that you exit the game process as soon as possible,// because it won't be possible to access any APIs in the SDK. Critical// operations such as verifying the user owns a valid license to your game// won't be possible.// ...}
초기화가 kActionRequiredShutdownClientProcess 코드로 실패하면 가능한 한 빨리 게임 프로세스를 종료합니다. SDK의 런타임은 게임에서 추가 조치를 취하지 않아도 사용자를 지원하려고 시도합니다. 예를 들어 사용자에게 게임의 유효한 라이선스가 없는 경우 Google Play 게임즈에서 사용자에게 사본을 구매하라는 메시지를 표시합니다. 다른 오류의 경우 SDK를 사용하여 사용자가 게임의 유효한 라이선스를 소유하고 있는지 확인하는 등의 중요한 작업을 실행하지 않으므로 가능한 한 빨리 게임 프로세스를 종료하는 것이 좋습니다.
성공하지 못한 응답은 다음 조건 중 하나를 나타낼 수 있습니다.
SDK 런타임이 설치되지 않았거나, 기기에서 실행되고 있지 않거나, 게임에 통합된 SDK와 호환되지 않는 이전 버전입니다.
SDK 런타임에서 게임의 애플리케이션 ID를 확인할 수 없습니다. 개발 시 유효하지 않은 manifest.xml를 사용하거나 개발자 모드를 사용 설정하지 않고 SDK를 사용한 것이 원인일 수 있습니다. 이 경우 게임의 실행 파일은 Play 패키지 이름에 등록된 디지털 인증서로 디지털 서명해야 합니다.
게임 실행 파일이 Google Play 게임즈 클라이언트를 통해 실행되지 않았습니다.
Google Play 게임의 활성 사용자가 애플리케이션의 라이선스를 소유하지 않습니다.
5단계: (선택사항) 여러 게임 프로세스 지원
게임에서 여러 프로세스를 사용하고 Google Play 게임즈 PC에서 직접 실행하지 않는 프로세스에서 Play 게임즈 PC SDK를 사용하려는 경우 추가 통합 단계가 필요합니다.
이 예에서는 PC용 Google Play 게임즈(GooglePlayGames.exe)가 일부 예시 매개변수 (--foo=abc --bar=123)를 사용하여 게임 (YourGameLauncher.exe)을 실행하는 프로세스 계층 구조를 볼 수 있습니다. 그러면 게임에서 Play 게임즈 PC SDK를 사용하는 하위 프로세스 (YourGame.exe)를 생성합니다. 이를 허용하기 위해 PC용 Google Play 게임즈에서 실행한 게임 프로세스는 제공된 명령줄 매개변수를 하위 프로세스로 전달합니다.
게임이 실행 중지되면 모든 프로세스를 종료합니다.
사용자가 게임을 닫거나 SDK 초기화 실패(예: kActionRequiredShutdownClientProcess)로 인해 게임이 종료되면 게임에서 생성한 모든 프로세스를 닫습니다. 이렇게 하면 다음에 PC용 Google Play 게임즈 클라이언트에서 게임을 실행할 때 다른 활성 계정으로 전환하는 등의 새로운 변경사항이 적용됩니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-29(UTC)"],[],[],null,["# Power your game using the Play Games PC SDK\n\nWith the Play Games PC SDK you can access Google Play services to build and\nmonetize your game on PCs. Sell digital content using Play Billing, seamlessly\nsign-in using Play Games, and ensure your users have a valid entitlement to your\napplication with Play Integrity.\n\nReady to get started?\n\nPrerequisites\n-------------\n\n- Create an app entry inside of the Play Console and claim a Play package name.\n\n- Download and install\n [Google Play Games for PC](https://play.google.com/googleplaygames) and sign in with\n your Google Account.\n\n**Step 1**: Add the SDK to your project\n---------------------------------------\n\n| **Note:** The SDK officially supports C++. If you are using a programming language other than C++ please reach out to your Google Partner letting them know what game engine \\& programing language your application uses to see if we can better support you.\n\n- Download the [Play Games PC C++ SDK](/games/playgames/native-pc/downloads/cpp).\n\n- Copy the API headers folder `includes/` into your application's codebase.\n\n- Copy the redistributable files from `imports/` into your application's\n project.\n\n - Link your project against `play_pc_sdk.lib` allowing access to the contents of the `play_pc_sdk.dll`.\n\n**Step 2**: Add a manifest file\n-------------------------------\n\nBefore you can use the SDK from within your game you will need to\nassociate your game executable with the Play package name that you claimed\ninside of the Play Console. This done by adding a `manifest.xml` file in the\nsame directory as your game's executable.\n\nExample `manifest.xml` contents: \n\n \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n \u003cManifest version=\"1\"\u003e\n \u003cApplication\u003e\n \u003cPackageName\u003e\u003cvar translate=\"no\"\u003ecom.example.package\u003c/var\u003e\u003c/PackageName\u003e\n \u003c/Application\u003e\n \u003c/Manifest\u003e\n\nExample `manifest.xml` placement: \n\n C:\\Program Files\n └───Example Game\n ├───Game.exe\n └───manifest.xml\n\n**Step 3**: Digitally sign your game\n------------------------------------\n\n| **Tip:** Developers can skip this step during local development by enabling [developer mode](/games/playgames/native-pc/setup/developer_mode).\n\nBefore your game can use the SDK, the game's executable must be digitally signed\nusing an\n[Authenticode Digital Signature](https://learn.microsoft.com/en-us/windows-hardware/drivers/install/authenticode).\nFor instructions on how to sign an executable see the\n[documentation on the SignTool](https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool) .\n\n**Step 4**: Initialize the SDK\n------------------------------\n\nInitialize the SDK during the startup sequence of your game. This should be done\nautomatically without requiring any user interaction and it is recommended to\nverify a successful initialization before rendering your game window.\nThis provides the best user experience by surfacing and resolving errors as soon\nas possible and avoids your game window briefly appearing in cases where your\ngame process needs to exit.\n\nStart using the SDK by calling\n[`GooglePlayInitialize`](/games/playgames/native-pc/reference/namespace/google/play/initialization) to initialize the API. This\nwill setup global state, connect with the SDK runtime, and verify the\napplication was started correctly. This **MUST** be called and have the\ncontinuation callback complete with `InitializeResult::ok()` equal to `true`\nbefore any other API may be used. \n\n // Initialize the SDK as part of the startup sequence of your application.\n auto promise = std::make_shared\u003cstd::promise\u003cInitializeResult\u003e\u003e();\n GooglePlayInitialize(\n [promise](InitializeResult result) {\n promise-\u003eset_value(std::move(result));\n });\n\n auto initialize_result = promise-\u003eget_future().get();\n if (initialize_result.ok()) {\n // The SDK succeeded with initialization. Continue with the startup sequence\n // of the game.\n // ...\n } else if (initialize_result.code() == InitializationError::kActionRequiredShutdownClientProcess) {\n // The SDK failed to initialize and has requested that your game process exit\n // as soon as possible.\n exit(1);\n } else {\n // The SDK failed to initialize for an alternative reason. It is still\n // generally recommended that you exit the game process as soon as possible,\n // because it won't be possible to access any APIs in the SDK. Critical\n // operations such as verifying the user owns a valid license to your game\n // won't be possible.\n // ...\n }\n\nIf the initialization fails with the code `kActionRequiredShutdownClientProcess`\n**exit the game process as soon possible**. The SDK's runtime will attempt\nto assist the user with no additional action required by your game. For example\nif the user does not own a valid license to the game, Google Play Games will\nprompt the user to purchase a copy. For other errors it is still recommended to\nexit the game process as soon as possible as it won't to use the SDK to\nperform critical operations such as verifying the user owns a valid license\nto your game.\n\nA non-successful response may indicate one of the following conditions:\n\n- The SDK runtime is not installed, is not running on the device or is\n an older version not compatible with the SDK integrated into your game.\n\n- The SDK runtime was unable to verify the application identity of the\n game. This could be due to an invalid `manifest.xml` or using the SDK\n without enabling [developer mode](/games/playgames/native-pc/setup/developer_mode)\n when developing. Without this your game's executable is required to be\n digitally signed with the digital certificate registered to your Play package\n name.\n\n- The game executable was not launched through the Google Play games client.\n\n- The active user in Google Play Games does not own a license for the\n application.\n\n**Step 5**: (Optional) Supporting multiple game-processes\n---------------------------------------------------------\n\nIf your game uses multiple processes and plans to use the Play Games PC SDK from\na process that is not directly launched by Google Play Games for PC additional\nintegration steps are required:\n\n1. The process directly launched by Google Play Games for PC must\n verify a successful [initialization of the Play Games PC SDK](#step-4).\n\n This provides the best user experience by surfacing errors as soon as\n possible. Note that child-process using the SDK must also perform\n initialization in addition to the directly launched process.\n2. To use the Play Games PC SDK in a child-process forward the command line\n parameters to the spawned child-process.\n\n Example command line parameter forwarding: \n\n Processes hierarchy tree:\n\n GooglePlayGames.exe\n └───YourGameLauncher.exe --foo=abc --bar=123\n └───YourGame.exe --foo=abc --bar=123\n\n In this example we see a process hierarchy where Google Play Games for PC\n (`GooglePlayGames.exe`) launches the game (`YourGameLauncher.exe`) with some\n example parameters (`--foo=abc --bar=123`). The game then spawns a\n child-process (`YourGame.exe`) which uses the Play Games PC SDK. To allow this\n the game process launched by Google Play Games for PC forwards the command\n line parameters it was given to the child-process.\n3. Exit all processes when the game stops running.\n\n When a user closes your game or the game exits due to a SDK initialization\n failure, such as `kActionRequiredShutdownClientProcess`, close all processes\n your game has spawned. This makes certain that the next time your game is\n launched by the Google Play Games for PC client, new changes such as switching\n to a different active account will take effect.\n\nNext steps\n----------\n\nUse the SDK while developing in your IDE:\n\n- Enable [developer mode](/games/playgames/native-pc/setup/developer_mode)\n\nAdd Google Play PC features to your app:\n\n- Sell digital goods with [Play Billing](/games/playgames/native-pc/billing)\n- Measure your marketing with [Play Install Referrer](/games/playgames/native-pc/install_referrer)"]]