Facebook Leaderboard - Get Json Instead Of Webview

Looks like it didn’t grab the token and user ID properly, so yeah, it would definitely have come back as an Error 400.  I’ve cobbled this code to get the necessary info I wanted:

function faceListener( event ) if event.isError then -- problem with Facebook connection else if event.type == "session" and event.phase == "login" then -- successful log in if event.token and facebookToken == nil then facebookToken = event.token print( "Facebook Access Token captured: " .. facebookToken ) end -- while we've logged in, circle around and grab personal info facebook.request( "me" ) elseif ( event.type == "request" ) then local response = event.response print( "Facebook unparsed response: " .. response ) if event.isError then -- error detected in request else response = json.decode( event.response ) if response.id and facebookUserID == nil then facebookUserID = response.id print( "Facebook User ID captured: " .. facebookUserID ) end if response.username then print( "Username: " .. response.username ) end if response.name then print( "Full Name: " .. response.name ) end if response.first\_name then print( "First Name: " .. response.first\_name ) end end end end end

 

Now, it comes back with a {“FACEBOOK_NON_JSON_RESULT”:“true”} when I post the high score, but I can’t find it anywhere in my timeline or activity.  Almost there, but something’s amiss.  Did you have to make any particular changes on the App’s details in the Facebook Developer page for it to work?

@Naomi: By any chance have you experimented with the Achievements API? Score would be great in that it’s extremely simple, but I had the idea of hiding the actual points. I.e. rather go with “you achieved 92% of the high score”, “you beat the high score”, which is not possible with Score but would be with Achievements (as far as I see). That said capabilities of Achievements are far greater than my needs, so I’m afraid I’m entering a world of hurt with it :slight_smile:

@beyondthetech, I do not know when the score would start showing up on the timeline or activity.

 

@matias.kiviniemi, I haven’t tried FB Achievements.  If you sort it out, let us know how it works.

 

Naomi

Ok, I’m getting a little closer.

 

On their Scores API page, Facebook says,

“Note that this API is only available to applications categorized as ‘Games’. You can categorize your app as ‘Games’ in the Developer app by navigating to About > Basic Info and selecting 'Games` in the drop down menu in the category field.”

 

However, there’s no setting there. Are they referring to the App Details page, which it does appear there, and do you need to “Submit App Detail Page” before scores will show up, even on your own timeline for debugging purposes?

Hey, @beyondthetech, your guess is my guess.  I have not submitted the app detail page yet.  My latest game app is approved by Apple, but I haven’t released it yet, and because it’s not released, I wasn’t sure if FB question “What platforms are listed for your app in App Center” would cause me problem by submitting before the app is available for sale.  But maybe I’m over thinking it.  Who knows?

 

Naomi

 

P.S.  After all said and done, maybe you can put together FB Score API how-to for everyone, especially since you’ve just gone through it and have a fresh memory/experience to draw upon. :slight_smile:

@BeyondTech, I like Naomi’s idea… I’m just getting started with sorting out posting a score to FB and would love to be able to learn from your experience. Please keep us posted if you can share any notes! Thanks :slight_smile:

@BeyondTech, I like Naomi’s idea… I’m just getting started with sorting out posting a score to FB and would love to be able to learn from your experience. Please keep us posted if you can share any notes! Thanks :slight_smile:

@Naomi: how many facebook leaderboards can a game have? is it possible to have an overall leaderboard, and one for ever single level? (100 for example)?

@dingo:

A Facebook game can have 1,000 Achievements (https://developers.facebook.com/docs/games/achievements)

A Facebook game can have only 1 Leaderboard or score per user per app.  (https://developers.facebook.com/docs/games/scores)

You might be able to achieve muliple scores using Parse along side of Facebook. See https://parse.com/questions/leaderboard-architecture-for-game-with-many-separate-player-facing-leaderboards

You will find this a good read as well:
https://developers.facebook.com/blog/post/2012/03/05/games-update–expanding-distribution-for-scores-and-achievements/

https://developers.facebook.com/docs/games/tutorials

Apple’s Game Center :

You can define up to 100 different leaderboards for a game (or game group) if your game does not support leaderboard sets. The number of different leaderboards allowed increases to 500 leaderboards per game when leaderboard sets have been enabled. Each leaderboard has its own score type, sorting order, and formatting information. When you implement multiple leaderboards, you choose what sort of score data to record in each leaderboard, which essentially means that each leaderboard may have its own scoring mechanism, if desired.

Amazon’s GameCircle :

You can create up to 50 leaderboards for each game that you have in the Amazon Mobile App Distribution portal.

tschussler, thanks for the info.

and i guess its not possible to save userdata with facebook.

so i’ll have to stick to my own backend then :slight_smile:

@Naomi: how many facebook leaderboards can a game have? is it possible to have an overall leaderboard, and one for ever single level? (100 for example)?

@dingo:

A Facebook game can have 1,000 Achievements (https://developers.facebook.com/docs/games/achievements)

A Facebook game can have only 1 Leaderboard or score per user per app.  (https://developers.facebook.com/docs/games/scores)

You might be able to achieve muliple scores using Parse along side of Facebook. See https://parse.com/questions/leaderboard-architecture-for-game-with-many-separate-player-facing-leaderboards

You will find this a good read as well:
https://developers.facebook.com/blog/post/2012/03/05/games-update–expanding-distribution-for-scores-and-achievements/

https://developers.facebook.com/docs/games/tutorials

Apple’s Game Center :

You can define up to 100 different leaderboards for a game (or game group) if your game does not support leaderboard sets. The number of different leaderboards allowed increases to 500 leaderboards per game when leaderboard sets have been enabled. Each leaderboard has its own score type, sorting order, and formatting information. When you implement multiple leaderboards, you choose what sort of score data to record in each leaderboard, which essentially means that each leaderboard may have its own scoring mechanism, if desired.

Amazon’s GameCircle :

You can create up to 50 leaderboards for each game that you have in the Amazon Mobile App Distribution portal.

tschussler, thanks for the info.

and i guess its not possible to save userdata with facebook.

so i’ll have to stick to my own backend then :slight_smile: