Implement Game Center

Hey Ken,

Sorry I didn’t see this sooner - I’m really happy to hear you’ve got it going and are able to move forward :slight_smile:

Thanks for sharing your experience for others - although hopefully very, very soon we wont be doing this through OF. (GC is actively being worked on currently.)

Peach :slight_smile: [import]uid: 52491 topic_id: 16641 reply_id: 78287[/import]

Hey, Ken & Peach, thank you for the code snippets, and Ken, thank you for the detailed steps you took to get the Game Center working.

I want to enable leaderboards on both OF and GC, and I followed the steps described by Ken above, and then made a device build immediately after I set up & enabled the leaderboards in iTunes. I had my OF leaderboards working (implemented a while back), and when I launched the build on my device, the GC sandbox sign-in process popped up right away. So far so good.

Now, I’d like to know how I may let the user access the GC leaderboards from within my game? Is there an API call for it? Or… only way to do it is to leave the game and send the user to the GC leaderboard URL (which I believe what @fava has shown me how-to on this post) ???

I’d sooo appreciate any and all thoughts, tips and insights regarding this.

Naomi
[import]uid: 67217 topic_id: 16641 reply_id: 81347[/import]

@Naomi,

All you have to do is this:

[lua] system.openURL( “gamecenter” )[/lua]

I’ve also seen the code below posted, but despite what those posts said it does NOT take you directly to the leader boards.

[lua] system.openURL( “gamecenter:leaderboards” )[/lua]

BTW, you can test all of this without your app but opening Safari on your device and typing in “gamecenter” (without the quotes) in the URL.

Just saw that they updated the docs for the Corona gameNetwork. I had tried these things previously, but perhaps it works now:

[lua]local gameNetwork = require “gameNetwork”

–For GameCenter (iOS-only):
gameNetwork.init( “gamecenter”, initCallback )

gameNetwork.show( “leaderboards”, { leaderboard = {timeScope=“Week”}, listener=dismissCallback } )

gameNetwork.show( “achievements”, { listener=dismissCallback } )

gameNetwork.show( “friendRequest”, { message=“By my friend please”, playerIDs={ “G:194669300”, “G:1435127232” }, emailAddresses={ “me@me.com” }, listener=dismissCallback} )[/lua]

For more info look here:

http://developer.anscamobile.com/reference/index/gamenetwork/gamenetworkshow [import]uid: 16734 topic_id: 16641 reply_id: 81362[/import]

Edit: Hey, Ken, when I typed in “gamecenter” (without the quotes) on Safari from my device, it opens the gamespot website – so it won’t do. Entering “gamecenter:leaderboards” (without the quotes) in the URL worked though!

Naomi


Hey, Ken, thank you sooo much! I’ll look up the gamecenter on Safari.

About the new gameNetwork update, I think it works with the daily build 725 or later that has native GC integration feature. Because I want both OF and GC, I don’t think I want to initialize the gamecenter. (About the native GC, a very nice tutorial was posted here: http://blog.anscamobile.com/2012/01/tutorial-game-center-integration-ios/ )

Thanks again!!

Naomi

Edit: BTW, I’m still using daily build 706 (because I still don’t see a compelling reason to upgrade, and I’d rather enable my game to run on some older iOS.) [import]uid: 67217 topic_id: 16641 reply_id: 81381[/import]