Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

GameCenter Plugin Live! Leaderboards and Achievements!

Discussion in 'iOS and tvOS' started by prime31, Sep 6, 2010.

  1. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,571
    Which version is it? The 8GB one is actually a 2nd generation device sold alongside the 3rd gen.
     
  2. _ex_

    _ex_

    Joined:
    May 23, 2011
    Posts:
    98
    Its an iPod model MC008LL with 32 GB storage.
    Version 4.2.1 (8C148)
     
  3. _ex_

    _ex_

    Joined:
    May 23, 2011
    Posts:
    98
  4. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    When can we expect the plugin to support iOS 5's asynchronous multiplayer?
     
  5. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @JTown, we will have an update shortly after iOS 5 goes live and the API is finally set in stone.
     
  6. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    Sounds good :)
     
  7. donlien

    donlien

    Joined:
    Apr 13, 2009
    Posts:
    229
    Dear Prime,

    Thank you for help a lots, and I have uploaded my game "Air Afro" and been waiting for review now. You are truly the super star !! :D

    Everything is fine, but I am curious and have a little question as the attachment shown.

    That build is RELEASE build, NOT DEBUG build, but my game still ask me to log in with sandbox mode.

    I wonder is it decided by iOS using my provision? :confused:

    I don't need to worry about this dialog, it won't appear to users who buy the DISTRIBUTION build version, am I right?
     

    Attached Files:

    Last edited: Sep 5, 2011
  8. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @donlien, as long as you sent a release build to Apple with a proper provisioning you should be fine.
     
  9. appleunited

    appleunited

    Joined:
    Dec 25, 2010
    Posts:
    103
    Do you mean the new turn based multiplayer mode in iOS5 will be supported? Thanks.
     
  10. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @appleunited, yes, turn based multiplayer will be supported in a future update.
     
  11. donlien

    donlien

    Joined:
    Apr 13, 2009
    Posts:
    229
    Thanks for reply. :)

    I remember the Application Loader will check that and prevent developers to upload app with wrong provision, so I think it should be proper since the status is ok and waiting for review. ;)
     
  12. lightbringer

    lightbringer

    Joined:
    Jul 30, 2009
    Posts:
    14
    Anyone using the latest version notice a white bottom?



    Also, for some reason autorotation is funky when the leader boards are being shown on the iPad. My game handles both landscape views just fine but when the leader boards open it locks itself to the rotation it started with. The only exception is when it incorrectly shows with an upside down rotation and then can later correct itself.
     
  13. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @light, do you have the iOS keyboard set to autorotate in all orientations and are you using the latest version of the plugin?
     
  14. donlien

    donlien

    Joined:
    Apr 13, 2009
    Posts:
    229
    Hi, Prime, Just FYI, my game is safe on App Store and Ready for Sale. :)

    Here: http://itunes.apple.com/app/air-afro/id459739451?mt=8

    Yes, Proper provision decided, you are always right.
     
  15. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @donlien, awesome job! Be sure to email the iTunes link over to questions (@) prime31.com along with the plugins used so we can get it up on the showcase.
     
  16. donlien

    donlien

    Joined:
    Apr 13, 2009
    Posts:
    229
    Ok, I do it now !!! :D
     
  17. lightbringer

    lightbringer

    Joined:
    Jul 30, 2009
    Posts:
    14
    @prime31, tried autorotate set to true for all, tried just for landscape, and tried not setting it at all - no luck with the latest version.
     
  18. springfield2

    springfield2

    Joined:
    Nov 20, 2010
    Posts:
    27
    Hello. Thanks for making this. Love it. If I log in to Game Center, then suspend my app (by pressing the home button), and then return to my app without being connected to Wifi or 3G, a message appears saying "Can't connect to Game Center Servers". This makes sense, but I would like to not have it appear. Where in the code does this window get prompted? Thanks!
     
  19. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Springfield, the code that displays the UIAlertView belongs to Apple so there isn't much you can do about it.
     
  20. springfield2

    springfield2

    Joined:
    Nov 20, 2010
    Posts:
    27
    Ok, the problem is that the message does not pause my game. So the game continues without any way of interacting with it while the message is displayed. Is it possible to pause my game, while the message appears? if yes, where should I put my pause function?
     
  21. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Springfield, that code is 100% Apples. You cannot hook into it and there is no easy, foolproof way of detecting that it is showing.
     
  22. springfield2

    springfield2

    Joined:
    Nov 20, 2010
    Posts:
    27
    Ok. Thanks for your support.
     
  23. jakkovanhunen

    jakkovanhunen

    Joined:
    Oct 20, 2008
    Posts:
    79
    Hi,

    Just like @lightbringer I'm now getting a grayish border at the bottom go the Game Center dialog.
    I'm using GameCenter_2011-09-06.


     
  24. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jakk, I am seeing that as well. That view is managed by Apple so there isn't any legal way to modify it. I would suggest shooting a bug report over to Apple.
     
  25. jakkovanhunen

    jakkovanhunen

    Joined:
    Oct 20, 2008
    Posts:
    79
    Allright, thanks.
     
  26. jakkovanhunen

    jakkovanhunen

    Joined:
    Oct 20, 2008
    Posts:
    79
    Hi @prime31,

    I did some more investigation into the Game Center dialog white border issue.

    You say that it is something Apple related, but I think something changed in your code that triggers it, so maybe there is a workaround.
    The change is between GameCenter_2011-07-29 and GameCenter_2011-08-10.

    When I use GameCenter_2011-07-29, there is no white border. When I use a later version there is.

    So, for now I'll try to revert back to GameCenter_2011-07-29.
     
  27. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jakk, diffing the two versions shows that the only change was to the view controller that the GC views are launched from. That should not be able to change the color of the view that is launched. we have already opened a bug with Apple but the more they get the faster it gets fixed.
     
  28. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,571
    I'm trying to integrate the Heyzap SDK ( http://www.heyzap.com/mobile/sdk ) into an update to the free and lite versions of my existing game that uses your Game Center plugin in both, and the Mobclix plugin in the lite version.

    Heyzap provide a Unity plugin, but I am getting errors. Is there something I need to do to get other plugins to work alongside yours?

    I noticed they had a PostprocessBuildPlayer that was obviously causing problems as you have one as well. Looking inside your PostprocessBuildPlayer, I noticed it said it searched for other PostprocessBuildPlayers and implemented them, so I renamed the Heyzap one to PostprocessBuildPlayer_Heyzap, but this didn't solve the problem.

    Heyzap are looking at it, but their solutions have not worked yet. As you know your plugins best, I thought you may have an idea I could try. The 5 errors mention an incomplete implementation of Heyzap.
     
  29. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @moonjump, as long as our original p
    postprocessBuildPlayer is present and theirs is named PostprocessBuildPlayer_SOMETHING there should be no conflicts as each script will be run totally separately.
     
  30. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,571
    Thank you Prime31. Knowing that isn't an issue helps me concentrate on other solutions.
     
  31. BogdanDude

    BogdanDude

    Joined:
    Jun 18, 2009
    Posts:
    89
    Hi Mike!

    I'd like to ask you for some optimization tips for the Game Center Multiplayer plugin you did.

    So here's what we're doing:
    -sending player sync data 15 times per second, using bytes, unreliable (4 floats+ 2 bools)
    -sending a single packet for all enemies, one time per second, using bytes, unreliable (max 10 enemies x 2 floats + 2 int + 1 bool)
    -sending various other RPC type calls, every few seconds,using bytes, reliable(about 3 floats)

    All these calls are made to the same gameObject, which has various methods.

    The game goes from 50FPS to 25-30FPS when playing a GameCenter Online game (as opposed to a single player game).

    To pack and unpack the player and enemies byte stream, we use the best JSON library we could find (called JsonFx).

    Could you please recommend us something to optimize our code?
    If we (or you) changed the Xcode objective-C methods, to remove the gameObject name from each package sent, and replace the method name with a simple ID, do you think it would help?

    Let me know if you have any other ideas.

    Thanks a lot,
    Bogdan
     
  32. blacklab

    blacklab

    Joined:
    Jun 23, 2009
    Posts:
    18
    So I bought the Game Center plugin today and I'm trying to get it set up. I've read an many docs as I can find, so I think I have a handle on how it all supposed to work. However I'm having troubles still.

    I get this message when I try to authenticate.

    "The requested operation could not be completed because this application is not recognized by Game Center."

    I'm enabled Game Center in iTunesConnect for the app and the specific version. I'm using a debug build and a development provisioning profile. I logged out of Game Center. I was prompted to create new profile and did so, and that profile can log in, but I still get this stupid error message.

    Do I need to upload a binary before GC will recognise my app?

    Thanks, Paul
     
  33. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Bogdan, The big thing I can see is that you are using JSON which will cause the GC to run a lot. Instead of JSON look into making your own protocol that just packs the values directly to a byte[]. That will save GC time and CPU time.


    @Blacklab, you do not need to and should not upload a binary. Ensure that your bundle ID is correct, delete the app from your device between tests and make sure to test on a non-jailbroken device.
     
  34. BogdanDude

    BogdanDude

    Joined:
    Jun 18, 2009
    Posts:
    89
    Thanks, Mike!

    We tried with our own protocol, but is was just as slow as the JSON library we're using now. I guess this is not the problem.
    We were wondering if changing the methods in Xcode to remove the 2 string parameters and just use one int for the method ID would help..
    So, instead of

    - (id)initWithGameObject:(NSString*)gameObject methodName:(NSString*)methodName dataParameter:(NSData*)dataParameter

    we'd have something like

    - (id)initWithGameObject:methodID:(int)methodID dataParameter:(NSData*)dataParameter

    Any other suggestions are definitely welcome.

    Thanks a lot!
     
  35. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Bogan, what are you seeing in the profiler that is taking up time? Is there anyway you con combine some calls? You can also set the method name and game object strings as const to avoid the G. As well.
     
  36. blacklab

    blacklab

    Joined:
    Jun 23, 2009
    Posts:
    18
    Thanks @Prime31...deleting the existing version from the device fixed it.
     
  37. synapsemassage

    synapsemassage

    Joined:
    Jul 27, 2009
    Posts:
    334
    Hi Prime,

    I've released my game "earthing" recently and want say "THANK YOU!". I use some of your plugins (Etcetera, GC, iAds for the free version). Your tools are really very good and were a great help in my project. If you want to take look, click on the related link in my signature. I've also a thread in the forum with a youtube video.

    I wish you a good day!
     
  38. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @synapse, awesome job! Be sure to email the iTunes link over to questions (@) prime31.com along with the plugins used so we can get it up on the showcase page.
     
  39. springfield2

    springfield2

    Joined:
    Nov 20, 2010
    Posts:
    27
    Hello, how do I check whether the player has already got a specific achievement?
     
  40. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @spring, you have to first fetch the achievements then loop through the list to find the specific one you are looking for.
     
  41. springfield2

    springfield2

    Joined:
    Nov 20, 2010
    Posts:
    27
    Ok. if i were to check whether achievement no. 5 was already achieved, how exactly would the code look?
     
  42. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @spring, check the demo scene for the part where it retrieves the achievements. You will just need to loop through the List returned either using a for or a foreach loop to find the one you are looking for.
     
    Last edited: Sep 17, 2011
  43. springfield2

    springfield2

    Joined:
    Nov 20, 2010
    Posts:
    27
  44. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @spring, I forgot to mention the demo scene has the loop setup and all so all you need to do is add in a line looking for your specific achievement identifier.
     
  45. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    Hey Prime,

    I'm trying to implement final score screen that shows your current ranking and score or the current player. Using retrieveScoresForPlayerId only returns the score and rank of the player the last time the leaderboard updated which is generally about 10-30 minutes old.

    How would I go about getting or estimating their new rank?

    On Sony's PSN the callback from reporting a score contains the new ranking of the player if the report was successful. Does gameCenter offer anything like that?

    Angry birds does this so it must be possible.

    Thanks,
    Antony.
     
  46. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Anthony, the plugin returns to you whatever apple sends. They definitely do some caching in there but if you want to get the details of what they are caching and for how long you will have to open a bug report with Apple. Getting any data from GameCenter is a big black box that we can't see into.
     
  47. maglat

    maglat

    Joined:
    Jul 9, 2010
    Posts:
    111
    Hey Prime,

    since I updated the Gamecenter Plugin to the newest version (21.09.2011) I get following 2 errors:

    Assets/Plugins/GameCenter/GameCenterAchievement.cs(21,33): error CS1061: Type `string' does not contain a definition for `arrayListFromJson' and no extension method `arrayListFromJson' of type `string' could be found (are you missing a using directive or an assembly reference?)

    and

    Assets/Plugins/GameCenter/GameCenterAchievement.cs(24,17): error CS1579: foreach statement cannot operate on variables of type `object' because it does not contain a definition for `GetEnumerator' or is not accessible


    EDIT: Nevermind, sudenly it works now :)
     
    Last edited: Sep 22, 2011
  48. donlien

    donlien

    Joined:
    Apr 13, 2009
    Posts:
    229
    Hi, Prime, I have a question about the plug-in "Game Center Turn Based Multiplayer (requires GameCenter Plugin)".

    If I had bought the "Game Center (Leaderboards and Achievements)" before you separated them, do I have the right to download "Game Center Turn Based Multiplayer (requires GameCenter Plugin)" for FREE now?
     
    Last edited: Sep 28, 2011
  49. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @donlien, you get the real time multiplayer plugin at no cost. The Turn Based Multiplayer Plugin is a new plugin and not included.
     
  50. kzhi

    kzhi

    Joined:
    Sep 28, 2011
    Posts:
    2
    Hi, Prime, I have the following errors (22) when trying to build a project for iPad:

    Undefined symbols for architecture armv6:
    "__gameCenterLoadLeaderboardLeaderboardTitles", referenced from:
    RegisterMonoModules() in RegisterMonoModules.o
    "__gameCenterRetrieveScoresForLeaderboard", referenced from:
    RegisterMonoModules() in RegisterMonoModules.o
    "__gameCenterReportAchievement", referenced from:
    RegisterMonoModules() in RegisterMonoModules.o
    "__gameCenterAuthenticateLocalPlayer", referenced from:
    RegisterMonoModules() in RegisterMonoModules.o

    How that can be fixed?