Nerd Herder

Dean Johnson blogs about life on the XNA platform and tools team



  • Comments 3

In a couple of previous posts here and here I talked about the AvatarDescription.Description property that returns a byte[].

The AvatarDescription.Description property is provided to allow developers to recreate a previously created AvatarDescription object. The byte[] from the property is used in conjunction with the AvatarDescription(byte[] ) constructor to recreate the description object.

There are three main scenarios this enables.

Avatars in online games

When a player joins an online game their game sends their AvatarDescription.Description to all of the other players in the session. Each of the other players can then create the AvatarDescription object using the AvatarDescription(byte[] ) constructor.

Saving a players random avatar choice

You may want to allow a player to select some of the characters in their game. For example a user may pick party members in an RPG. The developer can continue to generate random AvatarDescription objects by calling AvatarDescription.CreateRandom(). The developer can then save the AvatarDescription.Description for the random avatars the player as selected along with other save game data. The data can then be read when the player loads the game so that they see the same characters they had in a previous game.

Loading a avatar designed by the developer

The final scenario allows the developer to design a specific avatar for use as a character in their game. This can be done by creating the desired look for the avatar in the Xbox 360 dash avatar editor. Then use an Xbox 360 XNA Game Studio game to load the AvatarDescription object from the SignedInGamer.Avatar property for the profile associated with the avatar you want to use. Put a breakpoint somewhere in your code after loading the AvatarDescription. Debug the code and put the AvatarDescription object you created in the watch window in Visual Studio.


Next you will need to copy the contents of the Description property and format the text. You can then use these values to construct a new byte[] that can be used to create the AvatarDescription in your game. You can either hard code this byte[] in your source code or save it to a file and create a content processor.

Page 1 of 1 (3 items)
Leave a Comment
  • Please add 7 and 3 and type the answer here:
  • Post
Translate This Page