Presentation

Social Games is an open game platform that leverages several web components :

  • the Firefox browser.
  • twitter/identi.ca as a social network.

The goal is to provide benefits and enjoyment to both game developers and players.

Developers reach an huge user base (millions of potential gamers) while still being in control of their core game : as a developer, you are not tied to a runtime service (like facebook) or to a particular hardware/OS combination. You can simply host your game on your website.

Users don't need to join yet another service to play and make connections with other players : just use your existing microblogging account along with the SocialGames Firefox extension !

In short, SocialGames is an open, decentralized playground.

How to use it ?

  1. Download it from AMO.
  2. Find a sample game here.
  3. Open SocialGames (in the Tools>SocialGames menu).
  4. Configure your twitter account.
  5. Let's play !
And ask your fellow twitterers to install it !

Adding a game to a page

In order to publish your games from your website, you need to add one <link> element in your page with the rel attribute having the value of "socialgames". For instance :
<link rel="socialgames" href="tictactoe/tictactoe.xml" title="Tic Tac Toe"/>
The file you're pointing at is a simple manifest file for the game :

<?xml version="1.0" encoding="UTF-8"?>
<game id="socialgames@desre.org;tictactoe">
<name>Tic Tac Toe</name>
<description>The classical Tic Tac Toe game</description>
<icon href="icon.gif"/>
<content href="tictactoe.xul" engine="tictactoe"/>
</game>
The meaning of the different elements in the manifest file is :
  • /game/@id : a unique identifier for the game. You can use either a UUID or a domain-bound id.
  • name : a short name for the game.
  • description : a longer description for the game.
  • icon/@href : the relative path to an icon for the game.
  • content/@href : the relative path for the main display file. More on this below...
  • content/@engine : the name of the Javascript object that implements the game engine.

Developing a game

User interface

A game is XUL application. Its main screen overlays a <tabpanels> element which has the id "games-panels". This mean that your main file will have this kind of code :
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="text/javascript" src="tictactoe.js">
<tabpanels id="games-panels">
...
</tabpanels>
</overlay>

Code

Each game must implement a Javascript object that has a few properties and implements three methods. The framework takes care of registering and unregistering the object when needed.
Here's a stripped down version of such an object :

var tictactoe = {
id : "socialgames@desre.org;tictactoe",
from: "*",
inviting: true,

init: function(game) {
},

shutdown: function() {
},

onMessage: function(msg, cmd, params) {
}
Tu send messages, use the SocialGamesBroker.sendMessage() method.