Hello guest! Login or Register

How to make a Facebook game

51 votes

Scores


If you have the user logged in with scores permission, you can use the scores actions. These can take several seconds to complete, so as with logging in, these work by using an action to make a request (like "publish score") which later triggers an event (like "On score submitted") when the action has completed.

Note that hi-score tables only show scores for the current user and their friends. You can't see all player's scores. This is how the Facebook Scores system works.

Also note that it is almost impossible to have a secure scores system in a javascript game. Hackers may be able to post fake scores. However, it shouldn't be important - scores are just a bit of fun, and fake scores can only be seen by that user and their friends, not everyone. So please don't worry too much about the security of hi-scores.

Not working?


At time of writing the Facebook platform is a little unreliable. The Facebook team appear to be constantly working on it, which means sometimes features are temporarily broken or unavailable. If you have problems, try again the next day.

You can also try changing some of the Advanced settings (with Basic settings open, click the Advanced link on the left menu). Here are some options to play with:

Sandbox mode: if you just want to test if the app is working for you, enable Sandbox mode. That makes the app visible only to you (and anyone else you've added as an app admin). Remember to disable it if you want your app to be public!

If the login screen doesn't appear to be working or is freezing (sometimes it gets stuck on XD Proxy), try setting Enhanced Auth Dialog to Disabled. This can fix problems with login.

The Canvas settings affect the appearance of the app inside the Facebook page when you click Go to app. You might want to try adjusting these, but generally Fixed width and Fluid height work well for most apps. Enabling Social Discovery should also help spread your app (it publishes things like "User is using MyApp").

Finally, you might want to try enabling Scores Auth Dialog Preview if you use scores.

If all else fails and you can't get it working, go to Account Settings - Apps and remove your app. Wait 5 minutes, then go back to your app. It should ask you to log in again.

Wrapping up


Last but not least, the Facebook plugin works on your own website as well! If the user visits your game's URL directly - outside of Facebook - they can still log in! That means you can still have users visiting your website directly logging in with Facebook, posting scores and so on. Very handy!

Now you can get publishing your games as Facebook apps, and enabling Facebook integration on your website too. Let us know how it goes, and be sure to post to the forum if you have any questions!

This tutorial is on multiple pages

Total of 8 edits. Last edit by Ashley on 24 October 2011 9:58 PM
Posted by

5
andreyin (1,136) Sunday, September 04, 2011 at 6:06:03 PM
Oh wow, that's simple! I thought I had to convert the code or something. Thanks.
4
The Bespectacled One (2,160) Monday, September 05, 2011 at 2:20:07 AM
Publishing my games on the largest current social network? Yes please!
7
SocialLie (9.9K) Monday, September 05, 2011 at 4:05:08 PM
I loved the idea to make directly for facebook, I am testing things in facebook last week, see here my little game maked in construct 2 to facebook =) http://apps.facebook.com/battlebrosgametest/?ref=bookmarks&fb_source=bookmarks_apps&fb_bmpos=3_
3
gammabeam (8.4K) Monday, September 05, 2011 at 4:32:07 PM
This is amazing, I made a small game and I was wondering if it would be possible to put it on Facebook.

Is there any way to make the game send your highscore to friends, like posting it on their profile?
4
Tom (11.9K) Monday, September 05, 2011 at 5:01:33 PM
It is possible to do high score posting to Facebook profiles yes! But it's a lot more involved. It's going to require a lot more work/research on our part to make it work fluidly with Construct 2 but it's something we want to add in to C2 at some point.
1
harrio (3.8K) Monday, September 05, 2011 at 8:47:01 PM
smiles warmly...
1
gammabeam (8.4K) Tuesday, September 06, 2011 at 2:38:58 PM
@Tom: Thanks for the reply!
I'll finish the game first, then I'll see if I can dig something about that. :D
0
TheJanMan (8.4K) Saturday, September 10, 2011 at 4:31:56 PM
This is just great! I bet Game Maker can't do this.... can they? ={
1
oreo (1,417) Monday, November 07, 2011 at 8:22:56 AM
Thanks for the tutorial! It helps me on my demo; http://apps.facebook.com/jumpingcow
2
squale (1,085) Tuesday, November 08, 2011 at 11:23:46 PM
Sorry for my english i am french.
I tried to do a facebook apps but facebook wish the https adress, have you an idee to help me ?
1
devilsgarage (808) Saturday, November 26, 2011 at 10:46:20 AM
I have to agree with 'squale' above. Facebook is currently asking for "Secure Canvas url" (ref: http://imgur.com/zfREq ) Is there a way to figure out what this means?
1
guicole (1,010) Sunday, November 27, 2011 at 9:33:55 PM
Hi, I have some trouble using the High score feature on the Facebook object.
And on the Scirra game, Space Blaster, I can see that the high score is always 0, like for my game.
Is that normal ? is there a problem there ?

Thx!
1
openabel (489) Friday, December 09, 2011 at 3:19:10 AM
thanks this is great
1
Ulisses (2,821) Saturday, December 10, 2011 at 1:57:36 AM
It's great!
2
danieltpt (643) Wednesday, December 14, 2011 at 8:41:21 AM
hi ashley,

thanks for the tutorial on the facebook app.

i tried to follow it but it seems a lot of the steps i cant follow as the screens are different when i log in to facebook.

maybe your tutorial needs to be updated? i would really like to create a facebook app.

thanks,
dan


You need to Login to post a comment!
Login to your account, or register a new account