Facebook integration with GameSalad • v1 • Oh Yeah! ( With 15 minute Tutorial Video)

2»

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited February 2014
    Thinking about how I can grow this idea to create my own asynchronous game server… without using Playstogether.

    To follow the flow start in the bottom left with login/create account.

    image

    Slowly working through the idea… reading up on password storage security in mySQL databases and unexciting things like that… all with an aim to make 'the game'…


    This flow chart gave me a good excuse to borrow my daughters felt tips though.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Yeah but think of the rackspace and bandwidth you'd need for even a modest hit game...ouch!
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited February 2014
    Thanks jon the link looks like a good 'n'.I've started reading up on md5 security which looks simple enough to implement, though started reading about salts and soon got lost.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited February 2014
    Yeah but think of the rackspace and bandwidth you'd need for even a modest hit game...ouch!
    It is a potential problem, a nice problem to have though I guess... At the moment I just want to see what's possible. Im enjoying the journey and challenge or learning . . . or some rubbish like that. If its a hit game I think it might get expensive which ever route you take. But hopefully a hit game would obviously more than cover the rackspace fee.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    Thanks jon the link looks like a good 'n'.I've started reading up on md5 security which looks simple enough to implement, though started reading about salts and soon got lost.
    yea salts can be a little ticky to get your head around, but once you do it's pretty easy. you just want to come up with a salt method that isn't easily discoverable.
  • DoguzDoguz Member Posts: 500
    Nice tutorial Jon. Probably the best of the current lot. No annoying waffle and straight to the point. Do you know if it's possible to get the friendlist avatars into your game? I think this is commonplace for FB integration with apps and without it - I think it's a bust.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Nice tutorial Jon. Probably the best of the current lot. No annoying waffle and straight to the point. Do you know if it's possible to get the friendlist avatars into your game? I think this is commonplace for FB integration with apps and without it - I think it's a bust.
    I don't think its possible at the moment as we can only send and receive a string of text/data. For my game I'm hoping to integrate a custom avatar/character builder to have an image alongside, a default or random one could go alongside people who don't yet play the game. Or you could have the friend selector page also run on your server but that seems a little clunky.

    Hopefully GS will add some sort of image send receive behaviour in the future.

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited February 2014
    Yeah but think of the rackspace and bandwidth you'd need for even a modest hit game...ouch!
    Ok, so quick bit of research into possible server hosting for my own asynchronous game server.

    Initial findings… I honestly think I'm doing my maths wrong...

    5 million requests from AMAZON = $2
    5 million requests from Playstogether = $199.

    This is still very rough and ready…

    I've had a quick look at the BIG POWERFUL AND POPULAR Amazon web services (S3 or EC2, Elastic Beanstalk… I'm yet to 100% work out which is needed). I'm yet to fully find out if it could host what is required but in their promo video it mentions PHP and MySQL and databases for your apps so it all sounds good.

    It's a little tricky to do a direct comparison between their pricing and Playstogether because of how each of then structure the price break downs ...but here goes.

    …..

    Amazon S3, FREE
    5Gb storage
    20,000 Get requests
    2,000 Put requests
    15gb data transfer per month.

    Playstogether FREE
    1 million Get requests
    50,000 Push notification requests.

    …..

    Amazon S3 - Paid
    Get Requests $0.004 per 10,000 requests
    10,000 x 500 = 5,000,000 requests
    $0.004 x 500 = $2

    5 million Get requests = $2.00 is that right ???

    Playstogether Paid
    5 million requests $199

    ……



    So at first glance Amazon looks significantly cheaper once your past the 1 million free requests that Playstogether offers… but as I said it's hard to get a clear comparison without fully understanding what's what. Plus I might be missing something as there are obviously extra Amazon fees if you require more storage space etc etc.. but it seem's we're talking $'s not $100's.

    Obviously Playstogether offer an added service so are no doubt worth the money, plus we might get access to their push notifications soon which would be another added bonus.

    Though I do like the idea of having control of your gamers data rather than passing it to a 3rd party… so if a service provider goes down you can move it somewhere else… and if I don't know how to do it securely or effectively a 3rd party is no doubt still the better option.

    Interesting thing to discuss though.

    Here's Amazons pricing page:
    http://aws.amazon.com/s3/pricing/

    Here's Playstogether.com's pricing page
    http://playstogether.com/pricing/

    Let me know if anyone can see any glaring errors in my maths.

    I haven't overly looked at needed storage space as I don't think I'd need a great deal as we're only storing some simple database data, no image or videos. Plus I think there are other costs for Amazon but haven't found them yet… (found one extra… after 1st year you may have to pay per hour for the OS you have installed i.e. Ubuntu 64 costs a varying number of cents i.e. 0.04 per hour depending how much you need)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Interesting. We need a Guinea pig :@)
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    oink oink...

    Damn hard just getting PhpmyAdmin installed...nearly there... attempt number 5... tutorial number 3....
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited February 2014
    Well I've just lost a good 10 hours of my life and very nearly gave up.. ten more minutes and I would have stopped trying.. but...

    ACHEIVEMENT COMPLETED - DING!!! - AMAZON MYSQL DATABASE UP AND RUNNING!

    I now have a Ubuntu 13.1 OS instance running on Amazon EC2, with a mySQL database and a working install of PHPmyadmin, ... which is free for a year (or until i go over the given limits)... and then cheap... Now I need to figure out to put some normal PHP files on the space... (EDIT: I now have FTP access and can put files up)

    I thought the facebook stuff was tricky... this was sooo frustrating.. but it works now.

    For anyone interested in looking into it...

    Register with Amazon AWS, You'll need to put in some credit card details and prove who you are. at http://aws.amazon.com/

    INSTALL APACHE. PHP AND MYSQL (LAMP) ROBOT MEDIA TUTORIAL This is the one I followed in the end... (i tried 4 different tutorials)
    http://www.robotmedia.net/2011/04/how-to-create-an-amazon-ec2-instance-with-apache-php-and-mysql-lamp/

    AMAZONS OFFICIAL TUT ON INSTALLING LAMP WEBSERVER
    I tried this before the above one, it teaches you quite a bit, and links to other useful pages.
    http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html

    HOW TO STORE YOUR KEYSTORE SAFELY AND MAKE IT SAFE
    This stops a problem that occurs when you try to connect using Terminal to the instance you created on EC2 and it thinks your key is public.
    http://blog.shreypuranik.co.uk/2014/01/13/configuring-ssh-on-your-mac/

    AND THIS GOLDEN NUGGET GIVES YOU A FIX FOR WHEN/IF YOU CAN'T ACCESS YOUR PHPmyadmin INSTALL AT THE END
    https://help.ubuntu.com/community/phpMyAdmin

    SORTING OUT FTP ACCESS:
    Install vsftpd to allow FTP.
    http://quadloops.com/installing-up-ftp-server-in-amazon-ec2-ubuntu-server-12-04/
    If you have problems uploading you can try this:
    http://quinoqo.blogspot.jp/2013/05/connecting-to-amazon-ec2-server.html

    Navigate to the home directory / var / www / to place your website files etc...

    ...........................................

    Warning... it's damn tricky...



    Edit: Now have PHP files working on the server on Amazon EC2, so can send and request facebook id's. Works there as well as on my local host... woo!
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited February 2014
    Working out the process flow for 'how to login/register a new player' on my asynchronous server

    image
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited February 2014
    Interesting. We need a Guinea pig :@)
    On further investigation I think the price for using Amazon AWS would be quite a bit more than I'd originally worked out (which was $4).. but only after you start using a significant amount of server space/bandwidth..would you end up paying for different functionality as you add it over time.

    The cool stuff is once setup correctly it will scale automatically with no down time ever... if you do it right...

    Basically it should go like this:
    Create an 'instance' which is an install of your chosen server OS (mine is Ubuntu), on a server spec (you can choose from about 30 sorts of spec) put your PHP files on it.
    Setup a load balancing tool (takes a few clicks)
    Setup an Auto Scaling Group. (takes a few clicks)
    Setup your Database on another instance (or Amazons S3 storage or make use of Amazons DinamoDB that sounds very cool but another big thing to learn.).
    Link your PHP files to the Database address.

    Then when your game is live and your nearing capacity of your first server ,the auto scaling group generates another copy of the instance... and the load balancing tool will share out the needed space and processor power over the two servers. (or 3, or 4, or 100). When your game goes quiet, it takes the additional ones offline as required. You set the rules for when it automatically adds or takes away more servers. You only pay for what you use (and you can set a cap).

    I think it's definitely still better value, with more control than Playstogether... but then maybe control isn't what we really need... especially if you want to concentrate on making awesome games and not making a cool server setup.

    This makes for some confusing viewing... and shows what you could do if you took advantage of lots of Amazons tools.. including built in email sending..

    http://media.amazonwebservices.com/architecturecenter/AWS_ac_ra_games_10.pdf
  • CaptFinnCaptFinn Member Posts: 1,828
    This is awesome!!! Though Ill probably never use it. Im glad to see someone has found a way to make it benefit the community. That is some nice work. Now if only this Multiplayer stuff was in the stable release, and not stuck in the nightlys.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited March 2014

    Just been implementing this into my async server setup... things have change a little since making the tutorial... facebook no longer likes you entering local host in the 'App Domains' field.

    So you can skip that bit...

    It's happy with the url for Oauth Login and the website and mobile urls. just not the App Domains.

    It still works so that's all fine and dandy.

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989

    Hmm... it seems that although this facebook approach is workable it is'nt classed as Best Practice by Facebook and will eventually not be allowed. It is obviously a little clunky having to pass the user out to the embedded browser to login to facebook and approve the access...

    https://developers.facebook.com/docs/facebook-login/checklist#usenative

    Back to the drawing board I think... and back to asking GameSalad to add the iOS and Android SDKs into Gamesalad.

  • Djneo134Djneo134 Member Posts: 5

    Hi, I've followed your video tutorial but I still have a problem that I can't solve.

    I've a server (my provider is 1and1) and I've placed all the php files on it.
    I've made the modifications in the code to connect my database.

    But when I launch the callback.php I've this error message that appears:

    Warning: include_once(php/functions.php) [function.include-once]: failed to open stream: No such file or directory in /"my webiste url"/callback.php on line 95

    How can I solve this ?

    Thanks a lot ;)

  • Djneo134Djneo134 Member Posts: 5

    Here are the lines:

    //Lets say hello to the server, CONNECT TO THE MySQL database,
    include_once 'php/functions.php';

    $port = '3306';
    

    ...

    the line 95 is: include_once 'php/functions.php';

  • Djneo134Djneo134 Member Posts: 5

    no, in the whole tutorial, it isn't question about a such file.

    Here is the tuto:
    youtube.com/watch?v=lCdOuwSoFXk

    So, this is the problem...
    Maybe this file is already in the MAMP package, but with a real server how can we do ?

  • Djneo134Djneo134 Member Posts: 5

    I've already tried but when I do that I have this error message:

    Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /"my website url"/callback.php on line 146

    and here is the line 146:
    // close the SQL connection

    mysql_close($link);

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    You probably have more configuration to do on that file. Check to see how $link is configured

  • Djneo134Djneo134 Member Posts: 5

    Here is the $link content:

    $link = @mysql_connect('mysql_hostname', 'mysql_user', 'mysql_password');

    Of course I've put my real informations.

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited March 2014

    The php/functions stuff should'nt be required at all ... So definately commented it out, and test on mamp to double check.

    Then repeat on your live server.

    Then I guess readup on creating the mysql_connect for a server and check your typing in the right info... I did it once with mine.. but now kinda forgotten the setup as I've moved on to using PDO instead of mysql.

    Also, just incase you missed it before.
    ... it seems that although this facebook approach is workable it is'nt classed as Best Practice by Facebook and will eventually not be allowed. It is obviously a little clunky having to pass the user out to the embedded browser to login to facebook and approve the access...

    https://developers.facebook.com/docs/facebook-login/checklist#usenative

    Back to the drawing board I think... and back to asking GameSalad to add the facebook iOS and Android SDKs into Gamesalad.

    If your still stuck after learning about writing the correct info for the link, and you still want to get it working... I'll see if I can help.

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited July 2014

    @StormyStudio, what do you think about this?

    http://www.joshuawinn.com/facebooks-sharer-php-longer-deprecated-2014/

    https://developers.facebook.com/docs/plugins/share-button

    Could be, maybe Facebook sees that too many site have not adopted the new system yet. Seeing that facebook integration is still a few months off and even a successful casual game usually only has a halflife of a month, might still make the old share button viable.

Sign In or Register to comment.