Facebook Instant games

Hi Playcanvas,

I tried to get a sample project up on facebook today and found tons of problems…
Is there any plan to have a step by step tutorial and show the tricks to override the playcanvas
loading bar with the facebook one and how to talk to their API (like creating a highscore table etc.)

Is anybody out there who recently released a game on facebook?

Hi @pepone3d,

Here is the official tutorial on how to get a Playcanvas build to Facebook Instant games:

https://developer.playcanvas.com/en/user-manual/publishing/web/facebook/

On to talk to their API it shouldn’t be any different than any other Javascript/web based SDK, so you can use the official Facebook dev docs on this.

Also if you search on these forums with Facebook or something similar you will get a number of related posts.

I hope this will be usefull for you

Hi Leonidas, thanks for the reply - you can be sure I checked the tutorial and every related post on the forum. Unfortunately that tutorial has nothing to do with the facebook console as it is today. And there about 5 related post how to modify the playcanvas files to finally get it running…
It’s more a question to Will and the other cool guys if there would be a possibilty to make a ‘Export for FB Instant Games’ in the Pro Version I am paying for each month :smirk:

It’s hard, as Luis_Mb said to have no really working workflow…

I understand. Let’s invoke @will on this:)

I have a couple games on Facebook Instant, which problems are you having? @pepone3d

Hi Yohami,
no current problems, I just was overdosed by the new facebook implementation and need to be sure I’ll get everything running if the possible client really orders the game… and I am not such kind of hardcore html guy to edit all the loader scripts - coming from the Unity 3D area :stuck_out_tongue_closed_eyes:

1 Like

Hi everyone,

After digging for examples or instructions on how to make a Facebook Instant Game with Playcanvas, I found this link and it’s from this year (Yaay !!) and I thought this time I was finally going to find out how it works but just like every other post in the forum, it ends with a Hitchcock (found another that ended with a helpful forum member solving the problem for OP… by direct message… FML).

Would anyone be kind enough to post some instructions or even better a public example project ?

EDIT: @Yohami_Zerpa, I would love to know where to put the JS given by FB to load the SDK, how to add the <script> tag to load instant game sdk from the cdn and most of all, where to put the setScore() call

That’s now pretty easy as there’s a project setting for external JS files https://developer.playcanvas.com/en/user-manual/designer/settings/#external-scripts

@yaustar So I put the Instant Games SDK as external script and I can expect the FBInstant global variable to be available in my game scripts ? Like if I want to call FBInstant.game.setScore(), I just to it in my game script that handles the Game Over event ?

In theory, yes as long as the SDK creates that FBInstant object. I’ve not used FB Instant SDK before so can’t tell you for sure.

Thanks !

I will try, if it works, I will make a public example of a FB Instant Game

@GrosJack You can put it as external script, but you will not be able to access FBInstant outside of facebook servers. The SDK works only in their environment, so you would need to upload your app to Facebook first. You can set up a localhost server that is self signed and configured to connect to Facebook. They have a guide on their docs how to do it. Then you dont need to upload to their servers, but instead you can run your app on a local server. Running the app from the Playcanvas Editor by pressing Launch will not be possible.

1 Like