Experiences with Google Play services and CocoonJS

Discussion and feedback on Construct 2

Post » Mon Sep 15, 2014 11:15 am

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?

Image

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?
Last edited by Momio on Wed Sep 17, 2014 2:26 pm, edited 1 time in total.
B
26
S
7
G
1
Posts: 74
Reputation: 2,092

Post » Wed Sep 17, 2014 2:25 pm

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!
B
26
S
7
G
1
Posts: 74
Reputation: 2,092

Post » Tue Dec 30, 2014 2:43 am

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.
B
9
S
1
Posts: 16
Reputation: 570

Post » Wed Dec 31, 2014 3:23 pm

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.
B
26
S
7
G
1
Posts: 74
Reputation: 2,092


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests