Introduction
OpenXLive connects gamers on Windows Phone 7 with a social network (SNS) platform, and enables mobile game developers to add social networking features in games with minimal development efforts, including friends, leaderboards, forum, and more. OpenXLive was developed by Fulcrum Mobile Network, Inc. Similar platforms include OpenFeint and Plus+, both of which run on iOS devices.

Background
OpenXLive enables and simplifies the development of social networking features for Windows Phone 7 XNA games. OpenXLive provides gaming community and social network user interface to be integrated into XNA games, which is not supported by Xbox Live.
Using the code
Achievement is a commonly adopted concept in gaming, which
is used to promote player sense of accomplishment and keep them interested in
the games. Achievements were first
introduced by Xbox Live, and later widely adopted in gaming consoles and online
gaming. Currently most Achievement implementations are based on cloud services;
one example is OpenFeint on iPhone.
Open XLive provides Achievement support which is also based
on cloud services. Different than
OpenFeint, Achievement in Open XLive is seamlessly integrated with Social
Network, and players’ Achievements can be easily shared between friends.
Introduction to Open XLive Achievement
Open XLive Achievement system is independent. In the future we’ll consider integrating it
with Xbox Live and/or other platforms.
Developers can manage their Achievement system on Open XLive developer
website. Players receive certain amount
of Points when they obtain new Achievements.
Each game can have up to 200 Achievements, and 1000 Open
XLive Points. Developers can allocate Points to each Achievement freely. If all Points have been allocated, no more
Achievements can be added.
Players can view Achievements in Open XLive window in the
games as well as on Open XLive websites.
Select “Achievements” in “Game Center” UI, it will enter the
“Achievements” page:

Managing Achievement
To add an Achievement, please make sure you’ve registered at
Open XLive website. If not, please refer
to “Register Open XLive Developer” <http://wiki.openxlive.com/Tutorial-3-Register-OpenXLive-Developer.ashx>.
Now log on to http://developer.openxlive.com/
using your user name and password.
Return to http://developer.openxlive.com/
page, click on “Manage My Game” on the right dashboard, and enter developer
“Game Management” page.
In “Game Management” page, find the game you created in the
game list.

Click on the name of the game, and enter “Game Details”
page:

In “Game Details” page, click on “Achievement”, and enter
“Game Achievement” page:

There are more properties for Achievement compared to
Leaderboard, but they are not complex.
Name: English and Chinese names are supported.
Open XLive Point: Virtual currency in Open XLive
system. Each game can have 1000 Points
and 200 Achievements, and each Achievement will require a fixed amount of
Points, which cannot be 0.
Max Version and Min Version: Applicable versions for the
Achievement. Versions are specified in
“Basic Information” page in “Game Management”.
If a game version is lower than min version or higher than max version,
the Achievement is automatically disabled.
Secret: Specifies if this is a secret Achievement. Secret Achievements will only be displayed in
Achievement list after gamer acquires them.
Enabled: Specifies if the Achievement is enabled. Default value is True.
Picture: Specifies the picture of the Achievement. The
picture is displayed in Achievement list.
Default size is 60x60, and other size pictures will be converted to
60x60 automatically. In the future, user
can also choose picture from a built-in list.
Please note, the picture should be related to the Achievement.
Description: Description of Achievement in English and
Chinese.
HowToEarn: Optional, describes how to earn the Achievement,
in English and Chinese.
After we complete Achievement information, click on
“Submit”, we can find the Achievement in the Achievement list. Please note down the Achievement ID; we’ll
use it in next chapter.

Submitting Achievement
With the Achievement ID, we can submit Achievements in
games. We’ll add code to the game logic
to submit Achievements.
Before adding code to submit Leaderboard score, please make
sure project has references to Open XLive client libraries. Please refer to “Getting Open XLive Getting
Started”. <http://wiki.openxlive.com/Tutorial-1-OpenXLive-Getting-Started.ashx>
First, add namespaces for OpenXLive classes:
using OpenXLive;
using OpenXLive.Forms;
Second, add the following code at the place where
Achievements needs to be submitted, calling Award method of Achievement class:
Achievement item = new Achievement(manager.CurrentSession, " xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
item.AwardCompleted += new AsyncEventHandler(item_AwardCompleted);
item.Award();
We create Achievement
instance by calling GameSession.CreateAchievement method. There is only one parameter for the method:
Achievement ID, which you can find from Open XLive developer website.
To verify if the Achievement has been submitted
successfully, we need to handle AwardCompleted event.
Achievement item = new Achievement(manager.CurrentSession, " xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
item.AwardCompleted += new AsyncEventHandler(item_AwardCompleted);
item.Award();
Event handler method is as following:
void item_AwardCompleted(object sender, AsyncEventArgs e)
{
if (e.Result.RetureValue)
{
}
else
{
Debug.WriteLine(e.Result.ErrorMessage);
}
}
Since games won’t be interrupted when Achievements are being
retrieved, we don’t recommend using UIs such as MessageBox to display error
messages. Instead, we use
Debug.WriteLine to display error messages.
Displaying Achievement Rolling News
To make it easier to display retrieved Achievement
information, we provide an auxiliary class RollingNewsBoard to help display all
retrieved Achievement information.
Here is the rolling news board user interface:
Now we’ll show how to add supports for RollingNewsBoard in
our games.
First, add a member of type RollingNewsBoard in derived Game
class or DrawableGameComponent class:
public class Game1 : Microsoft.Xna.Framework.Game
{
RollingNewsBoard NewsBoard;
Second, in LoadContent method, create RollingNewsBoard
instance:
protected override void LoadContent()
{
NewsBoard = new RollingNewsBoard(manager);
Third,
in Draw method, add Draw method of NewsBoard:
protected override void Draw(GameTime gameTime)
{
if (manager.IsRunning)
{
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
NewsBoard.Draw(this.GraphicsDevice, spriteBatch, gameTime);
spriteBatch.End();
}
base.Draw(gameTime);
}
Please note, we need to add NewsBoard.Draw method to the end
of Draw method, so it won’t be overlapped by other drawing methods. There are 3 parameters for NewsBoard.Draw
method: GraphicsDevice of current Game object; SpriteBatch object, used for
drawing the UI in the game; GameTime object which is passed into the Draw
method.
Fourth, in AwardCompleted event handler, retrieve the
RollingNews and add it to NewsBoard.
Change event handling method to as follow:
void item_AwardCompleted(object sender, AsyncEventArgs e)
{
if (e.Result.RetureValue)
{
Achievement item = sender as Achievement;
if (NewsBoard != null)
{
NewsBoard.AddNews(new RollingNews(item.Name, item.Description, item.Image));
}
}
else
{
Debug.WriteLine(e.Result.ErrorMessage);
}
}
RollingNews constructor requires 3 parameters: Title,
Description, and Image.
With
the code above, when Achievements are submitted successfully, we can display
Achievement related information in the game.
Besides Achievement information, RollingNews can also display other
information, e.g. game bulletin.
View Achievements on Game Websites
We can view Achievements from game official websites.
On the right side of the website, we can see the
Achievements panel and the latest Achievement list in the game.

Click on “Achievements”, it’ll take us into detailed
information page of Achievements.

What’s the next?
We’ve finished adding Achievements in Open XLive games. So far, we’ve introduced major
functionalities of Open XLive services.
We’ll continue to show to integrate Open XLive into actual games with
two real game examples.
http://wiki.openxlive.com/Real-Game-Examples.ashx
Reference
OpenXLive Website
http://www.openxlive.com/
OpenXLive Developer Website
http://developer.openxlive.com/
Getting Started with Open
XLive
http://wiki.openxlive.com/Getting-Started-with-Open-XLive.ashx