GameKit
Enable players to interact with friends, compare leaderboard ranks, earn achievements, and participate in multiplayer games.
Overview
Use the GameKit framework to implement Game Center social-gaming network features. Game Center is an Apple service that provides a single account that identifies players across all their games and devices. After players sign in to Game Center on their device, they can access their friends and use Game Center features you implement.
[Image]
Before you can use GameKit classes, you must enable Game Center in your project and initialize the local player in your code; otherwise, your game receives a GKError.Code.notAuthenticated error.
If you have an existing Unity project, you can access the GameKit framework using the Apple Unity Plug-ins.
Implement Game Center features
After you’ve enabled Game Center, you can implement many useful features to enhance the gaming experience.
You can add leaderboards that let players see how well they rank amongst friends and players all over the world. Create recurring leaderboards to organize regular competitions that provide players more chances to earn the top score. As players progress through your game, you can reward them with achievements that encourage them to keep playing.
GameKit supports real-time and turn-based multiplayer experiences. Players can choose automatic matching or invite their friends to join a game. You can support turn-based gaming in which a match plays out over a series of alternating turns, and players can receive invitations even when your game isn’t in the foreground.
GameKit also provides user interface components for your players to see highlights and access their Game Center data directly in your game. The access point provides a way for players to open a dashboard in which they can browse their profile, leaderboards, and achievements, as well as manage their friends list.
For designing Game Center features in your app, see Human Interface Guidelines > Technologies > Game Center.
Topics
Essentials
Initializing and configuring Game CenterAuthenticating a playerImproving the player experience for games with large downloadsGame Center Entitlement
Players
Connecting players with their friends in your gameSaving the player’s game data to an iCloud accountProtecting the player’s privacy using scoped identifiersGKLocalPlayerGKPlayerGKBasePlayerGKLocalPlayerListenerGKPlayerAuthenticationDidChangeNotificationNameGKPlayerDidChangeNotificationName
Game Center interfaces
Adding an access point to your gameDisplaying the Game Center dashboardGKAccessPointGKDialogControllerGKViewController
Leaderboards
Encourage progress and competition with leaderboardsCreating recurring leaderboardsAdding Recurring Leaderboards to Your GameGKLeaderboardGKLeaderboardSetGKLeaderboardScore
Achievements
Challenges
Creating engaging challenges from leaderboardsChoosing a leaderboard for your challengesGKChallengeDefinitionGKShowChallengeBanners
Activities
Real-time games
Creating real-time gamesFinding multiple players for a gameExchanging data between players in real-time gamesAdding voice chat to multiplayer gamesFinding players for custom server-based gamesMatchmaking rulesGKMatchRequestGKMatchmakerGKMatchmakerViewControllerGKInviteEventListenerGKInviteGKMatch
Turn-based games
Creating turn-based gamesStarting turn-based matches and passing turns between playersSending messages to players in turn-based gamesExchanging data between players in turn-based gamesGKTurnBasedMatchmakerViewControllerGKTurnBasedMatchGKTurnBasedParticipantGKTurnBasedEventListenerGKTurnBasedExchangeGKTurnBasedExchangeReplyGKGameCenterBadgingDisabled