Game Center now supports persistent player identifiers scoped to individual games or to a developer team ID. Understand how scoped identifiers enhance player privacy and see how to transition your apps and games onto the recommended API.
Hello. I'm Ben Harry from the Game Center Engineering team. In this presentation, I'm going to talk about Game Center player identifiers.
To get started, I'm going to give you a brief overview of what Game Center offers to the players of your games.
Game Center is a social gaming network that allows players to track their best scores on leaderboards, view their achievements earned playing your games, challenge their friends to complete an achievement or to beat a leaderboard score, and play either real-time or turn-based multiplayer games with their friends.
At the heart of Game Center games are the players.
Players are represented by objects that contain unique information that differentiate one player from another. The object used to represent Game Center players is the GKPlayer.
Every GKPlayer has a unique nickname accessed by the alias property.
A player may also choose an avatar image that will be used within Game Center UIs. In addition, each Game Center user has a unique static identifier that remains the same across all games that the player plays. You may use this identifier to store per-player information.
Let me now talk about how a player static identifier currently works in Game Center. You may already be familiar with this, but let us consider this example in case you need to refresh your memory.
Here we have two teams, Team A and Team B. In this presentation, I will be using the term team to represent a development team that releases a game to the App Store using App Store Connect. So, I have been playing two games from Team A and I also really enjoy the game from Team B. As we see, my static Game Center identifier is P123. Each of these games we'll see the same value from my identifier P123. No matter which game I play, I had the same static identifier. Going forward, we now want to increase privacy by introducing new player identifiers that are scoped to the either the team or the game itself.
So let's begin with the first of these new identifiers, the team player ID. Remember that team refers to the development team that releases a game to the App Store. Again, consider Team A and Team B along with the same games from before.
Notice that now I have two different identifiers. When I play either game from Team A, the value of my team player ID will be T11. When I play the game from Team B, the value of my team player ID will be T22. This means that the value of my team player ID scoped to the team that releases the game I play. This is an improvement to player privacy as Team A will only know my team player ID as T11, and Team B will only know my team player ID as T22.
So this is the team player ID. I now want to tell you about our other new player identifier, the game player ID.
The game player ID is unique per game per player. This means that my game player ID is unique to each game that I play. Its value is also independent from the team that releases the game. Let us go back to our familiar teams, Team A and Team B. As you can see here, my game player ID is different for each game that I play, regardless of which team has released the game.
To further show how a game player ID is independent from the team, let's consider the case when a game is transferred from one team to another. I am now going to show you what happens to my scoped identifiers when Game 2 is transferred from Team A to Team B.
Let's say Team A transfers ownership of Game 2 to Team B. Now, when I play Game 2, my game player ID for Game 2 remains unchanged.
My game player ID for Game 2 persisted with the game and is independent of the team.
Now, you may have also noticed something about my team player ID for Game 2. My team player ID for Game 2 took on the value for Team B since it is now released to the App Store by Team B.
So we have come to the scoping of the new Game Center identifiers and also what happens to these identifiers when game ownership is transferred.
I am now going to talk about how you may use the scope identifiers in the games that you develop.
As you have seen, we have added two new scope identifiers to the GKPlayer, the team player ID and the game player ID. The team player ID and game player ID have been introduced with the goal of increasing player privacy, which aligned to the Apple's commitment to protecting the privacy of our users.
This new identifiers replaced the existing static identifier or player ID on a GKPlayer.
The playerID property is now deprecated. So I encourage you to start using these new scope identifiers today.
As I mentioned earlier, the team player ID and game player ID have been introduced to replace the static player ID. If you don't query the player ID in your games, then you will not need to make any changes.
If you do query the player ID, you'll need to switch to the new scoped identifiers. You'll be using the team player ID in most cases.
Likewise, if you currently use the static player ID to save game data, you should move to the team scoped ID. Doing so will handle the situation in the device you shared by multiple Game Center players.
For those of you who may be persisting the static player ID in your own back end system, you should also update to the new scoped identifiers. You can do this any time after a successful authentication.
Next, let me show you how scoped identifiers look for their local player as compared to non-local players.
As you probably know, the GKLocalPlayer is the object that represents the authenticated Game Center player on a device. At any given time, only one player may be authenticated. And the GKLocalPlayer has a persistent team player ID and game player ID. But what about the GKPlayer? A GKPlayer object provides information about other players. These are non-local players and may be found in leaderboards recently played lists multiplayer matches and so forth.
The scoped identifiers for GKPlayers will be instance based on the context in which they are used. For example, their scope to each instance of a leaderboard or each instance of a multiplayer match, which means that you cannot count on them to persist in subsequent matches.
Let's say you have your own player accounting system. In which case, you'll be loading the corresponding GKPlayer objects. To do this, use the loadPlayersForIdentifiers: withCompletionHandler method found on GKPlayer.
You may use either the team player ID or the game player ID for the identifiers.
When you use the new identifiers, there is a very rare case where the scoped identifiers will not be available. So what should you do if the scoped identifiers are not available? Usually, when a player launches one of your games, the scoped identifiers for the local player will be available after successful authentication. However, there is a slim chance that the scoped identifiers may not be available. For this case, we've added a new API to GKPlayer. Scoped IDs are persistent. This property will be false if they are not available.
This means that you'll need to check this property before using the team player ID or game player ID for the local player.
So let's tie all this information together by considering an example of using the scoped identifiers after successful authentication.
As you know, when the authenticate handler returns, you need to check if Game Center has returned you a view controller. If so, then you present the view controller when convenient.
If there is no view controller and the local player has successfully authenticated, then you will be able to use the scoped identifiers after first checking the scoped IDs are a persistent value.
If you are persisting the player ID in your own back end system, now is when you should convert from the old static identifier to the new scope identifiers. I will now wrap up by summarizing what I have presented today. Game Center is introducing new scoped identifiers with the goal of increasing player privacy. A player's team player ID is scoped to your development team. A player's game player ID is scoped to a game and will persist with that game if it is transferred from one developer to another.
Use these new scoped identifiers in Game Center APIs as you will use the player ID. Both of these identifiers are available now so start using them today.
For more information on this presentation, please visit the link shown here.
Thank you for watching.
Looking for something specific? Enter a topic above and jump straight to the good stuff.
An error occurred when submitting your query. Please check your Internet connection and try again.