[RESOLVED] GameCenter leaderboards

I am trying to remove the OpenFeint code from my game and replace it with GameCenter code. To do this, I need to change the code for submitting leader board high score values from this:
[lua]openfeint.setHighScore{ leaderboardID=“123456”, score=gamestate.score, displayText=“Highscore” }[/lua]
to this:
[lua]gamecenter.request( “setHighScore”,{ localPlayerScore = { category="???", value=gamestate.score }, })[/lua]

My problem is that I don’t know what to provide for the category value. I have two leader boards: “arcade” and “challenge”. Both leader boards have (in iTunes Connect) a “Reference Name” and a “Leaderboard ID”. For example, my arcade leader board has reference name “arcade” and ID “321”.

The Corona documentation for the above function is: http://developer.coronalabs.com/reference/index/game-network/gamenetworkrequest

The code example it provides is:
[lua]gameNetwork.request( “setHighScore”,
{
localPlayerScore = { category=“com.appledts.EasyTapList”, value=25 },
listener=requestCallback
})[/lua]

It states:

“‘category’ must be a string that matches the name of the board you want to register the score with as entered on iTunes Connect.”

What I don’t understand is what the category value should be. Should it be the “reference name” or the “leaderboard id”? Am I just naming my leader boards in an odd way? [import]uid: 8271 topic_id: 35148 reply_id: 335148[/import]

I believe the “leaderboard id” value from iTunes is the one to use for “category”. I found someone with the same problem had a reply from an Ansca staff member, and he said that is the value to use:
http://developer.coronalabs.com/forum/2012/03/03/game-center-sethighscore-category

Seems strange that the code example uses a reverse domain string rather than an ID number, but perhaps Corona / Apple has changed how it handles leaderboards since the example was created?

[import]uid: 84115 topic_id: 35148 reply_id: 139718[/import]

The “category” is indeed the “Leaderboard ID” from iTunes Connect. This can be anything you want and in the case of the samples, and ourselves, is a reverse domain string.

In your case the category would be “321” which is perfectly acceptable ( as far as I know anyway ). [import]uid: 119420 topic_id: 35148 reply_id: 139719[/import]

Thank you guys - very helpful! [import]uid: 8271 topic_id: 35148 reply_id: 139720[/import]

Hmm, one more question: When requesting that Game Center should show the specified leader board, how is that defined, or is it not possible? For example, the code above takes the ‘category’ parameter, but the show() function appears not to, in the documentation:
[lua]gamecenter.show( “leaderboards” )[/lua] [import]uid: 8271 topic_id: 35148 reply_id: 140031[/import]

Hey, @horacebury, mine looks something like this:

gameNetwork.show( "leaderboards",   
 { leaderboard =   
 { category="com.mygame.thisone", playerScope="Global", timeScope="AllTime" }   
 } )  

This brings up the leader board whose ID is com.mygame.thisone

Check http://docs.coronalabs.com/api/library/gameNetwork/show.html – scroll down to the example section for the Game Center for more options.

Hope this helps.

Naomi [import]uid: 67217 topic_id: 35148 reply_id: 140033[/import]

:slight_smile: thanks [import]uid: 8271 topic_id: 35148 reply_id: 140035[/import]

Not sure if it helps at all but we have this available - https://github.com/GlitchGames/GGGameCentre - it’s not finished yet though. [import]uid: 119420 topic_id: 35148 reply_id: 140039[/import]

Cool :slight_smile: [import]uid: 8271 topic_id: 35148 reply_id: 140041[/import]

I believe the “leaderboard id” value from iTunes is the one to use for “category”. I found someone with the same problem had a reply from an Ansca staff member, and he said that is the value to use:
http://developer.coronalabs.com/forum/2012/03/03/game-center-sethighscore-category

Seems strange that the code example uses a reverse domain string rather than an ID number, but perhaps Corona / Apple has changed how it handles leaderboards since the example was created?

[import]uid: 84115 topic_id: 35148 reply_id: 139718[/import]

The “category” is indeed the “Leaderboard ID” from iTunes Connect. This can be anything you want and in the case of the samples, and ourselves, is a reverse domain string.

In your case the category would be “321” which is perfectly acceptable ( as far as I know anyway ). [import]uid: 119420 topic_id: 35148 reply_id: 139719[/import]

Thank you guys - very helpful! [import]uid: 8271 topic_id: 35148 reply_id: 139720[/import]

Hmm, one more question: When requesting that Game Center should show the specified leader board, how is that defined, or is it not possible? For example, the code above takes the ‘category’ parameter, but the show() function appears not to, in the documentation:
[lua]gamecenter.show( “leaderboards” )[/lua] [import]uid: 8271 topic_id: 35148 reply_id: 140031[/import]

Hey, @horacebury, mine looks something like this:

gameNetwork.show( "leaderboards",   
 { leaderboard =   
 { category="com.mygame.thisone", playerScope="Global", timeScope="AllTime" }   
 } )  

This brings up the leader board whose ID is com.mygame.thisone

Check http://docs.coronalabs.com/api/library/gameNetwork/show.html – scroll down to the example section for the Game Center for more options.

Hope this helps.

Naomi [import]uid: 67217 topic_id: 35148 reply_id: 140033[/import]

:slight_smile: thanks [import]uid: 8271 topic_id: 35148 reply_id: 140035[/import]

Not sure if it helps at all but we have this available - https://github.com/GlitchGames/GGGameCentre - it’s not finished yet though. [import]uid: 119420 topic_id: 35148 reply_id: 140039[/import]

Cool :slight_smile: [import]uid: 8271 topic_id: 35148 reply_id: 140041[/import]