• 06/19/01 10:13 PM
    Sign in to follow this  

    Appearance Map

    General and Gameplay Programming

    Myopic Rhino
    [i](C) 2000 - Zachary Booth Simpson. Copied with permission from [url="http://www.mine-control.com/zack"]http://www.mine-control.com/zack[/url]. If you find any of this work useful, please sign Zack's guest book: [url="http://www.totempole.net/cgi-bin/gbook.cgi"]http://www.totempole...i-bin/gbook.cgi[/url].[/i]


    [size="5"][b]Intent[/b][/size]
    [indent][bquote]Isolate Model state from Model appearance to minimize impact on controllers when art changes.[/bquote][/indent]
    [size="5"][b]Problem[/b][/size]
    [indent][bquote]Controllers are often complicated little state machines which interact with Models in very specific ways. It is common for this interaction to change the appearance of the Model, especially in animation controllers. Since art may change frequently (example: more frames are added to an animation) it makes sense to separate the state from the appearance.[/bquote][/indent] [size="5"][b]
    Solution[/b][/size]
    [indent][bquote]Without an appearance map, a controller is likely to change the "frame" of an animation directly. For example:

    [code]if (state == WALKING) {
    model.frame =
    WALK_START_FRAME + WALK_NUM_FRAMES
    * (WALK_DURATION / dt)
    ;
    }[/code]In this case, if the animation is changed, the three constants WALK_XXX need to be updated and the game recompiled for the change to take effect.

    An appearance map eliminates these constants and replaces them with a lookup. Typically, a table is loaded at game initialize time which encodes the translation from state and delta time ("state") to frame ("appearance").

    A game with a built-in editor will probably allow this table to either be edited directly or at least to be re-imported on command.[/bquote]
    [/indent] [size="5"][b]Structure[/b][/size]
    [indent][bquote]Not available at this time.[/bquote][/indent] [size="5"][b]
    Issues and Risks[/b][/size]
    [indent][bquote]None at this time.[/bquote][/indent] [size="5"][b]
    Related Patterns[/b][/size]
    [indent][bquote]Appearance Maps translate Model state into an appearance for the View.[/bquote][/indent] [size="5"][b]
    Uses and References[/b][/size]
    [indent][bquote]Special thanks to Jim Greer.[/bquote][/indent]


      Report Article
    Sign in to follow this  


    User Feedback

    Create an account or sign in to leave a review

    You need to be a member in order to leave a review

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    There are no reviews to display.