Recent Resources
-
GLSL 4.0: Discarding Fragments to Create a Perf...
-
GLSL 4.0: Using Subroutines to Select Shader Fu...
-
Building a Complete Board-based Puzzle Game wit...
-
JIRA: Programming Workflows
-
.NET Generics 4.0: Container Patterns and Best...
-
Raw Meat: Game Design Tips from Team Meat's...
-
Sedge: An Automated Error Reporting Tool
Appearance Map
By Zachary Booth Simpson | Published Jun 19 2001 10:13 PM in General Programming
© 2000 - Zachary Booth Simpson. Copied with permission from http://www.mine-control.com/zack. If you find any of this work useful, please sign Zack's guest book: http://www.totempole...i-bin/gbook.cgi.
Intent
Problem
Solution
Structure
Issues and Risks
Related Patterns
Uses and References
Intent
Isolate Model state from Model appearance to minimize impact on controllers when art changes.
Problem
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.
Solution
Without an appearance map, a controller is likely to change the "frame" of an animation directly. For example:
if (state == WALKING) {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.
model.frame =
WALK_START_FRAME + WALK_NUM_FRAMES
* (WALK_DURATION / dt)
;
}
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.
Structure
Not available at this time.
Issues and Risks
None at this time.
Related Patterns
Appearance Maps translate Model state into an appearance for the View.
Uses and References
Special thanks to Jim Greer.


















