| 1 |
## apple_game_center |
| 2 |
|
| 3 |
Integration with the https://developer.apple.com/game-center/[Apple Game Center]. |
| 4 |
|
| 5 |
To use this, you will need to configure your application integration with _Game Center_ on the Apple websites: |
| 6 |
|
| 7 |
* Login to https://developer.apple.com/ and create your App ID (if not created already) using the `qualified_name` like `io.castleengine.castlespine`. |
| 8 |
* Add _Game Center_ feature to your App ID (see the screenshot below): |
| 9 |
+ |
| 10 |
image::https://castle-engine.io/images/thumb_size/app_id_gamekit.png[Add GameKit to App Id,link=https://castle-engine.io/images/original_size/app_id_gamekit.png] |
| 11 |
|
| 12 |
* Login to https://itunesconnect.apple.com/ and configure the achievements, leaderboars in the _Game Center_ section of _iTunes Connect_. https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnectGameCenter_Guide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40013726[See the Apple documentation for the details]. |
| 13 |
|
| 14 |
Then from your Pascal code, you can use `TGameService` class from the `CastleGameService` unit to send achievements and more using the _Apple Game Center_. See the https://github.com/castle-engine/castle-engine/tree/master/examples/mobile/game_services[examples/mobile/game_services] example, in particular the code inside https://github.com/castle-engine/castle-engine/blob/master/examples/mobile/game_services/code/gameids.pas[code/gameids.pas] and https://github.com/castle-engine/castle-engine/blob/master/examples/mobile/game_services/code/gameviewplay.pas[code/gameviewplay.pas]. |
| 15 |
|
| 16 |
*Savegames in the cloud* work too. Use simple methods `TGameService.SaveGameSave`, `TGameService.SaveGameLoad` from Pascal code. Notes: |
| 17 |
|
| 18 |
* User must be logged into the iCloud, and have _iCloud Drive_ enabled, https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/GameKit_Guide/SavedGames/SavedGames.html[see Apple documentation]. |
| 19 |
* You must enable iCloud for your App ID in your https://developer.apple.com/ account. |
| 20 |
* You need to use an additional service `icloud_for_save_games`. In effect, in the application settings in Xcode, you should see that the _iCloud_ is active, with _iCloud Documents_ selected. Like on the screenshot below. (_You should not need to adjust them, the generated Xcode project should be already correct. The screenshot is only to allow you to make sure._) |
| 21 |
+ |
| 22 |
image::https://castle-engine.io/images/thumb_size/xcode_icloud_settings.png[Xcode iCloud Settings for Apple Game Center with savegames,link=https://castle-engine.io/images/original_size/xcode_icloud_settings.png] |