Tuesday, November 16, 2010

Presence in Xblig Games

I have always loved the idea of presence, and in some Xbla titles i have had the pleasure of working on, I did indeed use presence. Xblig and it's Xna studio has some built in functionality for doing this same thing, though with a few restrictions. I used the presence in A Shooter and i have to say tat seeing it first hand like that, watching in a way your friends progress from boss to level etc is really a great feeling.

Making adding it into the code well worth while.

// first i started by enumerating my Own presence values, for the ones i wanted to use.
enum PRESCENCE {
MENU = 0,
STAGE,
COOPSTAGE,
BOSS,
};

// then i simply call this routine with the state i want to be known, it basically converts my own enum, to the Xna studi type and sets it
public void SetPresenceForAllPlayers(int _state)
{
  foreach (SignedInGamer sig in Gamer.SignedInGamers)
  {
   switch (_state) {
    case ((int)PRESCENCE.MENU):
     sig.Presence.PresenceMode = GamerPresenceMode.AtMenu;
     break;
    case ((int)PRESCENCE.STAGE):
     sig.Presence.PresenceMode = GamerPresenceMode.Stage;
     sig.Presence.PresenceValue = cLevel.iLevel+1;
     break;
    case ((int)PRESCENCE.COOPSTAGE):
     sig.Presence.PresenceMode = GamerPresenceMode.CoOpStage;
     sig.Presence.PresenceValue = cLevel.iLevel+1;
     break;
    case ((int)PRESCENCE.BOSS):
     sig.Presence.PresenceMode = GamerPresenceMode.BattlingBoss;
     break;
  }
 }
}

Good luck implementing your own Presence. I have posted this here, just so people can see how easy it is to really implement

Laters

No comments:

Post a Comment