Streaming is available in most browsers,
and in the Developer app.
-
What’s new in Game Center: Widgets, friends, and multiplayer improvements
Power up your online gaming experience with GameKit and adopt features like multiplayer, leaderboards, and achievements in your game. We'll take you through the latest improvements to Game Center, including player matching and multiplayer APIs, and explore how you can boost discovery of your game.
Resources
Related Videos
WWDC22
WWDC21
WWDC20
-
Download
♪ Bass music playing ♪ Ally Kazmucha: Hi, I'm Ally, and I'm the engineering program manager for Game Center.
I'm really excited to spend some time walking you through all the improvements we're making this year.
We also launched some great new features this spring like Friends API, which we'll be talking to you about as well.
But before I get into some of those details, I'd like to briefly talk about some of the core features Game Center offers, many of which were completely refreshed last year.
Game Center is Apple's own social gaming network.
As a developer, you can take advantage of whichever Game Center features make sense in your game through our GameKit framework.
For players, Game Center Is a single gaming ID that allows them to instantly compete on leaderboards, track achievement progress, play multiplayer games together, and even check out their friends' profiles.
Helping players find and discover great new games is also one of the primary goals of Game Center.
We added quite a few features in iOS 14 to help with game discoverability, and we're adding even more this year.
Games are all about community, and keeping up with what our friends are playing is a great way to discover new titles we may have otherwise missed.
That's why we integrated Game Center directly with the App Store last year.
We now show more information on what your Game Center friends are up to, through both the Games and Arcade tabs of the App Store.
Let's take a closer look.
While browsing the Arcade tab, I can see that several of my Game Center friends are playing a few games that look interesting to me, including a new game called "Wonderbox." Let's check out the product page to learn more.
Not only can I read more about the game itself on the product page, I can also see a complete list of my Game Center friends who are already playing that particular game.
Tapping on one of them brings up their Game Center profile.
From here, I can see even more of the games they've been playing.
And if I see one I like, I can download it directly from their profile.
The Friends Are Playing section will automatically appear on the product page for all Game Center-enabled games.
There are, of course, opportunities outside of the App Store to check out a friend's profile as well.
For example, I can tap on a friend within any leaderboard -- like shown here -- to bring up their profile.
These are all great opportunities for players to find new games to play.
And there's nothing you have to do to make your game eligible either.
All Game Center-enabled games automatically show up in both Friends Are Playing and Recently Played.
This fall, we're also adding two new Game Center-powered widgets.
The first is -- you guessed it -- Friends Are Playing.
We think this is going to be an even easier way for players to keep up with and discover more of the games their friends are playing, right from their home screen.
The second widget is called Continue Playing.
This widget automatically resurfaces games you've already launched and played.
So you can jump right back in where you left off with a single tap.
And if you're on an iPad, both of these Game Center widgets support the new larger format as well.
And just like Friends Are Playing and Recently Played, there's no additional code needed or feature to adopt.
If your game supports Game Center, it's automatically included.
And since friends are such an important part of social play, we're making some significant improvements to both our friending and multiplayer flows too.
First up, friends.
Game Center friend requests will continue to be sent through Messages just like they are today.
But just in case you miss one, we've added a brand-new Friend Requests inbox to let you manage them all in one place.
We've also made some great improvements to the flow within Messages, including support to send and receive friend requests on MacOS.
But as a developer, you're probably most interested in what you can do with Game Center friends.
And that's where Friends API comes in.
Friends API gives you privacy-friendly access to a player's Game Center friends, so you can create all kinds of unique experiences within your game.
Whether it's showing what level my friends are on in a progression map, or letting players launch missions together, all of these can now be accomplished by adopting Friends API.
Chee Han will be walking you through how to do just that.
So now that you know about some of the ways Game Center can help improve discoverability and connect players together outside of your game, let's look at some of the benefits Game Center offers within your game.
In iOS 14, we introduced a brand-new player dashboard you can add to your game through the Access Point API.
We also shipped an entirely refreshed UI -- virtually no screen went untouched.
With vibrant colors that match the underlying tones of your game, this refresh was meant to feel at home in any game.
You can also choose to use a combination of our native Game Center UI alongside any custom UI that best fits within your game.
For example, showing current leaderboard scores within a level selection screen -- or even as a live indicator while playing a level -- are all examples that make sense to be themed in a UI that matches your game.
While not in a level, you can still choose to give players access to all their Game Center data through the access point -- like shown here.
This just gives your players even more ways to keep up with and interact with their Game Center rankings and achievements.
And if your game supports multiplayer, we've got some great updates here as well.
This year, we continued to focus on helping people connect and start playing a game together as fast as possible.
Now, when you start a multiplayer match, our new suggestions section also surfaces your existing Messages groups.
Tap a group, and the invite is sent within the Messages thread you already have going.
We also remember the Game Center friend groups you’ve played with and suggest them as well.
So one tap gets you back in the game with the same friends again.
We're also introducing a brand-new multiplayer API called "Fast Start." Zhehong will be walking you through some of the benefits of Fast Start and how you can implement it within your game.
Finally, we've also added controller support for all Game Center UI on both iPhone and iPad.
The best part: there's zero new API to adopt or versioning in Xcode required on your part.
Just press the Home button on any supported controller and the Game Center dashboard is instantly presented.
Press it again and you're back in the game.
While the Game Center dashboard and all the sections within it will be navigable by default, you will need to add controller support for your own UI.
And if you're interested in what else is new with controllers, be sure to check out the session titled "Tap into virtual and physical game controllers" to learn more.
Here's a look at the rest of the session.
First up, Chee Han is going to walk you through our friending improvements, including a detailed walk-through of Friends API and how you can implement it to leverage Game Center friends within your game.
And to wrap up the session, Zhehong will fill you in on everything multiplayer, including a walk-through of how we've streamlined the invite flow and how you can implement our new Fast Start API to speed up the process even further.
To get you started on Friends, here's Chee Han.
Chee Han Lim: Hi, I'm Chee Han.
I'm an engineer on the Game Center team.
One of the best parts of playing games is being able to share those experiences with your family and friends.
For some of us, it's about the competition; and for others, it's about the connection.
Game Center friends allows you to do just that.
So there are two capabilities that we will be focusing on today.
First, we have made it easy to enable players to send friend requests within your game.
Second, we have introduced some new APIs for you to leverage your player's friends list through Friends API.
First, let's talk about sending friend requests.
When your game is better when played together, it might make sense to encourage your player to make Game Center friends within your game.
We have introduced a new API to let you do just that.
In your game, you can have an Add Friends button on your UI, where we recommend you to use SF Symbols as a button image.
When your user presses on the button, you can call our friending API to allow your player to add friends within your game.
Let's see how we can do that in code.
When you call presentFriendRequestCreator FromViewController API, a message sheet will be presented with a real controller that you have passed in.
After your player finishes sending the friend request, we will dismiss the sheet and return the control to your app with an optional error.
That's it! With a few lines of code, you will be able to provide your player the opportunity to send friend requests without leaving your game.
And now, let's take a look at what you can do with all those Games Center friends.
The second feature we have added this spring is privacy-friendly API access to Game Center friends.
When a player launches your game and tries to use functionality for the first time that requires Game Center friends access, they will be prompted to allow or deny access to their friends list.
If allowed, we will return you a list of their bi-directional friends, which means the list will only contain their friends who have also granted access to your game.
We will also sync this permission for you across all their devices, and the user will only need to approve your request once.
So what kind of experiences can you create if your player allows you access to their friends list? Well, this will allow you to do things like, show what level my friends are on within a progression map, let me launch a mission together with my friends in the lobby, show a friends-only recurring leaderboard while we are playing a multiplayer game together, and much more.
Let us walk through what Friends API will look like from your player's perspective.
Your game will call an API to ask for permission to access the player's friends.
And the player will see a familiar system prompt where they have to decide to allow or deny your request.
And you will have the option to explain to the player why you are requesting friends access.
Once your player approves your request, we will return the list of friends who have also granted access to your game.
In this example, we will use a leaderboard to keep track of players' progression with the score that I have submitted to this leaderboard.
With the score submitted, I can utilize Friends API to show my friends on a progression map next to the level corresponding to their leaderboard scores.
This may look something like this within your own game UI.
You can see that my friends' progression is populated on the map, where I will know exactly where they are in my game.
Let's jump into how to create this UI with code.
We will need to do some setup before you can call Friends API.
First, you'll need to add NSGKFriendListUsageDescription to your info.plist.
This description will be displayed as part of the permission prompt to our player, as seen in the previous slide.
If the description is missing, all Friends API calls will result into an error.
Once the description is set, you can now call the two new APIs in GKLocalPlayer class.
To check for friends list access, you should call loadFriendsAuthorizationStatus in GKLocalPlayer class.
You may want to call this in your app’s applicationDidFinishLaunching, and if the state is not determined, you may want to delay loading players' friends list until there is a good moment for you to show the permission prompt.
This will allow your player some time to make a decision once the prompt is presented.
You will receive GKFriendsAuthorizationStatus in one of the following four states within a completion block.
You can refer to GKLocalPlayer header for a detailed explanation of each state.
When returned state is denied or restricted, if you have previously collected data for this player, you should delete the collected data on your end.
If your player chooses to grant you access with an authorized state, you will then be able to proceed to load their friends list by calling loadFriends API.
Let's take a look at that now.
In this code, we will leverage the power of Swift async call, to simplify our calls to GameKit framework.
We will start with an async method with the name loadFriendsOnProgressionMap.
First, we will call loadFriends API in GKLocalPlayer class.
GameKit will return your player’s friends as an array of GKPlayer objects.
Next, we will load our progression leaderboard from GameKit with the leaderboard ID "progress." Once we have the leaderboard object, we can then pass in your player’s friends to loadEntries method.
You will obtain the score they have on that leaderboard, which is used to keep track of which level they are in now.
With that, we have all the information we need to display your player's friends on the progression map.
And that's it! You have now successfully integrated Friends API in your game and displayed your player's friends on a progression map.
We are super excited to see all the amazing experiences that our developer community will come up with using this new feature.
And with that, I would like to turn it over to Zhehong.
He will tell you all about the great changes we have made to multiplayer this year.
Zhehong An: Thanks, Chee Han.
Hi everyone, I am Zhehong from the Game Center team.
I cannot wait to introduce all the new features and improvements in Game Center multiplayer this year.
We have made significant improvements to Game Center multiplayer, as Ally mentioned previously.
The main purpose behind all of these changes is to help your players find people to play with and get into a game as fast as possible.
Game Center multiplayer UI allows many different ways for players to find people to connect and play with.
This includes automatching with other players or sending invites at once to multiple friends, contacts, nearby players, a phone number or an email address, Game Center groups, or Message groups.
It dramatically reduces your efforts to show different people from different sources.
As you might know, automatching is the mechanism which helps your players find each other from Game Center's matchmaking pool.
I will walk through the other new concepts in the following slides.
To bring better suggestions to the players, we have introduced the Suggestions Shelf containing a list of people from within and without Game Center that your players might want to invite.
It contains nearby players, Game Center groups, and Message groups.
A Game Center group, which is a new concept we have introduced this year, is a group of players you recently played with in real-time or turn-based matches.
We believe this new feature will make it fairly easy for players who want to play a game repeatedly with a certain group of people, because this makes it possible to select all the players in that group with just a single tap.
And we are leveraging the people you already talk to on a regular basis over iMessage with Message Groups.
A single tap will select an entire Message Group, and the invitation uses your existing group chat.
Now, you can not only send invites faster via Messages, but also chat about a game afterwards.
Once you have selected the people you wish to invite, tap the Send button at the top right, and you will see them in the lobby.
We now have the capability for adding or removing players even after the initial invitations have gone out.
For example, you may want to remove some invited players who are not able to respond, but you don't want to remove other players who have already accepted.
So, we have made it possible to individually remove invited players by tapping on the X button in their player slot, as long as they have not accepted yet, or they leave the game after they have accepted.
And players can continue inviting more people to your game, which gives them a lot of flexibility to quickly craft the right group of people to play with.
All of this greatly simplifies and streamlines the experience by making it much easier for players to play your multiplayer game faster and easier than ever.
Making it easy for players to invite people they know in turn helps increase your game's discoverability.
As you can see, if you leverage Game Center multiplayer UI, you get all these awesome features for free.
To make it even quicker to start a multiplayer game, we added a new API this year called "Fast Start." If you adopt Fast Start, the game initiator will have the choice to either wait for everyone to be connected or begin a game as soon as the minimum number of invited players have connected.
It gets players much faster from Game Center UI back into your game UI.
Meanwhile in the background, Game Center will continue connecting the rest of the players and automatching any unfilled player slots.
All these players will be able to join your game when they connect.
If your game can support players joining a multiplayer session at different times, then you can take advantage of Fast Start via Game Center UI.
You can utilize this feature to make some warmup game scenes as well.
The best way to see this in action is to show you an example.
Here, we are using a game called "The Coast," which leverages Fast Start.
You will see how powerful it is to utilize Fast Start to build your game.
First, I present GKMatchmakerViewController with a GKMatchRequest, configured with 2 minPlayers and 5 maxPlayers.
In this way, the game can start as long as two players are ready, including the local player.
Then I tap the Invite Friends button to launch the player picker.
I pick the players I want to invite, and I wait for them to respond.
As you can see, once an invitee accepts, the Start Game button is highlighted, so I can either start a game or wait for other players to join.
I decide to start, and the gameplay begins as soon as the matchmaker view controller is dismissed.
Since this game initially started with two players, you can see two boats.
Meanwhile, Game Center is still connecting in the background.
Once the third player joins, the game is notified, and we bring up the third boat.
Because we also had two automatched slots, Game Center is still automatching in the background.
After the matchmaking process is finished, two automatched players join.
Now, we have a full set of five players for this game.
As you can see, by adopting Fast Start, different players will be able to join the same game session at different times.
Finally, let's look at the code you need to add to accomplish what we have just walked through together.
To construct a GKMatchmakerViewController with Fast Start mode turned on, simply set its property canStartWithMinimumPlayers to "true".
Please note: the minPlayers of the GKMatchRequest is the minimum number of players that the gameplay in your game needs to start.
Set the delegate after you get the GKMatch instance, so that you can know the connection status of the players in the match.
And didChangeConnectionState is the delegate method where you can handle players who join later.
On the invitee side, just present the GKMatchmakerViewController initialized with the GKInvite instance.
This is probably the same as what you are doing today.
And don't forget to set the matchmakerDelegate.
That's pretty much about it.
We are excited to see how you adopt not only Fast Start, but all the new features and improvements we are providing this year for multiplayer.
To recap, here is what we covered today.
We introduced how Game Center helps increase the discoverability of your game.
After that, we talked about Friends API along with some general improvements to Friends.
Then all the multiplayer features and improvements we just talked through help your players play multiplayer games with people they know, as fast as possible.
And also, we have better support for controllers this year.
At the bottom, you will see another two sessions which you might be interested in.
They're about recurring leaderboard and game controllers.
Thank you all for watching.
Enjoy your week at WWDC.
♪
-
-
8:23 - Friending API
// Call Friend Requests API to present friend request view from a view controller, when player click on Add Friends Button in your game let error = GKLocalPlayer.local .presentFriendRequestCreatorFromViewController(using: navigationController) if error != nil { print("Fail to send friend request with error: \(error!.localizedDescription).") }
-
11:47 - loadFriendsAuthorizationStatus
// Checking authorization GKLocalPlayer.local.loadFriendsAuthorizationStatus { (authorizationStatus, error) in guard error == nil else { // Error handling print(“Fail to load friends list with error: \(error!.localizedDescription).”) return } // Handle GKFriendsAuthorizationStatus switch authorizationStatus { case .notDetermined: // Player have not made a choice on friends list sharing case .denied: // Player have denied your request to access their friends list case .restricted: // You should delete collected player data from your end case .authorized: // Player have authorized your request to access their friends list } }
-
12:53 - loadFriends
func loadFriendsOnProgressionMap() async { do { let friends = try await GKLocalPlayer.local.loadFriends() if friends.count > 0 { let leaderboards = try await GKLeaderboard.loadLeaderboards(IDs: [“progress"]) if let leaderboard = leaderboards.first { let entries = try await leaderboard.loadEntries(for: friends, timeScope: .allTime) for entry in entries.1 { let avatar = try await entry.player.loadPhoto(for: .normal) let name = entry.player.displayName let friendLevel = entry.score // Display player on progression map } } } } catch { print("Error: \(error.localizedDescription).") } }
-
20:17 - Enable Fast Start Mode
// Set canStartWithMinimumPlayers to true to enable Fast Start mode let request = GKMatchRequest() request.minPlayers = 2 request.maxPlayers = 6 request.playerGroup = 2021 let vc = GKMatchmakerViewController(matchRequest: request) vc.canStartWithMinimumPlayers = true vc.delegate = self self.present(vc, animated: true, completion: nil)
-
20:39 - Handle Players Who Join The Game
// Set the GKMatch delegate and present your game scene when didFindMatch is called func matchmakerViewController(_ viewController: GKMatchmakerViewController, didFind match: GKMatch) { viewController.dismiss(animated: true, completion: nil) let gameVC = GameSceneViewController() gameVC.match = match match.delegate = gameVC self.present(gameVC, animated: true, completion: nil) } // Add players who join later by implementing didChangeState delegate func match(_ match: GKMatch, player: GKPlayer, didChange state: GKPlayerConnectionState) { if state == .connected { self.addPlayer(player) } }
-
20:54 - Present GKMatchmakerViewController on The Invitee Side
// On the invitee side, present GKMatchmakerViewController with the invite func player(_ player: GKPlayer, didAccept invite: GKInvite) { if let vc = GKMatchmakerViewController(invite: invite) { vc.matchmakerDelegate = self self.present(vc, animated: true, completion: nil) } }
-
-
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.