It just happened today; I am just trying to use facebook for game score leaderboard. sadly
https://developers.facebook.com/blog/post/2018/04/04/facebook-api-platform-product-changes/
https://developers.facebook.com/docs/graph-api/changelog/breaking-changes/#games-4-4
It says:
Games API
Updated:
Changed Instant Games context.getPlayersAsync() to only include players who have played a game in the specified context (e.g. a Messenger thread or Facebook Group).
Deprecated:
A number of Games APIs around scores and achievements. We are also removing the invitable friends API for Facebook web games, which allows an app to invite people who haven't played the game before. App requests for existing players of a game will continue to function normally.
Is there an alternative way to post and obtain a user's game score?
The goal would be to replace this with Leader Boards.
You can store information about the score itself.
For example, you could store the new Avg score as the value and then how many games were played to get that average. This means that you can then update the Average correctly when you get an update. You can also create leaderboard from the API, giving you the ability to create a leaderboard per match.
To explain better I would have to have some kind of context for your game that you have and I attach below a very simple link to theleaderboard example put together by Facebook.
https://developers.facebook.com/docs/games/instant-games/guides/using-leaderboards/
Your focus would be on the other data about the score. That is what you want to look at. You will want to look into storing an array or JSON formatted information there.
Related
I'm making a mobile game in Unity.
I would like to have a leaderboard of high scores for a person and their facebook friends who have also played the game.
Also I would like for a push notification to be sent to a player if one of their friends beats their high score.
Would it be possible to achieve those two things using facebooks game service? Or would I need to write a server of my own to handle this?
(ps. its ok if for example the person who got the high score is asked 'would you like to tell derp, herp and glerp that you beat their high scores' and it works that way)
I'm asking here as facebooks game service doesnt seems to have anyone I can email for support or even a forum (Only a closed facebook group which I am still pending)
Facebook allows you to store 1 variable per user, so you could use that to store a score for each user and make a leaderboard based on that.
For push notifications there are two different kinds, one is actually called local notifications and you can make those for free without a server, but the user has to open the app for you to schedule them.
If you want to use the push notifications to react to a user beating a score you would either have to have your own server or use one of the many services out there. Some are even free like this one: https://onesignal.com/?gclid=CjwKEAjwm_K_BRDx5o-sxq6ouXASJAC7TsFLhiWC9-XUm1Sryg6zgEeQU49wLR7_H3WzzwOAnhX_exoCYIzw_wcB (you would have to read up on it though, I just searched around a bit.
You can also ask your user if they want to tell their friends on facebook that they beat their score, but before you can do that you will have to gain the permission of the users involved. Once you get in to the facebook documentation there is a guide on how to do this.
Hope it helps
Peter
I have been working with the Prime31 Social Media plugin to post a user's score from a Unity game that has been built for ios and android. After a long discussion with someone on the support forums for Prime31 it ended with he thinks that Facebook won't publish open graph stories when a user updates the score if the app is on a mobile device, that that is a feature reserved for native Facebook apps.
This makes little sense to me as I'm sure i've seen open graph score updates from games like Candy Crush and I believe the plugin makes the same call to update the score as you would if you were using PHP in a native Facebook app.
Currently I can post the user's score and find their score using the Open Graph Explorer, it is being updated on Facebook, however it has never been published anywhere. I have tried to make it a high score and even had another account that was my friend pass my score in the game. It never published the score for either user.
I know there are a few questions on Stack that are the same, but I have checked for every solution that was proposed in each question with no result.
Here is what I already know:
When I look up the scores for my account in the open graph explorer,
the score is there, so it makes it to facebook and is saved as my
score for the app, but it is never posted to my news feed or activity
stream.
I know that facebook won't post the story unless it is a high score
or a score that has been passed by a friend. The scores I am posting
increment, they have always been higher than the previous and it has
never been published.
I do have the publish_actions permission authorized
I have the 'web' selected in the app settings and it is categorized
as a Game.
I have been able to post to my wall before so I know the code to
login and authenticate works, I also know because the score it being
set in the facebook api, as mentioned above.
The link to the prime 31 support forum here
Does anyone know how these kind of functionality can be implemented?
How can we get PlayNow kind of link ( I want to add my own custom link at that place)
How to get user images on this kind of aggregation.
As far as I can tell, this is a custom implementation from Facebook that you cannot control. Facebook provides custom aggregation on the newsfeed for certain popular actions, such as playing games, reading news or watching videos. As you can see in the aggregation you have posted, each app is different.
When a certain set of users read news using your app, and Facebook chooses to display an aggregation of "X and y more friends recently read articles" on those users' friends' news feeds, your app might come in that aggregation. The "read now" button comes on its own, since Facebook understands what your object is.
The aggregations you can control are those that consist of only your app, and you can do that in the Open Graph panel for your app on the Developer site. Just go into aggregations and design it to your choice. This is how I implemented it for myself:
This is how it would look like in a user's Home Feed. The text, "Share your twocents about Dil Chahta hain..." can be set up according to your requirements.
Secondly, you can control the aggregation for your own app on a user's timeline. This is how my app's aggregation looks on a user's timeline. Do note that currently, only two aggregations are shown for a user, instead of 3 as is displayed in my image (which was taken prior to the approval stage).
That is an aggregation that facebook is making for a specific type of applications: Games.
You can set your app as a Game in the app settings, first tab (Basic) first section (Basic Info) in the Category field.
If you do that then facebook should include your "game" when they aggregate this feed story to friends.
If you do that how ever then you can't change the text from "Play Now", as far as I'm aware.
Using the open graph you can define the obejcts which your app uses and the actions users do on them.
Then you can control how the stories produced by your app are aggregated into the timeline of a user.
The official guide is pretty straight forward and have good examples that you can follow to understand how things work.
If you have a more specific question regarding the open graph then ask away.
I am developing an app for Facebook. I wish to do a feature to show last login player to my apps, by using graph API. however, I can't find any object which enable me to do so. Is there any way to indicate user login? As I wish to build a "recent played friend", which I need information of the player last login to apps to do so. For example, if I want all the player's score in the apps, I can use "scores" API and it will return all the friend in this apps score. but do login enable me to do the same as well?
I found the only object which provide time stamp is "achievement" object. However, this object I planned to keep it for the future.
I want to merge my High Scores with facebook.
In other words, I don't want to mantain my own score server but I would like to let make the dirt work to facebook.
So I want to publish new scores and retrieve them to display in my game.
Can I do it? What API can I use? Is it possible with REST?
EDIT: Many games in fb show global scores & friends score. How can I do it?
You could write data to fb with this: http://wiki.developers.facebook.com/index.php/Data_Store_API_documentation
However, i'd reccomend using a more stable mature platform like Google app engine. Facebook's API's have been extremely flaky lately, and when I was using the facebook datastore, I'd often find it to be slow and even worse, return inconsistent results.