Getting your game on Facebook the easy way

FBthumb

What’s necessary for putting a flash game on facebook? Not much. I did that by putting a php file onto my server which acts as the canvas file. Into the same folder I unpacked the FB PHP SDK. FB likes developers and thus gives you an application profile page, the only thing you have to worry about is the actual canvas page.

To create an app for TriPop I followed the normal procedure, added an app in the developer section, copied the given keys, created the php file, filled out several, mostly self explaining, fields including the path to my file and there it is. TriPop’s application profile page and the TriPop application itself.

The FB SDK, once unpacked needs to go onto the server to as the php will refer to it.

The code for a simple application canvas (no approval by the user required because no user data is used) looks like this:

<?php
// Awesome Facebook Application
//
// Name: Application Name
//

require_once 'facebook-php-sdk/src/facebook.php';

// Create our Application instance.
$facebook = new Facebook(array(
  'appId' => '***************',
  'secret' => '********************************',
  'cookie' => false,
)); 

?>

<div style = " text-align: right; width: 640px; margin-bottom: 5px; ">
	Back to
	<fb:application-name
		linked="true"
	/>
	's application page
</div>

<div style = " text-align: center; width: 640px; margin-bottom: 5px; ">
	<fb:swf 
		swfbgcolor="ffffff"  
		swfsrc='http://www.yarrcade.com/gamefiles/tripop/TriPop.swf' 
		width='640' height='480'
	/>
</div>

The first div is just for a text field at the top that can be used as a back button to the application profile page. The next div encloses the swf. And that is all. Really…

For more information refer to the FB Developer Documentation. Just if you need to go deeper or if you want to use more functions. Moreover, for dedicated development on the FB platform you may want to have a look at Michael’s new book.

This entry was posted in mochiads, monetization, Tutorial and tagged , , . Bookmark the permalink.

Comments are closed.