0 Favourites

CocoonJS and Game Center Question

  • I was just curious if anyone has successfully implemented Game Center (iOS) leaderboards into their CocoonJS game?

    I've searched through posts and have seen that older versions of CocoonJS was not capable, but based on Ludei's site it is capable now and even have an example of it (although the example doesn't bring up Game Center like it is supposed to). Paired with Ludei's terrible documentation and "tutorials", I have had a frustrating time trying to get leaderboards into my iOS game.

    Just for reference:

    I have a iOS developer account

    I set up a leaderboard in iTunes Connect with an ID that I put into the CocoonJS plugin in C2

    On Ludei's Dev Portal, I have checked the Social checkmark for Game Center

    I have cloud compiled it and ran it NOT on the simulator, but on my iPhone 5s

    Is there something else I'm possibly missing or some sort of setting in Xcode they do not mention needs to be changed? Any help is appreciated because this is one of the last few things I need to finish before I can release my game.

    Thanks everyone!

  • As you hinted, its a nightmare to get started due to absolutely horrendously poor documentation from Ludei (I guess because the plug-in is not finished)...

    What you need to do (it would seem)

    1) Install C2 build 168

    2) download the plug-in from Ludei's blog and manually install by copying the contents of the plug-in folder into the coocoonjsads folder in the plug-ins folder, AND copy the cocoonjs_prelude.js file into the html5 folder.

    3) DON'T UPDATE C2

    4) You MUST set the cocoonjs plug-in in Spriter to EITHER google play OR game-center but NOT "automatically select based on platform"

    best of luck,

    Mike

    this is what worked for me.

  • Brashmonkey

    Thanks for that! I will try that, but is there any logic in why it's got to be build 168?

    I will have to make sure nothing in my game uses the newer functions that are in the later builds..hmm.

    Thanks again!

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • The only logic is that the attempts I made to use the plugin (cocoonjs) with the latest beta or stable have failed... only 168 seems to work...I think because ludei is trying (slowly it would seem) to get it fully working and stable before making sure it works with the latest build.... then I'm sure documentation will take quite some time after that.

    best of luck.

    -Mike

  • I was just curious if anyone has successfully implemented Game Center (iOS) leaderboards into their CocoonJS game?

    I've searched through posts and have seen that older versions of CocoonJS was not capable, but based on Ludei's site it is capable now and even have an example of it (although the example doesn't bring up Game Center like it is supposed to). Paired with Ludei's terrible documentation and "tutorials", I have had a frustrating time trying to get leaderboards into my iOS game.

    I got it working on my game (Trambo) earlier this year. I think I was using compiler version 1.4.7 and the latest C2 beta that was available then.

    Later I updated the game with 2.0.0 and the Game Center stopped working. FFUU.

    Now then, I am updating the game again tomorrow - this time using r172 (I think) and 1.4.7. The game seems to at least connect to the Game Center normally and it seems the score posting is working as well.

    I'll keep you updated in case something goes terribly wrong tomorrow. I can also post the code I am using in C2 if it works fine.

    Laters!

  • Brashmonkey Ah yea I see I see, well hopefully that is the case!

    robotecollective thanks for the info! Yea it's quite frustrating having to rely on these other services/programs to be able to build apps. Yea let me know how it turns out and whatever kind of suggestions you have that worked for you.

    One thing I thought of the other day which actually caused me more problems: Which version of the CocoonJS plugin are you using in C2? Before I was just using whichever version was in the regular C2 install but realized the example file Ludei showed had some other functions that were not available in the version I have. So I downloaded the one from Github and used that version but now when the app starts up and tries to do something with Gamekit it just stays at a black screen....

    Man mobile games from C2 to CocoonJS has been quite an uphill battle, at least for me.

  • thanks for the info! Yea it's quite frustrating having to rely on these other services/programs to be able to build apps. Yea let me know how it turns out and whatever kind of suggestions you have that worked for you.

    One thing I thought of the other day which actually caused me more problems: Which version of the CocoonJS plugin are you using in C2? Before I was just using whichever version was in the regular C2 install but realized the example file Ludei showed had some other functions that were not available in the version I have. So I downloaded the one from Github and used that version but now when the app starts up and tries to do something with Gamekit it just stays at a black screen....

    I am using the latest build from Scirra (always) and when I compile through the Ludei cloud service, I choose version 1.4.7. With the launcher I always test with the latest version they have on App Store. Game Center does not work there.

    Today our tests prove that Game Center works when using 1.4.7 version of the compiler - an old player successfully updated his score and a new player got his score through. WOO! We may get some more attention to our game tomorrow, that is way I am testing this now.

    I can post the code for you that works, if you want.

    Man mobile games from C2 to CocoonJS has been quite an uphill battle, at least for me.

    Haha, yeah - I feel you. Just hang in there. Things are getting better all the time and C2 is really a great little piece of software. Just look at these devs, they are here literally every day, answering questions that we have. I think they deserve our support.

  • Edit: double post. Mods, feel free to delete this.

  • Also, check out this bug report I got from one of our players:

    "If I visit gamecenter for TRAMBO it makes my ipad crash. Then every time I visit gamecenter again after that it crashes. I can only get out of the cycle by visiting gamecenter in airplane mode. So... Yeah, I hope your update fixes it!"

    That was our last update using CocoonJS compiler version 2.0.0... YIKES.

  • robotecollective awesome news! Well hopefully the update goes through quickly...wish updating on the store was a bit quicker.

    Have you tried 2.0.1 at all? That is the one I been using but yea no dice on the GameCenter. I will have to try out the 1.4.7 compiler then, but I guess I will have to roll back my C2 because I installed that CJS plugin which caused more problems when compiled.

    Yea I would totally love to see an actual working example of game center, even just a small snippet would work for me, just to make sure I'm trying to call it at the right time and using the right ones, that would be fantastic!

    Thanks again!

  • robotecollective awesome news! Well hopefully the update goes through quickly...wish updating on the store was a bit quicker.

    Have you tried 2.0.1 at all? That is the one I been using but yea no dice on the GameCenter. I will have to try out the 1.4.7 compiler then, but I guess I will have to roll back my C2 because I installed that CJS plugin which caused more problems when compiled.

    Yea I would totally love to see an actual working example of game center, even just a small snippet would work for me, just to make sure I'm trying to call it at the right time and using the right ones, that would be fantastic!

    I tried all of the compiler versions, except the newest which rolled out yesterday. Only the 1.4.7 works so far. I really hope Ludei will fix it, as our next game really needs global hiscores.

    Anyways, here is how I do it:

    First you need to set up the leader board on iTunes Connect in your app settings and give your leader board a name. I called it "GlobalHighTrambo".

    Then, on the first (menu) layout:

    On Start of the layout - CocoonJS - Request login (this connects the player to the GC and the "Welcome back, player!" message appears when player starts your game)

    Then on my game over state I store the hiscore to a variable "GCHighScore" and call CocoonJS again, this time:

    CocoonJS - Submit score of "GCHighScore" to Game Center leaderboard "GlobalHighTrambo".

    That is all, actually. Let me know, if you have any questions.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)