iOS Developer Library — Prerelease

Developer

GameKit Framework Reference

Introduction

Classes   Protocols   Other Reference  

Game Kit offers features that you can use to create great social games.

Game Kit Features

Game Kit provides three separate pieces of functionality:

  • Game Center offers a centralized game service that connects players to each other. Game Center implements many different features:

    • Friends allow players to create anonymous online personas. Users connect to Game Center and interact with other players through an alias. Players can set status messages as well as mark other players as friends.

    • Multiplayer allows your game to create network matches that connect players through Game Center. Players can invite their friends or be connected to anonymous players. Most importantly, players can receive invitations to join a match even when your game is not running. Your game is running on each device and the instances of your game exchange match and voice data with each other.

    • Turn-Based Gaming provides store-and-forward network match infrastructure where the match is played out over a series of discrete turns. This kind of match can be played without requiring all of the players to be connected to Game Center simultaneously.

    • Leaderboards allow your game to store and fetch player scores from Game Center.

    • Achievements provide the ability to track a player’s accomplishments in your game.

    • Challenges allow a player to challenge other players to complete an achievement or to beat a leaderboard score.

    Game Center is available on iOS and OS X.

  • Peer-to-peer connectivity allows your game to create an ad hoc Bluetooth or wireless network between multiple iPhones in the same local area. Although designed with games in mind, this network is useful for any type of data exchange among users of your app. For example, an app could use peer-to-peer connectivity to share electronic business cards or other data. This functionality is only available on iOS. You can also get the same functionality using Game Center.

  • In-game voice chat allows your game to provide voice communication between two iPhones. In-game voice relies on your game’s network connection to another user to create its own network connection to transmit voice data. This functionality is only available on iOS. You can also get the same functionality using Game Center.

Classes

NSObject

NSObject is the root class of most Objective-C class hierarchies.

GKAchievement

Your game uses a GKAchievement object to communicate with Game Center about the local player’s progress towards completing an achievement.

GKAchievementDescription

An GKAchievementDescription object holds text and images used to describe an achievement.

GKChallenge

A GKChallenge object represents a challenge issued by a player to another player.

GKAchievementChallenge

A GKAchievementChallenge is a challenge to a player to complete a specific achievement.

GKScoreChallenge

A GKScoreChallenge object represents a challenge based on a score in a leaderboard.

GKChallengeEventHandler

The GKChallengeEventHandler class is used to respond to events related to challenges sent or received by the local player.

GKInvite

A GKInvite object represents a matchmaking invitation sent by another player to the local player.

GKLeaderboard

A GKLeaderboard object is used to read data from a leaderboard stored on Game Center.

GKLeaderboardSet

Add leaderboard sets to your app and organize your leaderboards into logical and coherent groups.

GKMatch

A GKMatch object provides a peer-to-peer network between a group of devices that are connected to Game Center.

GKMatchRequest

A GKMatchRequest object is used to specify the parameters for a new live or turn-based match.

GKMatchmaker

The GKMatchmaker class is used to programmatically create matches to other players and to receive match invitations sent by other players.

GKNotificationBanner

The GKNotificationBanner class allows your game to display a notification banner that displays text to the player.

GKPeerPickerController

The GKPeerPickerController class provides a standard user interface to allow one iOS device to discover and connect to another.

GKPlayer

GKPlayer objects provide information about a player on Game Center.

GKLocalPlayer

The GKLocalPlayer class is a special subclass of GKPlayer that represents the authenticated player running your game on the device.

GKSavedGame

A GKSavedGame object contains the metadata for identifying a saved game and a method for loading a previously saved game.

GKScore

A GKScore class holds information for a score that was earned by the player.

GKSession

A GKSession object provides the ability to discover and connect to nearby iOS devices using Bluetooth or Wi-fi.

GKTurnBasedEventHandler

The GKTurnBasedEventHandler class is used to respond to important messages related to turn-based matches.

GKTurnBasedExchange

A GKTurnBasedExchange object provides developers with a way to expand how turn based matches are currently played by allowing players to send information even when they are not the current player.

GKTurnBasedExchangeReply

Describes a GKTurnBasedExchangeReply object that contains a player’s response to an exchange.

GKTurnBasedMatch

The GKTurnBasedMatch class allows your game to implement turn-based matches between sets of players on Game Center.

GKTurnBasedParticipant

A GKTurnBasedParticipant object stores information for a participant in a turn-based match.

GKVoiceChat

A GKVoiceChat object provides a voice channel that allows a set of players in a match to speak with each other.

GKVoiceChatService

The GKVoiceChatService class allows your application to connect two iOS devices into a voice chat.

UINavigationController

The UINavigationController class implements a specialized view controller that manages the navigation of hierarchical content.

GKFriendRequestComposeViewController

Your game uses the GKFriendRequestComposeViewController class to present a screen that allows the local player to send friend requests to other players.

GKGameCenterViewController

The GKGameCenterViewController class aggregates many common Game Center features into a single user interface.

GKAchievementViewController

An GKAchievementViewController object provides a standard user interface to display achievement progress for the local player.

GKLeaderboardViewController

The GKLeaderboardViewController class provides a standard user interface that displays leaderboard scores to the player.

GKMatchmakerViewController

The GKMatchmakerViewController class is used to present a standard user interface to the player.

GKTurnBasedMatchmakerViewController

The GKTurnBasedMatchmakerViewController class displays a user interface that allows players to manage the turn-based matches that they are participating in.

Protocols

GKAchievementViewControllerDelegate

An object implementing the GKAchievementViewControllerDelegate protocol is called when the user dismisses the achievements view controller.

GKChallengeEventHandlerDelegate

You implement the GKChallengeEventHandlerDelegate delegate to control how challenges are displayed in your game.

GKChallengeListener

Provides methods for responding to challenge events.

GKFriendRequestComposeViewControllerDelegate

The GKFriendRequestComposeViewControllerDelegate protocol is implemented by delegates of the GKFriendRequestComposeViewController class.

GKGameCenterControllerDelegate

The GKGameCenterControllerDelegate protocol is implemented by delegates of the GKGameCenterViewController class.

GKInviteEventListener

Handles invite invite events form Game Center.

GKLeaderboardViewControllerDelegate

The GKLeaderboardViewControllerDelegate protocol is implemented by delegates of the GKLeaderboardViewController class.

GKLocalPlayerListener

The GKLocalPlayerListener protocol inherits the methods from GKChallengeListener, GKInviteEventListener, and GKTurnBasedEventListener in order to handle multiple events.

GKMatchDelegate

The GKMatchDelegate protocol is implemented to receive status updates and network data from players connected to a GKMatch object.

GKMatchmakerViewControllerDelegate

A class implements the GKMatchmakerViewControllerDelegate protocol to receive notifications from a GKMatchmakerViewController object.

GKPeerPickerControllerDelegate

The GKPeerPickerControllerDelegate protocol is implemented on an object to customize the behavior of a GKPeerPickerController object.

GKSavedGameListener

Override the methods in the GKSavedGameListener protocol to provide custom actions when a saved game file is modified or a conflict is found.

GKSessionDelegate

An object implements the GKSessionDelegate protocol to control the behavior of a GKSession object.

GKTurnBasedEventHandlerDelegate

The GKTurnBasedEventHandlerDelegate protocol is implemented by an object to receive notifications events for turn-based matches.

GKTurnBasedEventListener

Handles events for turn-based games.

GKTurnBasedMatchmakerViewControllerDelegate

Your game implements the GKTurnBasedMatchmakerViewControllerDelegate protocol on an object to respond to events generated by a GKTurnBasedMatchmakerViewController object.

GKVoiceChatClient

The GKVoiceChatClient protocol is implemented to control the behavior of the GKVoiceChatService object.

Other Reference

GameKit Constants Reference