Experiences with Google Play services and CocoonJS

0 favourites
  • 4 posts
From the Asset Store
Google Analytics 4 Plugin for Construct 3 enables metrics and analytics for your games easily.
  • Hi!

    After a lot of trial and error, I have (kind of) implemented google play leaderboards on my game (Im using CocoonJS)

    But for some reason the submit score action doesnt seem to be working....am I doing something wrong?

    Its a racing game: As you can see, I have several leaderboards and I check on wich track the race was and if it was on regular or "mirror" mode and asign the leaderboard code to a variable accordingly.

    The social services and leaderboards are correctly implemented on the game, since it logs on google play perfectly and I can request the leaderboards with no problem....but they are empty, so the submit code im showing you guys here is not working for some reason...any ideas?

    My app is not published yet, its in beta...maybe I cant actually submit records while in beta mode?

    -Second question:

    How can I request a list of all the leaderboards of the game?

    Im not much into mobile gaming, but I saw this before on some games and I think its more convenient, but I have no idea of how to reference to a leadeboard list instead to a specific leaderboard...

    -And finally:

    I thought of always submitting your record time for the current track when finishing a race...If you dont beat your record on the current game, the current record would be submitted instead of the time you just did.

    By doing this I want to cover the case that something went wrong with the submit (not logged on google play or not connected to the internet at the moment) when you actually stablished the record on a previous game...

    Is this a good idea? Or will it lead to duplicate entries on the leaderboard?

  • M'kay, hate to bump my own thread, but although im not getting answers here I'll share the advances I made in the case that it can help anyone on my situation...

    What I was doing wrong when submitting scores is just submiting the variable the way it is. Google services needs the score to be an int (at least if the leaderboard is time based, as in my racing game) so you need to use int()

    Also, if you measure time in seconds as I do (just adding dt every tick to the time variable) you have to be careful when submitting the time because google expect milliseconds instead of seconds.

    So, fixed from the screencap on my previous post, the submit action would be sending int(Chronometer.total*1000) instead.

    In any case, when showing a leaderboard, things get unstable, at least on my game. When trying to return to the game from a leaderboard, sometimes it goes well, sometimes the game reboots, and sometimes the game just closes.

    (Im using the latest cocoonJS plugin from github and since it apparently doesnt work well with recent C2 versions I donwgraded to r173)

    Im still stuck at how to show a list of all the leaderboards of the game instead of a specific one....I read on ludei's site that if I just dont specify any leaderboard ID you get the list, but it doesnt work at all for me.

    I read on some tutorial that the google play C2 object only works on browser and not on mobile app...is this true, or it is worth a try? (for the moment im exclusively using cocoon actions)

    Any help would be appreciated!

  • Hello. Thank you for posting this. I've been trying things around and wondering why the submitting score doesn't work. Sorry, I couldn't help with your problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for answering, as I said before I managed to make it work, the problem I had was that the data I was trying to submit was not correctly formatted for a time score.

    Still didnt manage to show a list of leaderboards, although I already released my game months ago and dindt really look further into it.

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