• 06/19/01 11:21 PM
    Sign in to follow this  

    Model

    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.mine-control.com/cgi/gbook-zbs.cgi"]http://www.mine-cont...i/gbook-zbs.cgi[/url].[/i]


    [size="5"][b]Intent[/b][/size]
    [indent][bquote]Store the state of an object which exists in the game world.[/bquote][/indent]
    [size="5"][b]Also called[/b][/size]
    [indent][bquote]Database Records, World Items, World Objects, Item Database[/bquote][/indent]
    [size="5"][b]Problem[/b][/size]
    [indent][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][/indent]
    [size="5"][b]Solution[/b][/size]
    [indent][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][/indent]
    [size="5"][b]Structure[/b][/size]
    [indent][bquote]Not available at this time.[/bquote][/indent]
    [size="5"][b]Examples[/b][/size]
    [indent][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][/indent]
    [size="5"][b]Related Patterns[/b][/size]
    [indent][bquote]Model collections are also called a Model Database.[/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.