Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Facebook Instant Games: A brief tutorial to get started — Gideros Forum

Facebook Instant Games: A brief tutorial to get started

totebototebo Member
edited March 2018 in Code snippets
Hi guys,

I've successfully added Scrappy Cat, a game I've previously released on web and mobile, to Facebook Instant Games. This basic integration took about an hour, but hopefully with these instructions a lot less:

1. Add this code to your game, at the point you want the game to show:
 
pcall(function() FBInstant=require "FBInstant" end)
if FBInstant then
	FBInstant.startGameAsync(function() 
		print("Loading screen removed")
	end)
else
	print("FBInstant not loaded")
end
2. Export the game to HTML5 with the "Facebook Instant Game" checkbox ticked:

image

3. Go to https://developers.facebook.com/?advanced_app_create=true. You may have to open a Facebook dev account if you haven't already.
4. On the "Add a product", choose "Instant Games / Set up"
5. Fill in the details about the game under "Instant Games / Details". The images generated by Gideros should help this process.
6. Go to "Web Hosting", zip up the contents of "package" from your exported project. Once uploaded click the star to "Push to production".
7. Go to "App Center / Details" and click "Web Preview" to test the game. To test on mobile, open the Facebook Messenger app on mobile (with your developer account) and search for your game name.
8. Once you are happy with your game, and make sure ALL monetisation is in, go to "App Review" to submit the game to Facebook.

Hope this guide helps to get started on Facebook Instant Games. Look forward to seeing your instant creations!

Cheers,

Niclas
My Gideros games: www.totebo.com
+1 -1 (+7 / -0 )Share on Facebook

Comments

  • SinisterSoftSinisterSoft Maintainer
    edited March 2018
    A better init is here: http://docs.giderosmobile.com/reference/fbinstant/fbcore

    (The require, etc will otherwise crash on other platforms and it means you can have a common source code)

    Then just check for FBInstant before calling any api commands for it.

    Edit: You have updated the first post to show this code instead. :)
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+3 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    edited March 2018
    This will help log events - it will send out a log to each of the logging systems - if you have included them.
    function message(mess,param,param2) -- text, number, table
    	if firebase then firebase:analyticsEvent(mess,param) end
    	if flurry and flurry.isAvailable() then flurry.logEvent(mess,param) end
    	if FBInstant then FBInstant.logEvent(mess,param or 0,param2) end
    end

    Likes: pie

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • What resolution is optimal for Facebook Instant projects?

    Likes: antix

    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
    +1 -1 (+1 / -0 )Share on Facebook
  • Good question, not sure. I've released my games on mobile previously, which means they should work on any bloody resolution because iPhone and Android are so fragmented!
    My Gideros games: www.totebo.com
  • totebo said:

    Good question, not sure. I've released my games on mobile previously, which means they should work on any bloody resolution because iPhone and Android are so fragmented!

    I guess 480x854 then.
    I've noticed that 480p projects look sharp enough even on 1080p smartphones, without adding @2x/@4x sprites
    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
  • antixantix Member
    @Apollo14 I chose 960 x 640 for my target resolution :)
  • I've updated fbinstant.lua to fix a few things to do with leaderboards. If you need it ahead of 2018.3.1 then you can find it on github in the ui/tools folder, it should go in the tools folder of your gideros dir.

    Likes: antix, totebo, Apollo14

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+3 / -0 )Share on Facebook
  • Apollo14Apollo14 Member
    edited March 2018
    @totebo can you provide url of your facebook game? I couldn't find it, FB's interface really sucks.

    Likes: antix

    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
    +1 -1 (+1 / -0 )Share on Facebook
  • @Apollo14 it's not released yet! Testing leaderboards at the moment.

    Likes: jimlev

    My Gideros games: www.totebo.com
    +1 -1 (+1 / -0 )Share on Facebook
  • jimlevjimlev Member
    totebo said:

    @Apollo14 it's not released yet! Testing leaderboards at the moment.

    @ Totebo
    Thanks for sharing your story, it is very usefull (despite the fact that many changes have affected the process from that time).

    Could you give us some news of your experiments ? Was it a positive experience for you ? Did you achieve to push your game through all the facebook evaluation/check/updates ? any advices for someone who try to take the same route today ?
    My meditation plan :
    SinisterSoft: “ I don't create classes that much - classes are good for making things simpler but imho for frame rate they are also death by a thousand cuts.”
    Totebo: “ Best quote ever.”
    🤔
  • jimlevjimlev Member
    totebo said:

    @Apollo14 it's not released yet! Testing leaderboards at the moment.

    So do I ! But, I have to admit that the heavyweight testing process, my lack of skill in coding and the not-so-clear facebook's documentation make it a haunting task...

    But, a first playable version is accessible from my phone via the facebook app, the messenger app and from my PC (with some strange and irregular loading errors...). It's quite rewarding. I'm just a little sad because the game is a bit laggy... I will probably have to discover the 'profile' tool in gideros to understand where it is coming from.


    My meditation plan :
    SinisterSoft: “ I don't create classes that much - classes are good for making things simpler but imho for frame rate they are also death by a thousand cuts.”
    Totebo: “ Best quote ever.”
    🤔
  • SinisterSoftSinisterSoft Maintainer
    You need to test it on a phone and get rid of the lag on those.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • jimlevjimlev Member

    You need to test it on a phone and get rid of the lag on those.

    I agree ! the lag is really visible only when I try on my (bit old) android phone. I think it's due to a conjonction of misunderstanding of the good practice of loading assets and, may be, some graphics which are a bit heavyweight... will dig these points later.
    My meditation plan :
    SinisterSoft: “ I don't create classes that much - classes are good for making things simpler but imho for frame rate they are also death by a thousand cuts.”
    Totebo: “ Best quote ever.”
    🤔
  • SinisterSoftSinisterSoft Maintainer
    On facebook you could load in some basic lightweight graphics then load in the good stuff asynchronously after the game has actually started (and is possibly playing). You right-click it in the project to disable it being in the package for facebook export. You still put it in the zip, but it won't be part of the bit that gets downloaded when before the game starts.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • SinisterSoftSinisterSoft Maintainer
    I do this with the music tracks, but now (with the latest Gideros) I could simply stream the music - no need to load it at all.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
Sign In or Register to comment.