Publish to Facebook Instant Games

    Currently Cocos Creator does the work for users including:

    • Integration with Facebook Instant Games SDK and automatic initialization, allowing users to call the relevant APIs directly
    • One-click packaging process in the Cocos Creator build panel to package games directly to Facebook Instant Games specifications

    What the user needs to do:

    • Call the Facebook Instant Games SDK to access platform-related features
    • Upload the packaged version of Cocos Creator to Facebook
    • Build the game using Cocos Creator
    • Upload to Facebook backend
    • Test the game
    • Share your game in Facebook
    1. Open the project to be published using Cocos Creator and open the Build panel from the Menu bar -> Projects. Select Facebook Instant Games from the Platform in the Build panel.

      Please refer to Build Options for general build options, Facebook Instant Games-specific build options are listed below, please refer to the Build Options section below for more information.

      fb-instant-games-options

    2. Once the build options in the Build panel are set, click Build button. When the build is complete, click the folder icon button in the bottom left corner of build task to open the project release package, you can see that the (whichever is the name of the specific build task) folder has been created in the default release path build directory, which already contains the zip file of the Facebook Instant Games environment fb -instant-games.zip.

    Create a new app in Facebook backend, add small games in Add products, set the game category, and save the changes. (For details, please refer to )

    Click the Small Games -> Web Hosting tab on the left side of the app panel, click Upload Versions, and upload the file from the fb-instant-games directory to the Facebook hosting service.

    upload

    When the version status changes to “Standby”, click the “★” button to push the build to the “Production” environment.

    Enable the https-enabled web server locally

    • Next, create the private key and certificate via openssl.

    • When the private key and certificate are ready, the Web service can be started locally via SSL: the

    Preview games under Facebook domain

    To use all the features of the Facebook Instant Games SDK, you need to open and be careful to replace the link YOUR_ GAME_ID in the link and replace it with the application number you created in the Facebook backend.

    Then you can see the game running successfully.

    game

    Click the Games tab in the application panel, select Details, and pull down the Details page to the bottom to see the section shown below, select Share Game to share the game directly to the Facebook dynamic message.

    For details, please refer to .

    Developers can create the directory under the Creator project folder to customize them according to their needs, and then copy the published files into that directory to customize them: ##

    • fbapp-config.json: this is the configuration for the whole package, go to official introduction
    • : Here you can modify the introduced Facebook Instant Games SDK version
    • index.js: Here you can modify the SDK initialization and progress bar

    The Creator is integrated with the Instant Games SDK provided by Facebook and is automatically initialized when the game is loaded (initializeAsync and startGameAsync). Users can access it directly through the FBInstant module, see Instant Games SDK for instructions. In addition, Facebook also provides a Facebook SDK for JavaScript to access Facebook’s social features, which can be accessed through the module. However, this SDK Creator is not integrated and needs to be introduced manually by the user, see .