Chapter 16
Adding Leaderboards and Achievements

Social gaming is nothing new—people have been playing online games together for quite a while now. When you stop to think about it, social gaming is a great way to build a community around your game, which can help make your game more popular on the App Store.

But social gaming was a lot more complicated to set up than it is today. Players needed to find a way to connect with other players, and game developers often had to create a robust back-end system to handle the gameplay and synchronization of data.

Today, however, social gaming is a lot easier thanks to Apple’s Game Center network and GameKit framework. Game Center is Apple’s social gaming network. With Game Center, players can compare leaderboard ranks, earn achievements, and enjoy multiplayer gaming experiences. With GameKit, developers can make all of that possible.

In this chapter, you’ll learn how to add Game Center support to an already fully-playable mobile dice game. Introducing Hog Dice, shown in the following image:

images/AddingLeaderboardsAndAchievements/hog-dice-game.png

You’ll start by adding the Game Center capability and the GameKit framework. You’ll then set up an app in App Store Connect, along with some sandbox tester accounts. After that, you’ll set up a “most wins” leaderboard and a “first win” achievement for this game, and then you’ll return to Xcode to finish up.

The Game of Hog Dice

images/aside-icons/info.png

In Hog Dice, players take turns rolling a single die. As each player rolls, the player’s score increases by the number shown on the die. The first player to 25 wins. Players can roll as many times as they want, but if they roll a 1, they’ll lose the points they’ve rolled that turn.

Now, if you jumped ahead to Use App Store Connect to Add a New App so that you could finish building Gloop Drop while learning about monetization, you’ll notice many of the same things, like screenshots and explanations. Don’t worry, though; it’s only a few pages. Besides, it never hurts to review something you already know. With that in mind, you’re ready to add the Game Center capability to Hog Dice.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset