Model

Published June 19, 2001 by Zachary Booth Simpson, posted by Myopic Rhino
Do you see issues with this article? Let us know.
Advertisement
(C) 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.mine-cont...i/gbook-zbs.cgi.


[size="5"]Intent
[bquote]Store the state of an object which exists in the game world.[/bquote]

[size="5"]Also called
[bquote]Database Records, World Items, World Objects, Item Database[/bquote]

[size="5"]Problem
[bquote]Many games consist of a variety of objects which interact. In some cases, there are many kinds of objects, in other cases, only a few. However, in all cases, each object tracks its state as the game progresses. Game rules define the transition of these states, and are often implemented by the Controller pattern.[/bquote]

[size="5"]Solution
[bquote]Many Model implementations are polymorphic. For example, each type of Model is given its own class which extends a BaseModel class. Subclasses often overload basic methods to implement a special trait.

Care is often given to optimizing Models so that they can be accessed quickly by the View pattern.

Models may be fixed so as to aggregate more efficiently. See Model Database.

Models may implement the Model Database implicitly with statics.[/bquote]

[size="5"]Structure
[bquote]Not available at this time.[/bquote]

[size="5"]Examples
[bquote]Some examples of state information that a model might track: hitPoints, name, type, position, orientation, size, status, animationState, meshPointers, isDead, identification.

Some examples of methods that a model might implement: die(), getHit(), updateAnim(), insertIntoWorldDatabase(), moveTo()[/bquote]

[size="5"]Related Patterns
[bquote]Model collections are also called a Model Database.[/bquote]
Cancel Save
0 Likes 142 Comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement