Rich Presence in XNA Game Studio 3.0

Originally posted to Shawn Hargreaves Blog on MSDN, Thursday, September 18, 2008

A neat feature of Xbox LIVE is how you can go into your friends list and see what everyone is currently doing. The details page for one of my friends might show something like this:

Microsoft Cat Simulator 2008
Kitty Herding Mode
Level 3, Score 15
Online - Joinable

Where does this text come from?

Traditional Xbox games define their presence using a somewhat complicated tool called XLAST. If you were lucky enough to win the Dream-Build-Play competition last year, you will more recently have been unlucky enough to have to use that tool to create presence strings for publishing your game on XBLA.

Outside the few people with XBLA contracts, our 2.0 framework did not support rich presence. Games made with it would always just show:

XNA Creators Club
Using XNA Game Studio
Online - Joinable

We wanted to improve this for 3.0. But here's the problem: presence text can be viewed by anyone on LIVE! Xbox has a parental controls system, which can limit what games your kids are able to play, but you don't have to be running the game at all to view its presence information. So even if a game is rated 'R', the presence must still be 'E' rated.

If we allowed Game Studio titles to specify arbitrary presence strings, there would be no way to prevent naughty developers putting something naughty in here, which would be upsetting to parents, ratings boards, and other such people that it is not cool to upset.

Our solution was a compromise. When you run a game as a Creator (either from Game Studio, or deploying a .ccgame, or during peer review) its presence now shows up like this:

XNA Creators Club
creators.xna.com
<your choice of presence mode here>
Online - Joinable

The third line is controlled by you, but only as a choice from a fixed list of options. Since there is no way to enter arbitrary text, this ensures the presence will always stay clean.

Here's how you set the presence mode:

    Gamer.SignedInGamers[playerIndex].Presence.PresenceMode = GamerPresenceMode.WaitingInLobby;

There are 59 different modes to choose from, including things like "Practice Mode", "Difficulty: Easy", "At Menu", and "Found Secret". Some of these modes also include an integer parameter value:

    Gamer.SignedInGamers[playerIndex].Presence.PresenceMode = GamerPresenceMode.Score;
    Gamer.SignedInGamers[playerIndex].Presence.PresenceValue = currentScore;

This is of course optional. If you don't set any presence data, the third line will be blank.

If you choose to release your work as an Xbox LIVE Community Game, its presence will show up a little differently once end users are playing it. After a game has made it through the peer review process, we can be confident the game name is not obscene, so we automatically use that as the second line of presence. Thus the Community version of my game might show this presence state:

Community Game
Shawns Cat Simulator
Score: 23
Online - Joinable

Blog index   -   Back to my homepage