Facebook instant game

I have created a multiplayer games. I have tested both locally and online. It works. now I am trying to upload the game to Facebook as Facebook Instant Game. I have uploaded successfully. but I have found out 2 problems.

  1. Uncaught TypeError: this.facebook is undefined.
    It seems I need to tell the game config to load that plugin. I have read through and follow two years ago tutorials from Phaser.io. but I can’t find any examples that works with current version of Phaser.
    type script definition file says “This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.”. How do I fix it?

  2. I realized I have been using some node modules lib such as socket.io. I don’t know how can I upload or reference those from my html. In my server I just run node server and those are okay. how can I bundle those inside a zip folder to upload to Facebook and reference correctly?

Please Help.

I have fixed no.2 by myself. I just need to download socket.io.js and put it inside a folder and just need to reference directly for the client code which I need to upload to Facebook.

No.1 is probably my error as well. But still can’t test properly I need to set up https in my localhost first to test efficiently. right now so far the game is running but not progressing from loading screen.

ok, I have fixed both 1 and 2.
but there is another possible bug from phaser. I can’t use multiple scene. It start the last scene instead of first scene. I’t okay. I can rearrange it just for facebook instant game. but I can only run one scene. I can’t switch or start another scene. btw all my codes were working fine before I tried to use “phaser-facebook-instant-games.js”. anyone successfully use instant game with multiple scene before? please anyone?

Update:3 . I just realized, if i include phaser-facebook-instant-games.js, I don’t need to include “phaser.js” anymore. now the game is running as expected. now it show loading progress correctly and the in game objects. but it crashed somewhere. but anyway now almost done.

1 Like