Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

GameCenter Plugin Live! Leaderboards and Achievements!

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

  1. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    After many beta SDK versions and late nights I am proud to present the Prime31 GameCenter plugin just in time to make the launch next week! Online leaderboards and achievements are fully implemented. You can choose to use the Apple provided UI for the quickest possible integration or you can use the plugin to create your own fully customized UI. It will provide the raw score and achievement data and metadata for use in your game.

    Note: I decided to release this plugin before the multiplayer portion is ready so that everyone can get their leaderboards and achievements tested and released ASAP. Online multiplayer and all the associated functionality will be released as a free upgrade as soon as it is production ready.

    As always, you can find documentation here and the plugin page here.

    Enjoy!
     
    Last edited: Aug 16, 2012
  2. klaymator14

    klaymator14

    Joined:
    Feb 3, 2009
    Posts:
    153
    Will this work with Unity 3 Basic iPhone license?
     
  3. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @klaymator14, there is no such thing as a plugin that works with Unity 1.7 Basic. All plugins (ours included) only with with Unity 1.7 Pro. Plugins will work with Unity 3 Basic though. If you haven't purchased the upgrade to Unity 3 yet I HIGHLY recommend you get it while it's cheap. As a nice side bonus, you get true plugin support as well.

    Update: I put a video on YouTube showing how to setup the GameCenter plugin on the current Unity 3 beta. Because it requires iOS 4.1 and Unity doesn't directly support it yet there is an extra step needed to get it linked up properly. Check out the video for the details.

    Multiplayer is almost ready as well. There will be an update with online multiplayer support coming soon then shortly after that the very advanced online multiplayer support will be added (advanced matchmaking, player groups, player attributes, etc). Most people will not need to delve this deep into multiplayer but it will be there for those that do.
     
  4. Toad

    Toad

    Joined:
    Aug 14, 2010
    Posts:
    298
    Wow, can't believe you've delivered this so quickly! I've just bought this plugin as it looks great but I've got a few questions too....

    Is it possible to do the following sorts of things with Game Center in general (and your plugin specifically);

    - display leaderboard scores in game, especially your friend's scores (like Doodle Jump)

    - notify me if my friend gets an achievement in Matt'sGame to motivate me to get the achievement too (like Shadow Complex does on Xbox Live)

    - notify me if my friend beats my current high score

    If the last 2 are possible would they only work if we're both playing the game at the same time?

    - message someone (via email, SMS, etc) to say something like "I got 10,000,000 on Matt'sGame - why don't you see if you can beat me!" with a link to buy Matt'sGame from the Appstore

    Cheers
    Matt
     
  5. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @MattSimpson, you can display leaderboaards in game but only for the currently running game. There is no way to subscribe to notifications form friends scores and achievements.

    Some of these would be excellent additions and I highly recommend you and anyone else who wants this kind of functionality send a feature request to Apple. They are pretty good about adding the features that get requested the most.
     
  6. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    Update: if you have been using a GameCenter account you will need to open the official GameCenter app and reenter your credentials and agree to the new terms. I am guessing 4.1 is going live really soon because Apple just pushed this change out today.
     
  7. bumba

    bumba

    Joined:
    Oct 10, 2008
    Posts:
    358
    how does gamecenter work? Is it like OpenFeint that a whole new interface will pop up if you want to see leaderboards and achievements?

    Further what do you think? Because Gamecenter doesnt support iPhone 3G and iPod Touch 1G what to do with these devices? Or is it better to use OpenFeint?
     
  8. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,296
    I was wondering if it's possible to use both OpenFeint *and* game center in the same project?
     
  9. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @bumba, GameCenter has a huge API that allows you to either create your own interface or use the built-in Apple UI. There are leaderboards, achievements and a very flexible online matchmaking multiplayer setup in GameCenter as well. I see GameCenter as the future and a requirement going forward but as for right now OpenFeint is fine because it has a much larger audience. Of course, that might change later today when 4.1 is released...

    @jashan, you can certainly use GameCenter and OpenFeint at the same time though I would probably give people the option rather than try to run both simultaneously.
     
  10. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,296
    Yup, that's the idea - have one build and a setting what people want to use.
     
  11. mehware

    mehware

    Joined:
    Nov 19, 2007
    Posts:
    739
    4.1 gets released today? Man do I have to stop coding and stay with the current news.

    GameCenter has multiplayer which is free in your update. Is this over 3G? is GameKit a branch of it?

    - Matt
     
  12. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @mehware, the multiplayer is a totally different beast than the GameKit multiplayer. GK (GameKit) uses what Apple terms 'sessions' which are ad hoc, peer to peer connections. You get the simple peer picker popup UI to locate different peers and you can connect up to 16 devices but they most all be local. GC uses 'matches' to connect users over any available network connection.

    GC (GameCenter) is actual online multiplayer over WiFi, 3G or Bluetooth (all totally hidden by the API). GC is limited to 4 players. It has much more advanced matchmaking features and allows people to invite other people to play with them via push notifications. Voice chat is also completely different in GC. You can setup multiple voice chat channels with GC as well and enable/disable them. There is a lot more complexity to it as well with the advanced matchmaking features. I will have an API doc update in about half an hour on the docs page. It will have the first 2 portions of multiplayer: using Apple provided UI and programatic matchmaking. The much more advanced matchmaking wont make the next update but will be in the update after that.
     
  13. langju

    langju

    Joined:
    Jul 1, 2009
    Posts:
    207
    Hi Prime31 !

    Just to know, does the
    :) will be free too ? (the one with all GC features ?

    Anyway it's now 19:34 (GMT+1) and go to purchase your fabulous plugin right now !

    :D
     
  14. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @langju, it will absolutely be free. There are 2 major updates on the horizon both free:

    1. Multiplayer matchmaking with Apple UI and without the UI
    2. Advanced multiplayer matchmaking including player groups and attributes

    The first should only be a couple more days. The docs are already almost done and can be found here. You can see how monstrous the API is just from the documentation that is done so far. Advanced multiplayer is still probably more than a week away.

    For more information I highly recommend checking out Part 1 of the GameKit guide. (Part 2 covers the features of the separate GameKit plugin). Game Center Guide
     
  15. langju

    langju

    Joined:
    Jul 1, 2009
    Posts:
    207
    Hi prime31,

    No problem, i have some time :)

    First, Leaderboard, game achievements is already interesting (and now downloaded :) )... and anyway, i can wait a few week for the MP.

    thanks again.
     
  16. mattimus

    mattimus

    Joined:
    Mar 8, 2008
    Posts:
    566
    Purchased! I look forward to diving into this over the next couple weeks.
     
  17. impla007

    impla007

    Joined:
    Jan 30, 2010
    Posts:
    57
    Purchased also. With the help of the video, no problem to compile and make TestScene runs.:D

    Something I missed in the tons of apple docs.... How to setup leaderboards for sandbox environment ?

    For and app already in the appstore, it is easy to add leaderboards with itunes connect. But for testing purpose with a fresh new app not yet in the appstore, I haven't seen where to setup these data.
     
  18. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @impla007, for a new app, any leaderboards or achievements added will automatically default to the sandbox. The trick is to make sure you are always using a Debug build: image. Anytime you test with a Release build you are officially testing outside of the sandbox. It is also important that you open the Game Center application and log your normal user out. You must login through your test app to get in the sandbox.
     
  19. bumba

    bumba

    Joined:
    Oct 10, 2008
    Posts:
    358
    can you post your scores on twitter or facebook with game center?
     
  20. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @bumba, no you can't. Game Center is it's own little world.
     
  21. impla007

    impla007

    Joined:
    Jan 30, 2010
    Posts:
    57
    Thanks, I logout from game center app and it works just fine. Thanks for this plugin. Save lot lot of time :D
     
  22. Mello42

    Mello42

    Joined:
    May 30, 2010
    Posts:
    34
    This sounds great for people like us with no programming experience. Will you upload tutorials showing an example of a unity game build with game center running (form start to finish)?
    Also: we mostly work with Javascript (see above) do you think it would be useful for us to get your plugins (can we access those methods from a JS script)?
     
  23. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @mello, there is a short video showing how to setup Game Center here but it doesn't have a full game running. It is just the non-device side of things. All our plugins will work fine from Javascript or C# and they all include at least one sample scene that demonstrates how to use the key features.
     
  24. Mello42

    Mello42

    Joined:
    May 30, 2010
    Posts:
    34
    Thank you, can't wait to try it.
     
  25. bumba

    bumba

    Joined:
    Oct 10, 2008
    Posts:
    358
    so i guess we need a Twitter and Facebook Plugin :)
     
  26. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @bumba, fear not, the Social Plugin is already on the roadmap with Twitter and Facebook
     
  27. Mello42

    Mello42

    Joined:
    May 30, 2010
    Posts:
    34
    One last noob question: unity iphone pro is needed to use any plugin right?
     
  28. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @Mello42, Unity 1.7 Pro or any version of Unity 3. Unity 3 Basic is fully compatible with all plugins.
     
  29. Diego

    Diego

    Joined:
    Jul 30, 2008
    Posts:
    58
    Dumb question:

    Game Center requires iOS 4.1, am right?

    But some games, like this one:

    http://screencast.com/t/ZDAxMzc3MzM

    Specifies support for Game Center and the min iOS requirement is not 4.1. Could I support iOS 3.0 and above and use Game Center? Is there some way to link that API to use with previous versions of iOS?

    Thanks!
     
  30. minevr

    minevr

    Joined:
    Mar 4, 2008
    Posts:
    1,017
    I need more more money~~~ :?
     
  31. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    You must have 4.1 to use Game Center. There is no way around it. You can still target 3.0 though but you can't use Game Center there.
     
  32. Tilluss

    Tilluss

    Joined:
    Mar 5, 2010
    Posts:
    34
    It would be nice if you had a "Prime31 Pack" that includes all of the plugins so they don't have to be brought individually.

    Looks great though, I'm writing other apps at the moment but when i eventually get back to writing my game i'm pretty sure i'll be coming here for some bits.
     
  33. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @Tilluss, creating a pack is on the list but I really want to focus on all the most requested plugins first. There are a couple more to go then I can get back to cleaning up the website and getting pack purchase system together.
     
  34. Diego

    Diego

    Joined:
    Jul 30, 2008
    Posts:
    58
    So my game could run on iOS 3.0 and above and dynamically check if I could use Game Center (if iOS 4.1 is present), right?
     
  35. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @Diego, you got it. Check out the first method in the docs: docs
     
  36. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    Huge update just went live: Game Center multiplayer support is now live! New in this update:

    - multiplayer matchmaking using Apple's UI
    - programmatic matchmaking with no built in UI
    - support for accepting invites and automatic matchmaking on accepting the push notification
    - voice chat support (WiFi only)

    Tons of new methods are now exposed as well. Check the docs for more info.
     
  37. Pyroman311

    Pyroman311

    Joined:
    Aug 14, 2010
    Posts:
    87
    One question, just to make sure:

    The only UI I can change is the achievements/leaderboards inside the game itself, not the GameCenter app.


    I really hope they will change that...haha.
     
  38. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    Yup. You are stuck with that gross felt background for the Game Center app. The only way to avoid it is to close your eyes.
     
  39. langju

    langju

    Joined:
    Jul 1, 2009
    Posts:
    207
    Does the multiplayer is available throught 3G/EDGE (I mean without wifi) :)

    if yes ......it's incredible !!!
     
  40. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    Multiplayer is available over 3G and as far as I know EDGE but I can't image anything but chess would be useable on EDGE...Voice chat does required WiFi though.
     
  41. langju

    langju

    Joined:
    Jul 1, 2009
    Posts:
    207
    Wow. !

    Of course voice chat only over wifi.

    But a turn by turn game Or a well managed data 2 players game over 3G is cool !
    This avoid to havé some problem with The masterserver and nat punchthrought.

    Will make a little test :).
     
  42. impla007

    impla007

    Joined:
    Jan 30, 2010
    Posts:
    57
    Hi there,

    I have only one available iPhone and I want to test the multiplayer side..... :?
    So I am trying to get the plugin to work in the simulator.... with no succes.
    It compils and link fine and launch the app in simulator but the app crashes in the sim but not on the iPhone.

    Somebody tried yet ?

    Something I missed ?
     
  43. Hoff

    Hoff

    Joined:
    Jun 20, 2010
    Posts:
    223
    Prime, when do you sleep?

    hehe
     
  44. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @Hoff, I try to sleep on the first and third Thursday of every month. :twisted:
     
  45. wesrm

    wesrm

    Joined:
    May 20, 2009
    Posts:
    193
    Hi Prime31,

    The GameCenter plugin is awesome and very easy to use! Well done : )

    How can I use public static event GameCenterEventHandler reportScoreFinished with Javascript? I'd like to be able to make sure that a score has been submitted before a continue button is active. I'm not sure how to utilize the eventHandler in JavaScript.

    Thanks,

    Wes
     
  46. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @wesm, I personally don't use any Javascript/Unityscript at all so this is just a guess. Try something like:

    Code (csharp):
    1.  GameCenterEventHandler.reportScoreFinished = Delegate.Combine( reportScoreFinished );
    2.  
    3. function reportScoreFinished()
    4. {
    5.  
    6. }
    7.  
     
  47. wesrm

    wesrm

    Joined:
    May 20, 2009
    Posts:
    193
    Thanks Prime31! I'll give this a try.

    I'm also having trouble with public static bool isPlayerAuthenticated(). It keeps returning false when running my game through xcode. However, the GameCenter connection is running.

    I have a button that will showLeaderboardWithTimeScope even with the false isPlayerAuthenticated. I was sure to public use authenticateLocalPlayer() first. Basically, I don't want the show leaderboards button to appear if game is on a device without GameCenter.

    Am I getting false because I'm testing in the Sandbox?

    Thanks,

    Wes
     
  48. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @wesm, isPlayerAuthenticated() works for me. I did a test by first opening the Game Center app and logging out then opening the Unity app. (Be sure you are using a debug build.) Once the unity game opened, isPlayerAuthenticated returns false until I call authenticateLocalPlayer(). After that it returns true. authenticateLocalPlayer() doesn't return immediately though because it has to contact Apple's servers.

    If you want to check to see if Game Center is supported on the device, you will want to use isGameCenterAvailable().
     
  49. wesrm

    wesrm

    Joined:
    May 20, 2009
    Posts:
    193
    Thanks for the help Prime31.

    I'm not sure what's going on. Here is the code that I use to check for GameCenter. If I run this on a device without GameCenter iOS 4.0, the button is still showing up. It seems like using GameCenterBinding.isGameCenterAvailable shouldn't return true on a device running iOS 4.0.

    Code (csharp):
    1. //GameCenter
    2.     if(GameCenterBinding.isGameCenterAvailable)
    3.     {
    4.         //Authenticate Player
    5.         GameCenterBinding.authenticateLocalPlayer();
    6.         //Show Leaderboard Button
    7.         iTween.moveTo(webBtn,{"y":114.15,"time":.6,"delay":.8, "transition":"spring"});
    8.        
    9.     }
     
  50. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,427
    @wesm, my 2 devices are both updated to 4.1 but my iPad on 3.2 returns false....oh...as I type this I see the error. You have:

    Code (csharp):
    1. if(GameCenterBinding.isGameCenterAvailable)
    when you want to have:

    Code (csharp):
    1. if(GameCenterBinding.isGameCenterAvailable())
    Notice the extra pair of parenthesis. See if that clear it up for you.
     
unityunity