Game Center: Leaderboard

My project Drop, which has been in development for almost a year, is being stalled due to various reasons. Pretty much stuck on the artistic side of stuffs, but it will be completed. Meanwhile I have already began work on another game project, one thats based on a much simpler premise and I foresee a development time of no more than a month.

For this new project I will be trying to integrate Apple’s Game Center into it, starting from a High Score┬áLeader board. Searching through some online tutorials, i managed to get it implemented, surprisingly pain free, thanks to the tutorial and the provided codes.

This is the tutorial I referred to : cocos2d + GameCenter by Ganbaru Games

Here’s the GameCenterManager Class provided :

Most of the codes in the manager class comes directly from Apple’s provided documentation, nathan of Ganbaru Games just compiled those codes into a singleton class with one additional check to ensure the class will not crash older device that does not support Game Center. He also added another array to store scores that failed to get sent to the Game Center server. This class is pretty much plug-and-play, you just need to decide when to call the reportScore and displayLeaderboard functions as well as remembering to call loadState and saveState in the appDelegate.

One thing to note is that you will need your app to be in the “Waiting for upload” status in iTunes Connect before you can enable Game Center for your app and set up the leaderboard on Apple’s side. Just fill in temporary information as you are setting up this app in iTunes Connect, you can change them later.

And another thing is you might need a couple of AppleIDs to work with, so you can set up Sandbox Game Center accounts for testing. This can be done once you have implemented the Game Center and tries to log into it through your app.