Export (0) Print
Expand All

Programming with Avatars

Discusses the support for avatars in XNA Game Studio applications targeting the Xbox 360 console. Avatar support includes retrieving existing gamer avatars or creating new ones, and rendering and animating avatars using built-in support.

Overview

Avatars provide other ways of placing the player in your game. With avatars, you can render and animate the avatar within the game, or you can generate one or more random avatars to use as a crowd backdrop or as additional characters in the game.

You must meet the following requirements before using avatars in your game:

  • The game targets the Xbox 360 platform.

    Dd940289.note(en-us,XNAGameStudio.31).gifNote
    Code related to avatars can be present in a Windows game, but all methods will return default values and nothing will render to the screen. This is by design.
  • Gamer services must be initiated. For more information, see the Initialization of Gamer Services section in Gamer Services Overview.

The avatar of a signed-in gamer is stored in the Avatar property. Create one or more random avatars using the CreateRandom method. This method creates an AvatarDescription object, initialized with random data. You can then render this avatar with a call to Draw.

XNA Game Studio provides avatar rendering with the AvatarRenderer class, and animation with the AvatarAnimation class. The renderer uses basic lighting and shading effects. You can invoke the renderer with a single call to AvatarRenderer.Draw. This method also uses a animation to indicate the avatar currently is being loading. This is automatically used by the renderer until loading is completed. Once the avatar is displayed, idle animations cycle randomly unless you specify a specific animation from the standard list. For a complete list, see AvatarAnimationPreset. The AvatarRenderer class contains properties related to the lighting and rendering of the avatar. These properties include the directional light color and direction, the transformation matrices, and others. For a full listing of these properties, see AvatarRenderer Properties.

Community Additions

ADD
Show:
© 2014 Microsoft