Welcome to MSDN Blogs Sign in | Join | Help

Nerd Herder

Dean Johnson’s blog about life on the XNA platform and tools team

Syndication

AvatarDescription.Description

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.

clip_image002

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.

Published Thursday, May 28, 2009 7:54 PM by dejohn

Comments

# AvatarDescription.Description | ASP NET Hosting @ Thursday, May 28, 2009 3:46 PM

PingBack from http://asp-net-hosting.simplynetdev.com/avatardescriptiondescription/

AvatarDescription.Description | ASP NET Hosting

# XNA Game Studio 3.1 Avatar Tutorial @ Friday, June 12, 2009 12:58 AM

Microsoft XNA Game Studio 3.1 was released today and as a result I had to get my hands dirty with the

XNA Essentials

# XNA Game Studio 3.1 Avatar Tutorial @ Friday, June 12, 2009 12:59 AM

Microsoft XNA Game Studio 3.1 was released today and as a result I had to get my hands dirty with the

XNA Essentials

Anonymous comments are disabled
Page view tracker