When we started to build XNA Game Studio 4.0 we made the decision to break the Microsoft.Xna.Framework.dll assembly into multiple assemblies to better support different functionality multiple platforms. Avatar functionality was pulled out into its own assembly called Microsoft.Xna.Framework.Avatar.dll. When you create a new Xbox 360 or Windows project in XNA Game Studio 4.0 your project will already contain this assembly reference by default.

In order to move avatar functionality  into its own assembly we needed to ensure that types in other assemblies never referenced the types in the avatar assembly. In XNA Game Studio 3.1 the SignedInGamer type contained a property called Avatar which was of type AvatarDescription. Since SignedInGamer was moved into the Microsoft.Xna.Framework.GamerServices.dll assembly we had to remove the SignedInGamer.Avatar property.

At the same time we also wanted to provide a way to allow developers to access the avatar of any Gamer they may have a reference to. That includes FriendGamer and NetworkGamer objects something that was not supported in XNA Game Studio 3.1.

In order to obtain an AvatarDescription for a specific Gamer you now use the AvatarDescription.BeginGetFromGamer method. This method is asynchronous since it may take more than a few cycles to query the type of Gamer that you have passed in.

To load the local players avatar the code now looks like this.

First you will still need to initialize the GamerServicesComponent and subscribe to the SignedInGamer.SignedIn event in your Game class constructor.

Components.Add(new GamerServicesComponent(this));
SignedInGamer.SignedIn += new EventHandler<SignedInEventArgs>(SignedInGamer_SignedIn);

Next we need to create the SignedInGamer_SignedIn method that will handle the event.

void SignedInGamer_SignedIn(object sender, SignedInEventArgs e)
{
    // Only handle player one sign in
    if (e.Gamer.PlayerIndex == PlayerIndex.One)
    {
        AvatarDescription.BeginGetFromGamer(e.Gamer, LoadGamerAvatar, null);
    }
}

Once the BeginGetFromGamer method has completed it will call the LoadGamerAvatar method that we define below.

void LoadGamerAvatar(IAsyncResult result)
{
    // Get the AvatarDescription for the gamer
    avatarDescription = AvatarDescription.EndGetFromGamer(result);

    // Load the AvatarRenderer if description is valid
    if (avatarDescription.IsValid)
        avatarRenderer = new AvatarRenderer(avatarDescription);
}

We call EndGetFromGamer with the IAsyncResult to obtain the AvatarDescription. In this case avatarDescription and avatarRenderer are defined as member variables in the class. Before creating the AvatarRenderer we verify that the description is valid.

Another change that occurred with avatars in XNA Game Studio 4.0 was that their proportions were updated. This was a change that occurred across the Xbox 360 platform and we support in XNA Game Studio 4.0.

This does mean that custom animations need to be authored with a new animation rig. Luckily the existing rigs for Maya and the Softimage Mod Tool were updated to the new proportions and a new 3D Studio Max version was also created. All of these can be found at the link below.

http://create.msdn.com/en-US/education/catalog/utility/avatar_animation_rig

Along with the rigs the animation packs were also updated and can be found at the link below.

http://create.msdn.com/en-US/education/catalog/utility/avatar_animation_pack

Finally the avatar samples have also been update to support XNA Game Studio 4.0 including the custom avatar animation sample.

http://create.msdn.com/en-US/education/catalog/sample/custom_avatar_animation