Graphics & Games • macOS • 29:36
Explore the features of Game Center and learn how to get started. We’ll show you best practices for implementing achievements, challenges, leaderboards, and activities to maximize your game’s discoverability, attract new players, and increase engagement. To get the most out of this session, we also recommend watching “Engage players with the Apple Games app”.
Speakers: Josh Arenson, Varokas Panusuwan
Downloads from Apple
Transcript
Intro
Hey everyone, I'm Josh Arenson, and I'm an Engineer on the Game Center frameworks team. Today, I want to show you the best ways to add Game Center to your game, and why you should! And I'm Varokas Panusuwan, a Game Center Server Engineer. I'll be walking you through the fun new features this year and sharing some best practices to make the most of them. That's right! We're also going to discuss some cool new things, so no matter your experience level, stick around!
If Game Center is new to you, or if you just need a quick refresher, it's a suite of features that helps players engage deeper in their games and discover new games through their friends. Game Center also makes it easy for players to connect and compete with their existing contacts, in keeping with Apple’s commitment to privacy.
Game Center offers a selection of features: Achievements, Leaderboards, Challenges and Activities. These help you create more engaging experiences. They let players track their progress, compete with each other, and easily invite their friends to play your game. If you want more players to see your game, the new Apple Games app, which comes pre-installed on macOS, iPadOS, and iOS starting this Fall, is the place to be.
Game Center helps you maximize your game's visibility across Apple's ecosystem, and especially in the Games app. Each Game Center feature you integrate gives the OS more information to show your game in more places. Game Center boosts player engagement with its core features: Leaderboards, Challenges, Activities, and Achievements. These give players goals and opportunities for social connections, keeping them invested in your game.
These core features help increase player retention. They make your game more fun and competitive, and that just makes people want to keep playing. When players are looking for new games, many of them start by browsing the App Store. The new "Top Played Games" chart tells players about the games receiving the most playtime.
The new Games app has this chart too, meaning Game Center gives your game an edge in both places! In both the App Store and the Games app, you'll find the "Friends Are Playing" section. While it's great to see what's generally popular, sometimes you want recommendations that are a little more you.
This section shows you what your friends are enjoying, which can be a great way to discover hidden gems that you might not find on the top charts. Game Center helps spark friendly competition! It sends push notifications, for example, when a friend steals your top spot on a leaderboard.
Project setup
Now that I've covered what Game Center is and the advantages it offers your game, let's get practical. Varokas and I are going to show you how easily you can add Game Center to your game, covering everything from project setup and configuration to testing your implementation and publishing to the App Store.
There are only two steps to get Game Center working in your game. First, add the Game Center entitlement to your project. This enables communication between your game and Game Center. Then, initialize GameKit – the framework used to communicate with Game Center. To add the Game Center entitlement in Xcode, you'll: open your project, navigate to the "Signing and Capabilities" tab, click "+ Capability", search for, and add "Game Center".
If you're using Unity, Apple provides a plugin that streamlines the process of adding the Game Center entitlement. Download the plugin from GitHub. The repo has instructions for building and installing it. Once you've installed the plugin, open the Unity Editor, navigate to the "Build Profiles" menu, and click "Build".
This will generate an Xcode project that already contains the correct entitlements. Once you've added the entitlement, it just takes a few lines of code to initialize Game Kit, the framework you use to interact with Game Center. Initialization is straightforward. You register a handler to be called when initialization is complete.
Once the handler executes, you'll have access to the GKLocalPlayer object, providing all the player information you need to report game progress. In this Swift code, I'm setting up the initialization handler. Once Game Center finishes initializing, the handler is called and GKLocalPlayer refers to a valid player. I've got some great news if you're a Unity developer: all GameKit APIs have C# bindings! Apple's Unity plugin lets you integrate GameKit directly from the Unity Editor. Here's that same GameKit initialization code, now in C#.
After your initiation handler is called, Game Center displays a banner to let players know that its features are available. If a player has never played any Game Center games before, they’ll be prompted to onboard using their Apple ID. To maximize your game's visibility, set your Game Center initialization handler as close to launch as possible. This helps your game appear in the Top Played Games chart and as a recommendation to other players.
For example, in "The Coast", a game I'm working on with Varokas, and my other colleague Logan, we set the handler to trigger right as the title screen appears – a great spot to do it. Once you've configured your initialization handler, you can enhance your game even further with Game Center's features: Achievements reward player milestones and give them something to brag about. Leaderboards and challenges drive competition and create new multiplayer opportunities, even in single-player games. Game Activities let you deep link players directly to specific in-game content. For example, jump straight to the level required to earn an achievement!
There are three main ways to configure these core Game Center features. First, new in Xcode 26, you can configure Game Center directly in Xcode using a GameKit bundle. This offers some neat benefits, can be synchronized with App Store Connect, and is the recommended approach for developers during game development.
Once you’re ready to launch your game, the App Store Connect website is helpful for getting it through the review process and spot checking your Game Center configuration. If you’re interested in automating any part of the configuration process, perhaps as part of your continuous integration workflow, the App Store Connect API is the tool to reach for.
GameKit bundles offer some tremendous advantages: new testing capabilities for your achievements, leaderboards, and game activities, directly in Xcode and completely isolated from your live game with the Game Progress Manager! Having this data declared locally also means your Game Center configuration is automatically included in code reviews and version control as well!
Integrate Game Center features
Last night, Varokas and I were working on our game, The Coast. He started to configure Game Center in App Store Connect, but I want to use a .gamekit bundle to integrate Game Center features which will streamline our development process. To add a GameKit bundle to my Xcode project, I just bring up the template chooser. In the search bar, type "GameKit". See the "GameKit Bundle" template? Select that, and hit Next.
Here I could choose a filename, but the default's fine. I click create, and Xcode adds the bundle to my project. Since I already have a few leaderboards, challenges, activities, and achievements in App Store Connect, I’ll pull my game’s information from there. I’ll click the ellipsis, select "Pull from App Store Connect".
Now I'll select my development team, find "The Coast", and click pull to fetch my game’s information. Once that’s finished, I can see everything I’d created in App Store Connect previously. Varokas and I decided to add a leaderboard to one of our levels, called "Cape Cod, in The Coast." In the Cape Cod level, players must quickly tap ships to guide them to safety and earn points. But beware! Some ships are actually sneaky lobsters in disguise. Tap a lobster by mistake, and the level ends! To add the leaderboard, I'll click the "+" button and select "Leaderboard".
Xcode asks me for a reference name and identifier. All of the things I create in Game Center have these two fields, and only developers see them. The identifier is how I’ll reference the leaderboard from my game’s code. I enter the values that Varokas and I already agreed on, and click "Add".
Now I can tune the leaderboard to match the needs of my game’s level. For now, the defaults are ok with me! Game Center automatically detects my player's locale and displays information in their native language. That's why it's crucial to prepare localized names, descriptions, and images for each language my game supports. I’ll click "+" to add a localization, enter the values Varokas and I discussed, and click "Add".
All done, my leaderboard is now ready to be called from my game’s code. Building on what we've covered, these same concepts can be used to create achievements, challenges, and activities. Now that you've seen how to configure your game for Game Center and implement its functionality, I'd like to hand things over to Varokas who is going to share his expertise! Thank you, Josh. I am excited to show you how to add two brand-new Game Center features to your game: Challenges and Activities.
Challenges and activities
Both of them are designed to help create new multiplayer experiences, and boost your game's engagement with players. Challenges instantly turn a single-player game into a social experience with friends. Challenges work right on top of any existing leaderboards that are already in your game. That means, you basically get two features for one. No additional code is needed at all! With challenges, players can invite their friends to compete for the highest score. They will see all the scores appear in real-time, see who gets crowned the winner, and can even start a rematch right from this same screen.
All challenges have a time limit. So players are motivated to jump into the game before the time is up! Challenges are related to leaderboards, but work a bit differently. A Leaderboard is an ongoing competition with all your Game Center friends. But a Challenge offers some important customization when it is created. While leaderboards are ongoing, a Challenge has a start and end time. The player who starts the Challenge can choose when they want to start the match.
They can also decide how long the challenge will last before time is up. A leaderboard includes all of a player's Game Center friends, but a Challenge lets them decide who gets to join. This also includes players not currently in their friends list. And they get to decide how many tries every player gets, making this a very personalized, mini-competition.
While your players customize how long they want a challenge to last, you have the option to decide what durations they can choose from. You can let them choose either 1 day, 3 days, a week, or any combination of those. Here’s the cool part! To enable Challenges for your players, you might not need to make any changes to your game at all. If you have a leaderboard in your game, you’re already using the submitScore() API to update the player's scores. Now, that same API also submits scores to all related challenges — automatically!
Since Cape Cod is the first level in The Coast, it's a really popular level. That makes it a great place to add a challenge. The first step, is to create the challenge metadata in Xcode. Just like every feature in Game Center, a Challenge needs an image that best represents it, along with a matching display name. Internally, you will also need an identifier to use in your game’s code, and a reference name to search for the challenge in App Store Connect. With all that in mind, I have prepared the image, display name, ID, and reference name for Cape Cod.
We already have a leaderboard set up in The Coast. All I need to do is check that the leaderboard ID in submitScore() is correctly set. Following the same workflow Josh showed you, I create the challenge in Xcode using the artwork and display name. Just to make sure, I check that the associated Leaderboard is set correctly to Cape Cod.
Here's where I can configure the durations the player is allowed to select. Since the Coast is a short, 1 minute game, I'm going to allow either one day, or three days. And that’s all it takes to implement a challenge. Make sure your challenge metadata is set up right, and if you already use leaderboards, there are no game code changes needed!
If your game has a recurring leaderboard, a related Challenge will work a bit differently. Remember that while leaderboards are ongoing, a recurring leaderboard has a definite start and end time. Here is an example of a daily recurring leaderboard, which started at midnight today and will end at midnight tomorrow. A Challenge that is associated with a recurring leaderboard will end at the same time as the current leaderboard instance. If I start a new challenge right now with Josh, we both have until midnight on Wednesday to compete before the challenge ends.
In this case, the challenge creation screen will show the amount of time left before midnight. Also, when a challenge is based on a recurring leaderboard, you can mark that challenge as non-repeatable. That means players only get one try. This can be helpful, for example, in a puzzle game. A daily puzzle challenge would work best as a non-repeatable challenge.
Players can create and look at challenges in many places throughout the Games app. You can also create your own UI to show all available and active challenges from within your game. Check out the documentation to learn more. Challenges are meant to level the playing field and give every player a fair chance. So, make sure you submit scores for leaderboards and challenges the recommended way.
For example, it's important to submit a new score at the end of each level. Here, I submit the score for "how many ships you saved" after each time the player attempts the level. Don't accumulate scores over multiple attempts. Avoid submitting a lifetime score, like "Total ships saved". This is meant to be a contest of skill, not a measure of how long each person has been playing the game.
Always keep in mind that the player who creates the challenge can decide how many attempts each player can make. Submitting a score only once at the end of each level is usually the right thing to do. So, double-check that you are not submitting scores more times than you intended to. I’ve now set up my challenge. I really want my players to start participating in this challenge easily. That’s where activities come in handy.
Activities is another new feature, which you'll use to add deep links right into the action in your game! Activities are specific destinations in your game. You can take players directly to these destinations with a deep link. A starting point for an activity is defined by associating other Game Center features with it.
For example, a leaderboard that submits scores at the end of level 1, can be associated with an activity that deep links to the start of that level. When players see this leaderboard in the Games app, they can tap "Play" to start the level directly. All challenges defined for that leaderboard are also associated with the same activity. So when players see the challenge for level 1 in the Games app, they can tap "Play", and start level 1. You can also use Activities to deep link to parts of your game associated with specific achievements, like a boss fight level.
And another great way to use activities, is to deep link players into real-time multiplayer experiences. With Game Center’s built-in party code support, you can integrate any existing real-time multiplayer system with Game Center activities. As you can see, there are many ways activities can help bring more players into your game.
Let me show you two examples today with the Coast: One for the Cape Cod challenge I just created, and another one for a multiplayer activity. I have already asked my friends to try my new Cape Cod challenge. Now I want to define an activity for this challenge, so this play button goes directly to the start of a level when they tap on it. Let’s start by defining the metadata.
For the Activity ID, I'll use "thecoast.activity". If I want to, I can add more details to the base activity. For instance, I can also say this activity is for a specific game mode in The Coast. I can then relate any leaderboards or achievements to an activity. But what about Challenges? Remember that challenges extend leaderboards. That means when you associate a leaderboard with an activity, challenges are automatically associated too. So, I will link the Cape Cod leaderboard to my new activity.
The associated item itself can also have properties. In this case, I added "capeCod" as a "level" value for the leaderboard properties. When this activity is triggered from the Cape Cod challenge, the base properties are combined with the leaderboard properties. With all the properties sent, I can inspect from the in-game handler that Cape Cod is the level to start. Now that I’ve got everything I need for an activity, I’ll put all the metadata values into Xcode.
Here I have already created a new activity with an image and display name. I can now set up the base activity properties in this section. To associate the Cape Cod leaderboard with the new activity, I select the leaderboard in Xcode and choose Cape Cod activity in this drop-down.
The leaderboard also needs to have the right properties defined, which I can do within this properties section. The metadata for my Activity is now set up and ready to go! There is only one piece missing - I need an in-game handler that will send a player directly to the Cape Cod level.
In the game code, I can now implement the player function from GKLocalPlayerListener. The activity instance passed in has a definition with an identifier I just set up in Xcode. After finding the right ID, I can take a look at the properties value, and now my player can start at the right level.
With activities, you can also use this convenient "setScore" function to submit scores. After you call to "activity.start()", every score submission is buffered. At activity.end(), Game Center only submits the player’s latest score once. This is helpful especially for challenges. This way, you are not likely to accidentally submit a score multiple times.
Deep linking from Game Center features, like Challenges, helps a player jump to the right place in the game. Now with multiplayer activities, players can jump into the game together with their friends! In the case of multiplayer activities, an activity will be tied to a party code, which you can integrate with your existing real-time multiplayer system.
When a player initiates a new multiplayer activity, Game Center automatically generates a party code. The player can now share this activity with their friends easily through iMessage. The Activity and the party code are shown as a web page on any device that doesn't have the Games app installed.
This web page also provides an OpenGraph tag to make sure it looks the best when shared. No matter how players shared the activity, Game Center lets your game know which party code each player uses to join. You can then connect everyone with the same party code together within your multiplayer system.
You would set up the activity metadata as you did before. There's only one difference, you need to check the option for "Supports Party Code." Everything for the in game handler is also the same. You can access the party code from the activity instance. Multiplayer activities also work with Game Center's current matchmaking solution. Just ask Game Center to find a match for this activity using the findMatch() function from the activity instance.
When you're creating an Activity, there are a few things to keep in mind. To make the most of deep link, be sure to bypass any introduction or game selection screen. Instead, take the player directly to the right starting point. If the place you’re linking to requires a payment or progression gate, be sure to pop up a message inside the game, to let the player know what they need to do to start playing. Clearly display the current party code in-game. This helps assure the player that they are in the right place.
There should also be an option for the player to enter the party code manually in the game. This helps in case the party code is received from a different device or platform. Now that I've implemented all these features in The Coast, it's time to test and make sure everything works. I will hand this back to Josh to show you how.
Test your implementation
Thanks, Varokas! I think activities and challenges would be a great addition to our game, but first I’d like to test the Cape Cod leaderboard I recently added. Just as a reminder, my leaderboard tracks the number of ships players guide to safety. Now, I can use the new Game Progress Manager to verify that my game's score-reporting logic for this leaderboard is working correctly.
To test my new Leaderboard, the first thing I need to do is edit my game’s scheme and enable GameKit configuration debug mode. It's under run options in the scheme editor. Once that's done, I launch my game from Xcode and open the Game Progress Manager from the Debug menu.
Next, I pick the device and game I want to test. I’ll select my iPhone and The Coast. All the achievements and leaderboards from my .gamekit bundle appear here, and I'll select the leaderboard I just created. From here, I can submit any score I want by clicking this "plus score" button.
I could submit a score on behalf of any player, but I'm going to submit 42 points for myself. This will make a banner appear in my game confirming it was received – a helpful feature that works when the game is in debug mode. Now, if I open the Cape Cod leaderboard, I can see the test score I just submitted.
What I really wanna check though is if my game is reporting scores correctly. I'll clear the leaderboard for now by clicking the clear button here, confirm that this is what I really want to do, and then I'll play my game for real and earn a score. Back in 'The Coast,' I guide as many ships to safety as I can.
Oops, tricked again by the lobster! I see the debug banner again, and the leaderboard in my game also shows the score I just earned – a good sign! The score showed up in Xcode too confirming my game's logic is correct! Worth mentioning is that these scores live entirely in this debugging session, they aren't submitted to the server. Now I'd like to test the GameActivity Varokas created earlier. Since it's associated with the Cape Cod leaderboard, I can see its deep link here in the Game Progress Manager.
Varokas already configured the link handler to start the Cape Cod level when this link is clicked. I click the link in Xcode, which has the same effect as clicking it on the device. I can see Cape Cod starts again, which means the link handling code is working perfectly!
Publish to App Store
Now that I’m sure everything is working okay, I’m ready to publish my .gamekit bundle to App Store Connect. I’m back in my Xcode project with my .gamekit bundle selected like before. I’ll click the ellipsis, but choose "Push to App Store Connect" this time. Again, I’ll select The Coast, and click "Push".
When it's done, I see everything I had in my .gamekit bundle on the App Store Connect website. Notice how everything says "Not Live"? This is a key concept in the Game Center lifecycle, and it's important to understand why things start in this state. Let's take a step back and look at the entire process, from creation to publication, to see how this 'Not Live' state fits in. This diagram shows the lifecycle of your game's leaderboards, challenges, activities, and achievements, from creation to publication. It's divided into three sections: Xcode for development and Game Center configuration, Test Flight for beta testing, and App Store Connect for releasing your game.
First, you have to actually make your game. Write the code and add some Game Center features using a .gamekit bundle. Then, thoroughly test everything you created using the Game Progress Manager. When you’re satisfied with your own testing, publish your game to TestFlight so your beta testers can have a turn.
Once you feel like everything is working correctly, submit your game to Apple for review. Make sure to include any 'Not Live' Game Center resources you wish to use with your submission. After Apple has reviewed and approved everything and you decide to launch, your Game Center resources become live and your game is published to the App Store!
Next steps
Congratulations! This is an exciting time for your game! Now, you should go add a .gamekit bundle to your game in Xcode. Whether you’re deeply integrated with Game Center, or a total newbie, it will make developing your game easier. After that, go add the code to initialize GameKit! Just by doing this, you make your game more visible throughout the operating system.
Activities and Challenges are new, and we think you'll find the value for the time invested to be well worth exploring, so go try them out! To make sure your games show up best in the Games app, check out my colleague Logan's video, "Engage players with the Apple Games app". And for Unity developers, the video on integrating Apple frameworks into your Unity projects is a must-watch! We're looking forward to playing the fun games I know you’ll create. Thanks so much for watching!