Difference between revisions of "Facebook Instant Games"

From GiderosMobile
(change structures according to antix requests)
(4 intermediate revisions by 2 users not shown)
Line 8: Line 8:
 
Adds Facebook Instant Games framework to your project.
 
Adds Facebook Instant Games framework to your project.
  
{|-
+
You need to do two things to target Facebook Instant Games:
| style="width: 50%; vertical-align:top;"|
+
# 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.
=== <translate>Methods</translate> ===
+
# Require the FBInstant library code, see the example below.
[[Special:MyLanguage/FBInstant|FBInstant]] ''<translate>Facebook Instant Games Initialisation and Core.</translate>''<br/><!-- GIDEROSMTD:FBInstant Facebook Instant Games Initialisation and Core. -->
 
[[Special:MyLanguage/FBInstant.context|FBInstant.context]] ''<translate>Contains functions and properties related to the current game context.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context Contains functions and properties related to the current game context. -->
 
[[Special:MyLanguage/FBInstant.payments|FBInstant.payments]] ''<translate>Contains functions and properties related to payments and purchases of game products.</translate>''<br/><!-- GIDEROSMTD:FBInstant.payments Contains functions and properties related to payments and purchases of game products. -->
 
[[Special:MyLanguage/FBInstant.player|FBInstant.player]] ''<translate>Contains functions and properties related to the current player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player Contains functions and properties related to the current player. -->
 
  
  
 +
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:
 +
# Connect your Android phone to your computer using ADB.
 +
# Type in this command in a command console shell (Windows) or terminal (Mac): '''adb reverse tcp:15001 tcp:15001'''
 +
# 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 https://developers.facebook.com/docs/games/instant-games/getting-started/quickstart original Facebook documentation for more information about testing and uploading.
  
  
[[Special:MyLanguage/FBInstant.context.chooseAsync|FBInstant.context.chooseAsync]] ''<translate>Opens a context selection dialog for the player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.chooseAsync(options,callback) Opens a context selection dialog for the player. -->
+
'''note:''' the official Facebook documentation mentions having to wait for initializeAsync, with Gideros this has already been done for you before your game starts.
[[Special:MyLanguage/FBInstant.context.createAsync|FBInstant.context.createAsync]] ''<translate>Attempts to create or switch into a context between a specified player and the current player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.createAsync(id,callback) Attempts to create or switch into a context between a specified player and the current player. -->
 
[[Special:MyLanguage/FBInstant.context.getID|FBInstant.context.getID]] ''<translate>A unique identifier for the current game context.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.getID() A unique identifier for the current game context. -->
 
[[Special:MyLanguage/FBInstant.context.getPlayersAsync|FBInstant.context.getPlayersAsync]] ''<translate>Gets an table of #contextplayer objects containing information about active players.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.getPlayersAsync(callback) Gets an table of #contextplayer objects containing information about active players. -->
 
[[Special:MyLanguage/FBInstant.context.getType|FBInstant.context.getType]] ''<translate>The type of the current game context.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.getType() The type of the current game context. -->
 
[[Special:MyLanguage/FBInstant.context.isSizeBetween|FBInstant.context.isSizeBetween]] ''<translate>Determines whether the number of participants in the current game context is between a given minimum and maximum.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.isSizeBetween(minSize,maxSize) Determines whether the number of participants in the current game context is between a given minimum and maximum. -->
 
[[Special:MyLanguage/FBInstant.context.switchAsync|FBInstant.context.switchAsync]] ''<translate>Request a switch into a specific context.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.switchAsync(id,callback) Request a switch into a specific context. -->
 
  
 +
=== <translate>Classes</translate> ===
 +
<div style="column-count:2;-moz-column-count:2;-webkit-column-count:2">
 +
[[Special:MyLanguage/FBInstant|FBInstant]] ''<translate>Facebook Instant Games Initialisation and Core.</translate>''<br/><!-- GIDEROSOBJ:FBInstant Facebook Instant Games Initialisation and Core. -->
 +
[[Special:MyLanguage/FBInstant.context|FBInstant.context]] ''<translate>Contains functions and properties related to the current game context.</translate>''<br/><!-- GIDEROSOBJ:FBInstant.context Contains functions and properties related to the current game context. -->
 +
[[Special:MyLanguage/FBInstant.payments|FBInstant.payments]] ''<translate>Contains functions and properties related to payments and purchases of game products.</translate>''<br/><!-- GIDEROSOBJ:FBInstant.payments Contains functions and properties related to payments and purchases of game products. -->
 +
[[Special:MyLanguage/FBInstant.player|FBInstant.player]] ''<translate>Contains functions and properties related to the current player.</translate>''<br/><!-- GIDEROSOBJ:FBInstant.player Contains functions and properties related to the current player. -->
 +
</div>
  
 
+
{{GIDEROS IMPORTANT LINKS}}
 
 
 
 
 
 
 
 
 
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Events</translate> ===
 
=== <translate>Constants</translate> ===
 
|}
 

Revision as of 17:13, 30 January 2020


Supported platforms: Platform html5.png
Available since: Gideros 2018.3

Description

Adds Facebook Instant Games framework to your project.

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 https://developers.facebook.com/docs/games/instant-games/getting-started/quickstart original Facebook documentation for more information about testing and uploading.


note: the official Facebook documentation mentions having to wait for initializeAsync, with Gideros this has already been done for you before your game starts.

Classes

FBInstant Facebook Instant Games Initialisation and Core.
FBInstant.context Contains functions and properties related to the current game context.
FBInstant.payments Contains functions and properties related to payments and purchases of game products.
FBInstant.player Contains functions and properties related to the current player.