Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Facebook integration from PC

Author
Message
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 17th Sep 2013 01:10
Any way this works yet?

=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 17th Sep 2013 01:50
Still only Android and iOS, even in the latest 1.08 beta.

I don't know if this will be changed in v2 or not.

Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 18th Sep 2013 18:27
Sure would be nice to provide a unified experience and have FB integration on Mac and Windows!

You might be able to do some workaround where your app works like a website with FB integration and grabs the data via PHP.

You could work with this for login
https://developers.facebook.com/docs/reference/php/

Looks like you might be able to get the friend's list data too:
http://qpleple.com/fetch-online-friends-list-with-facebook-graph-api/

Posting to wall would be done in a similar fashion unless you're OK with the app opening the user's web browser to do so. Which is super easy and doesn't require an app key/secret / whatever FB is calling it now.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th Sep 2013 19:05
I suspect the main issue on Mac and Windows is getting back to your original desktop based application.

A quick look at the login related command is that it expects to go to a web site post login. And I don't see how to get the information back into the actual app. Maybe, after sending to the Facebook login, the app can query the app's site for the login information being done and get back some information.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 18th Sep 2013 22:43
Well... I'm hoping to figure out a way. It seems like I'd be able to send them to a webpage to login and get that data back to the app (have them click a DONE button in the app after they've signed in and it can retrieve the FB login data from a DB on the server).

It would be REALLY great if AppGameKit would just have Windows/Mac FB integration... It's just a little important with today's games to have a social component...

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th Sep 2013 22:50
Well, the basic issue comes down to there not being a native FB program for Mac and Windows, as there is for the mobile market.

If there was a native FB app, there would be a way to have it pass back control to the original program (something like the way it is done on portables).

But that would actually require the Facebook people to create the right 'sdk' (aka 'library') for Mac/PC development.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th Sep 2013 13:16
Quote: "Well, the basic issue comes down to there not being a native FB program for Mac and Windows, as there is for the mobile market.

If there was a native FB app, there would be a way to have it pass back control to the original program (something like the way it is done on portables).

But that would actually require the Facebook people to create the right 'sdk' (aka 'library') for Mac/PC development."

AL is right. Paul will tell you there is no API for Windows or Mac. It's not a failing in AppGameKit, it's Facebook.

"Everything should be made as simple as possible, but not simpler."
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 20th Sep 2013 03:52
yes and using facebook "computer" APIs is working well for me. the only problem is that Facebook is working with web redirects and web inputs ... so, while AppGameKit won't have an "integrated" webbrowser (or something which will mimics it), you won't be able to integrate it correctly into your application.

Actually, when i click on my FB "Connect" Icon in my game, it leaves the fullscreen mode and opens the default browser on my own Facebook PHP Login script (with a unique IDs on my web server. Once connected, i tell the user that it can come back to the game. When resuming, the game is automatically checking with http requests (with the previous unique ID) on my server and retrieve profile datas (picture, name, friends etc).
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 20th Sep 2013 05:02
I was thinking something like that could be done. This method would be acceptable for my game. What game of yours has this in it? Can I see what it looks like and would you be willing to share you PHP scripts and code (or at least more particulars on the method)?

There are very few (if any) native Windows games that integrate with FB in anyway and this would be a great edge for my next game.

Cheers!

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 20th Sep 2013 06:03
My biggest issue with a Windows app release is that anything in your media directory is directly accessible to the user.

I'm not sure anyone has found a packaging for Windows (Intel AppUp doesn't count anymore, they don't support the way AppGameKit used to work with them) for a finished AppGameKit product that keeps the media and data files hidden.

At least in a Mac, you need to really work at it to find the files after an installation.

But I, too, would be interested in methods for using the HTTP interface. I have theories on how it might work, but haven't tried it.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 20th Sep 2013 06:13 Edited at: 20th Sep 2013 06:23
it's difficult to share my PHP code directly (i would have to clean and repackage it) but here are the steps (working for Mac/Windows.. and even the mobile devices if you don't want to use the mobiles FB SDKs :

- you need the facebook PHP SDK (it's free :p) and a PHP Web Server

- Create a Facebook developer profile with your personal facebook account (or another one) (on the facebook website) and create a facebook webapp (mine is "SpeedRacer"). it will give you an app ID and hash key needed by PHP FB API Calls...

- create a PHP FB Login Script which logs you on facebook (if you aren't already loggued, facebook API will redirect you and will eventually ask you if you want to authorize your web app). In your script, you have to pass a parameter to facebook to ask for a facebook permanent access token for your application (check the API Doc or google for more details).

- In your AppGameKit game, create a complex selfmade random/unique ID (String)(it will be your reference ID during the login process)

- In your AppGameKit Game, open your FB login PHP script with the previous unique ID as a GET variable (with openbrowser() command) and prepare yourself to use the GetResumed() AppGameKit command

- In the web browser (in the login PHP Script), you can (and have to) pass a custom variable which will be returned by facebook once loggued in (the self-generated UniqueID in this case) . When you have the callback from Facebook (so... you are loggued), save in a user database (MySQL?) the UniqueID with the returned Facebook Token in a table (token is needed by almost every FB PHP Commands). Tell the user on your login page (after the FB Login callback) that it can come back to the game.

- In your AppGameKit game, the GetResumed() will be called at this time. You can now use a SendHTTPRequest() on another PHP script with your self-generated UniqueID to retrieve your Facebook permanent Token (and delete the uniqueID in database after ...it's important) . Save it in the AppGameKit game filesystem for future re-use (you can crypt it for more security).

- After that, you can do anything you want by calling PHP scripts or methods on server side with this Token (one PHP script/method to get the FB Profile (fullname, Facebook ID,user infos.. and after ... Profile Picture path.. (i have shared a little explanation on how to download it in another thread : http://forum.thegamecreators.com/?m=forum_view&t=206002&b=41&msg=2462103#m2462103 ) ), another one to Post on wall , friendslist..). etc...


For the next launches of your game, simply ask your game to do a SendHTTPRequest() with the permanent token on a FB PHP Script (the one which gets the profile) and if something is going wrong with your permanent token, FB will thrown an exception ... so you have to return the error directly from the SendHTTPRequest in your game and your game has to regenerate a uniqueID and re-launch the web browser to login again if everything is ok and the PHP Script is returning your profile, you have nothing to do (you already have the correct permanent token in your game)


You could also (for security) deal only with your self-generated Unique ID. Your PHP scripts would only have to resolve it to the facebook Token in your database each time. BUT, take care about this "unique" ID which can't be really unique because it's ... a random string.... So this unique ID must have a short lifetime (just the duration webbrowser call for the login and the login callback to your game... so .. few seconds). That's why it's better to keep the FB Token directly and delete the selfmade Unique ID from database as soon as possible .

All the Facebook PHP Functions are well documented in the SDK with a lot of small examples PHP Scripts.

but indeed, It could be cool to create a ready-to-use FB Package with some basics custom AppGameKit functions/Commands (Login(), GetFriendsList(), GetPicture() etc...)for Facebook Mac/Windows Integration

The main problem is that your game become dependant of your personal webserver to have the ability to deal with FB ... but it should be easy for TGC to deal everything with internal scripts to make FB webcalls directly :p (everything behing few AppGameKit commands) ... but yes... it's not very clean ...lol

Or maybe with the FB Javascript SDK (with an AppGameKit internal JVM :p) ... or something else .. (https://developers.facebook.com/docs/sdks/)


--- Ready for FB ? ---
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 20th Sep 2013 16:59
Thank you, lots of very useful and good information.

It is about the way I figured it would have to be.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 20th Sep 2013 17:00
Thanks, MikeMax. That sounds a lot like how I had originally imagined it, but it is really helpful to have this detailed out. It's not that different from how I'll have to handle FB login from mobile (storing the token and fb name in our server). Very cool.

MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 20th Sep 2013 22:57
AL and Naphier, you're welcome

Login to post a reply

Server time is: 2024-11-24 19:42:07
Your offset time is: 2024-11-24 19:42:07