Difference between revisions of "* Initialisation and Core"
Line 43: | Line 43: | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Methods === | === Methods === | ||
− | [[FBInstant.canCreateShortcutAsync]] ''<translate>Returns whether or not the user is eligible to have shortcut creation requested.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.canCreateShortcutAsync|FBInstant.canCreateShortcutAsync]] ''<translate>Returns whether or not the user is eligible to have shortcut creation requested.</translate>''<br/> |
− | [[FBInstant.checkCanPlayerMatchAsync]] ''<translate>Checks if the current player is eligible for the matchPlayerAsync API.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.checkCanPlayerMatchAsync|FBInstant.checkCanPlayerMatchAsync]] ''<translate>Checks if the current player is eligible for the matchPlayerAsync API.</translate>''<br/> |
− | [[FBInstant.createShortcutAsync]] ''<translate>Prompts the user to create a shortcut to the game.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.createShortcutAsync|FBInstant.createShortcutAsync]] ''<translate>Prompts the user to create a shortcut to the game.</translate>''<br/> |
− | [[FBInstant.getEntryPointAsync]] ''<translate>Returns the entry point that the game was launched from.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.getEntryPointAsync|FBInstant.getEntryPointAsync]] ''<translate>Returns the entry point that the game was launched from.</translate>''<br/> |
− | [[FBInstant.getEntryPointData]] ''<translate>Returns any data object associated with the entry point that the game was launched from.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.getEntryPointData|FBInstant.getEntryPointData]] ''<translate>Returns any data object associated with the entry point that the game was launched from.</translate>''<br/> |
− | [[FBInstant.getInterstitialAdAsync]] ''<translate>Attempt to create an instance of interstitial ad.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.getInterstitialAdAsync|FBInstant.getInterstitialAdAsync]] ''<translate>Attempt to create an instance of interstitial ad.</translate>''<br/> |
− | [[FBInstant.getLeaderboardAsync]] ''<translate>Fetch a specific leaderboard belonging to this Instant Game.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.getLeaderboardAsync|FBInstant.getLeaderboardAsync]] ''<translate>Fetch a specific leaderboard belonging to this Instant Game.</translate>''<br/> |
− | [[FBInstant.getLocale]] ''<translate>The current locale.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.getLocale|FBInstant.getLocale]] ''<translate>The current locale.</translate>''<br/> |
− | [[FBInstant.getPlatform]] ''<translate>The platform on which the game is currently running.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.getPlatform|FBInstant.getPlatform]] ''<translate>The platform on which the game is currently running.</translate>''<br/> |
− | [[FBInstant.getRewardedVideoAsync]] ''<translate>Attempt to create an instance of rewarded video.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.getRewardedVideoAsync|FBInstant.getRewardedVideoAsync]] ''<translate>Attempt to create an instance of rewarded video.</translate>''<br/> |
− | [[FBInstant.getSDKVersion]] ''<translate>The string representation of this SDK version.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.getSDKVersion|FBInstant.getSDKVersion]] ''<translate>The string representation of this SDK version.</translate>''<br/> |
− | [[FBInstant.getSupportedAPIs]] ''<translate>Provides a list of API functions that are supported by the client.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.getSupportedAPIs|FBInstant.getSupportedAPIs]] ''<translate>Provides a list of API functions that are supported by the client.</translate>''<br/> |
− | [[FBInstant.logEvent]] ''<translate>Log an app event with FB Analytics.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.logEvent|FBInstant.logEvent]] ''<translate>Log an app event with FB Analytics.</translate>''<br/> |
− | [[FBInstant.matchPlayerAsync]] ''<translate>Attempts to match the current player with other users looking for people to play with.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.matchPlayerAsync|FBInstant.matchPlayerAsync]] ''<translate>Attempts to match the current player with other users looking for people to play with.</translate>''<br/> |
− | [[FBInstant.onPause]] ''<translate>Set a callback to be fired when a pause event is triggered.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.onPause|FBInstant.onPause]] ''<translate>Set a callback to be fired when a pause event is triggered.</translate>''<br/> |
− | [[FBInstant.quit]] ''<translate>Quits the game.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.quit|FBInstant.quit]] ''<translate>Quits the game.</translate>''<br/> |
− | [[FBInstant.setLoadingProgress]] ''<translate>Report the game's initial loading progress.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.setLoadingProgress|FBInstant.setLoadingProgress]] ''<translate>Report the game's initial loading progress.</translate>''<br/> |
− | [[FBInstant.setSessionData]] ''<translate>Sets the data associated with the individual gameplay session for the current context.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.setSessionData|FBInstant.setSessionData]] ''<translate>Sets the data associated with the individual gameplay session for the current context.</translate>''<br/> |
− | [[FBInstant.shareAsync]] ''<translate>This invokes a dialog to let the user share specified content.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.shareAsync|FBInstant.shareAsync]] ''<translate>This invokes a dialog to let the user share specified content.</translate>''<br/> |
− | [[FBInstant.startGameAsync]] ''<translate>This indicates that the game has finished initial loading and is ready to start.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.startGameAsync|FBInstant.startGameAsync]] ''<translate>This indicates that the game has finished initial loading and is ready to start.</translate>''<br/> |
− | [[FBInstant.switchGameAsync]] ''<translate>Request that the client switch to a different Instant Game.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.switchGameAsync|FBInstant.switchGameAsync]] ''<translate>Request that the client switch to a different Instant Game.</translate>''<br/> |
− | [[FBInstant.updateAsync]] ''<translate>Informs Facebook of an update that occurred in the game.</translate>''<br/> | + | [[Special:MyLanguage/FBInstant.updateAsync|FBInstant.updateAsync]] ''<translate>Informs Facebook of an update that occurred in the game.</translate>''<br/> |
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Events === | === Events === | ||
=== Constants === | === Constants === | ||
|} | |} |
Revision as of 16:35, 23 August 2018
Supported platforms: html5
Available since: Gideros 2018.3
Description
You need to do two things to target Facebook Instant Games:
1. Tick the Facebook Instant Game tickbox when exporting to HTML5, you can also specify the percentage indicator that the game will show it has loaded before you take control.
2. Require the FBInstant library code, see the example below.
You can upload, debug and test your game by creating a player and uploading to Facebook servers as a game. The player will interact with the Gideros Studio similar to any other player.
The only restriction with the player is that it only works on the computer viewing the html5 game (localhost) - this would normally rule out actual phones but there is a workaround for Android:
1. Connect your Android phone to your computer using ADB.
2. Type in this command in a command console shell (Windows) or terminal (Mac): adb reverse tcp:15001 tcp:15001
3. The Android device now will see the Gideros Studio when testing the game when a player is launched from within Facebook Messenger.
Please refer to the <a href="https://developers.facebook.com/docs/games/instant-games/getting-started/quickstart">original Facebook documentation</a> for more information about testing and uploading.
Please note that the offical Facebook documentation mentions having to wait for initializeAsync, with Gideros this has already been done for you before your game starts.
It is very important that the only the following API calls are made before startGameAsync has resolved:
FBInstant.getSDKVersion()
FBInstant.initializeAsync()
FBInstant.getPlatform()
FBInstant.setLoadingProgress()
FBInstant.getSupportedAPIs()
FBInstant.quit()
FBInstant.onPause()
FBInstant.player.getID()
To help do this you could create a variable called FBInstantAPI and set it to true once startGameAsync has been resolved - then only call other API commands if FBInstant is true and then if FBInstantAPI is true.
Examples
Initialisation and removal of the Facebook loading progress indicator.
pcall(function() FBInstant=require "FBInstant" end)
if FBInstant then
FBInstant.startGameAsync(function()
print("Loading screen removed")
FBInstantAPI=true
end)
else
print("FBInstant not loaded")
end
MethodsFBInstant.canCreateShortcutAsync Returns whether or not the user is eligible to have shortcut creation requested. |
EventsConstants |