GGGameCentre

Hey Corona-ites,

Are people still using GGGameCentre from the generous Glitch Games folks? I am getting ready to use it in a game and I want to make sure it still works. The code is about a year old and software tends to rust when unattended. :slight_smile:

Any comments are appreciated,

thanks,

Rick

Basically it’s still supported by us, the only reason it hasn’t had any activity in a while is because we’re currently focusing on adventure games which don’t really need game centre type functionality. If you use it and have issues or need new parts of the API implemented just get in touch as we’re happy to do all we can.

Thanks! You guys are such rock stars! Seriously, nice guys that do great work…I have bought a couple of your games…really impressive stuff.

I’ll give it a shot integrating and see how it goes!

Thanks for reaching out.

-Rick

Same here +1000 for Glitch Games!

Unfortunately I am having an issue with Game center and I am pretty sure it is not a problem with GGameCentre. Why I am saying that?

1- I used the library on my first game (Space Command without any issue)

2- The same game still work fine (in term of game center) with the latest ios 7

My new game (Mad Gods) does not show the Game Center request for login. I have used the library the exact same way that I did with Space Command. Space command ask me if I want to login. The only two difference I see are:

1- Space Command was made with Director and new game is made using Storyboard

2- Space Command is live and new Mad Gods version (1.1.0 ) is in beta

So it must be the way I should be using the library that has changed (maybe). I am using a test user but when i try the app I am logged off from GC (from the options) and like I said, the old game fine (it always ask me to login if I want to)

I think maybe it is the way I setup with Storyboard (I am very new to Storyboard) Basically I am putting this in menuScreen.lua (NOT in main.lua)

– initialize gamecenter 

  local GGGameCentre = require( “GGGameCentre” )

  local gameCentre = GGGameCentre:new()

then later in the same menuScreen.lua I call this from a gameCenter button (two leaderboards)

 gameCentre:setHighScore(“com.lairdtopfreegames.MadGods.bestDistance”,highScore)

 gameCentre:setHighScore(“com.lairdtopfreegames.MadGods.totalDistance”,totalDistance)

 gameCentre:showLeaderboards()

At least the way I used the GGameCentre on my first game. Maybe it worked ok because I was using Director? Is this ok? Or I should I put the code in the main.lua? Which part given the fact that my gamecenter button is in the menuScreen.lua?

I realize that this is not an issue with the library but I will welcome any suggestions on how to set up GGameCentre with Storyboard since i think this is where my issue lies.

THANKS!

Mo

ps: Oh I forgot, when i press my GC button, a message popup with something like “Game Center Unavailable…player is not signed in” The problem? I am older game using the library shows me a login window to GC…

Ok some more data…I am sorry I put this issue on this post. I just switch to the “regular” way of adding GameCenter (following this great tutorial: http://coronalabs.com/blog/2012/01/17/tutorial-game-center-integration-ios/)

And it seems to be giving me the same behavior. That is, the app says that I am not logged in? BUT if I use a device with IOS 6+ it seems to work ok.

I think I may need to move this conversation to another thread since the issue maybe related to IOS 7…

Thanks.

Mo

Sorry, have been away for the past few days so haven’t been able to respond. Thank you for the kind words!

So if I’m understanding this correctly the issue seems to be just Game Centre in corona in general in iOS 7 regardless of if you’re using GGGameCentre or not? If so, hopefully someone from Corona can comment on this in case something has changed which we don’t know about.

I intergraded Game Centre (not GGGameCentre) yesterday in my game and it seems to be working fine on IOS7 lets see what apples review got to say

I hope to find some time to look into it properly soon, if you find anything please let us know.

Hi Guys.

Thanks for the feedback.  Yes I am really at lost on this one. For instance my wife just upgraded her ipad 2 to the latest IOS 7 and it worked the first time! But the iphone 5 with IOS 7 still does not work. In the xcode console it says (when I click my GC button which suppose to upload my hiscore):

“an 25 22:42:54 Mos-iPhone-5 MadGodsFree110[2710] <Warning>: WARNING: The ‘gameNetwork’ library is not available on this platform”

(that’s on the device)

Still If I go to my old app (Space Command) which also use GGameCentre on my iphone 5 (again with ios 7) it opens the GameCenter window and ask you to login.  In IOS 6 devices, it seems to work when I relaunch the app a second time? The first time the screen blank out for a very short time then main menu shows up. When I launch the app again then the GC window is displayed. 

It simply does not make sense to me! It is clearly not an issue with ios 7 since the same code used on my old app and the app (both on the same ios 7 device) react differently. The old app was using Director and the new one (using Storyboard) Maybe I am not using the GC code correctly with Storyboard?

Would LOVE so code snippet of best way to use GGameCenter with Storyboard. For now I am using it like I did with Director. I mean I am using the init code in the menu.lua (and not main.lua) Still I did a test where I put the code in main.lua and it still did not work.

THANKS!

Mo.

im using this :

local gameNetwork = require "gameNetwork" local loggedIntoGC = true local requestCallback, userScoreText, currentBoardText, userBestText, bestLabel, bestText function requestCallback( event ) &nbsp;&nbsp;&nbsp;&nbsp;if event.type == "setHighScore" then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local function alertCompletion() gameNetwork.request( "loadScores", { leaderboard={ category=leaderBoards[currentBoard], playerScope="Global", timeScope="AllTime", range={1,3} }, listener=requestCallback } ); end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--native.showAlert( "High Score Reported!", "", { "OK" }, alertCompletion ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gameNetwork.show( "leaderboards", { leaderboard={ category=HeliBobLIos1, timeScope="Week" } } ); &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;elseif event.type == "loadScores" then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if event.data then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local topRankID = event.data[1].playerID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local topRankScore = event.data[1].formattedValue &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bestTextValue = string.sub( topRankScore, 1, 12 ) .. "..." &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if topRankID then gameNetwork.request( "loadPlayers", { playerIDs={ topRankID }, listener=requestCallback} ); end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if event.localPlayerScore then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;userBest = event.localPlayerScore.formattedValue &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;userBest = "Not ranked" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if userBestText then ui.updateLabel( userBestText, userBest, display.contentWidth-25, 177, TOP\_REF, RIGHT\_REF ); end &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;elseif event.type == "loadPlayers" then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if event.data then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local topRankAlias = event.data[1].alias &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if topRankAlias then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;topScorer = topRankAlias &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if bestLabel and bestText then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ui.updateLabel( bestLabel, topScorer .. " got:", 25, 212, TOP\_REF, LEFT\_REF ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ui.updateLabel( bestText, bestTextValue, display.contentWidth-25, 212, TOP\_REF, RIGHT\_REF ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;end end local function initCallback( event ) &nbsp;&nbsp;&nbsp;&nbsp;-- "showSignIn" is only available on iOS 6+ &nbsp;&nbsp;&nbsp;&nbsp;if event.type == "showSignIn" then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- This is an opportunity to pause your game or do other things you might need to do while the Game Center Sign-In controller is up. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- For the iOS 6.0 landscape orientation bug, this is an opportunity to remove native objects so they won't rotate. &nbsp;&nbsp;&nbsp;&nbsp;-- This is type "init" for all versions of Game Center. &nbsp;&nbsp;&nbsp;&nbsp;elseif event.data then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loggedIntoGC = true &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gameNetwork.request( "loadScores", { leaderboard={ category=leaderBoards[currentBoard], playerScope="Global", timeScope="AllTime", range={1,3} }, listener=requestCallback } ) &nbsp;&nbsp;&nbsp;&nbsp;end end local function offlineAlert()&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;native.showAlert( "GameCenter Offline", "Please check your internet connection.", { "OK" } ) end &nbsp; &nbsp; local function uploadtoGC() if loggedIntoGC then&nbsp; gameNetwork.request( "setHighScore", { &nbsp; &nbsp; localPlayerScore = { category="HeliBobLIos1", value=uploadScore\_txt }, &nbsp; &nbsp; listener=requestCallback }); end &nbsp; &nbsp; end &nbsp; uploadtoGC() &nbsp;

@mmk: THANK YOU so much! (that’s one of the reason I love this community so much:) I am going look into the code. I am not too familiar with code GC the regular way so I am assuming for testing I only need to initialization code. I usually use GGameCentre which usually works like a charm.

Just curious, is the code above set in main.lua or another module? Do you use Storyboard? Not sure if that makes any difference but I thought i should ask.

In any event, thank you for your time and the code above. I really appreciate it. I will keep you posted if I found anything.

Mo

this code is set on any .lua page just remember to include(somewhere in mine its main)

local gameNetwork = require "gameNetwork" local loggedIntoGC = false -- called after the "init" request has completed local function initCallback( event ) &nbsp; &nbsp; if event.data then &nbsp; &nbsp; &nbsp; &nbsp; loggedIntoGC = true &nbsp; &nbsp; &nbsp; &nbsp; --native.showAlert( "Success!", "User has logged into Game Center", { "OK" } ) &nbsp; &nbsp; else &nbsp; &nbsp; &nbsp; &nbsp; loggedIntoGC = false &nbsp; &nbsp; &nbsp; &nbsp; native.showAlert( "Fail", "User is not logged into Game Center", { "OK" } ) &nbsp; &nbsp; end end -- function to listen for system events local function onSystemEvent( event )&nbsp; &nbsp; &nbsp; if event.type == "applicationStart" then &nbsp; &nbsp; &nbsp; &nbsp; gameNetwork.init( "gamecenter", initCallback ) &nbsp; &nbsp; &nbsp; &nbsp; return true &nbsp; &nbsp; end end Runtime:addEventListener( "system", onSystemEvent ) &nbsp;

just remember this it triggered by ‘onSystemEvent’ so if its in the main.lua it will load when the game starts

Thanks mmk! This is crazy, I simply put your latest code (to initialize the GC as in “gameNetwork.init( “gamecenter”, initCallback )” )  and it always return false (so showing the “fail” native.showAlert) I do not have my other ios 7 device to test on (I will get it back tomorrow and will test on that one too) 

I am starting to wonder about my device (iphone 5) BUT my old game that uses GGameCentre works like a charm on it (ie: it show the login window)

Thanks again a million for sharing your code! I will keep working/testing on report here if I can get anywhere so other people can learn from my struggle!

Cheers.

Mo

I’m updating this code tonight so its less annoying for the users, will post later

right Mo, strangely enough I had the same problem today… but not to worry googleling i found out that this is a bug in gamecenter if you cancel login moor than 3 time it will just not show up anymore just reset content en settings for your app and you will be good to go :smiley: this will probably fix you GGGameCentre problems as well 

Thanks! I am kind of aware of that bug (I think it is more like a feature since people who really do not care about GC on a specific game do not have to be ask again and again!) I think my issue is different but I am just curious about when you say “just reset content en settings for your app”??? What exactly do you mean or do you do that? (Coding or just quitting GameCenter from either GC app or the settings app? Thanks again for your immense patience!! Mo

remove your app completely of your device including all temp file like database ect 

I unfortunately I did that but no difference. I am going to remove GC for now until i can fix it.

Thanks!

Mo

Basically it’s still supported by us, the only reason it hasn’t had any activity in a while is because we’re currently focusing on adventure games which don’t really need game centre type functionality. If you use it and have issues or need new parts of the API implemented just get in touch as we’re happy to do all we can.

Thanks! You guys are such rock stars! Seriously, nice guys that do great work…I have bought a couple of your games…really impressive stuff.

I’ll give it a shot integrating and see how it goes!

Thanks for reaching out.

-Rick