Jump to content
  • Advertisement
  • 06/19/01 11:34 PM
    Sign in to follow this  

    Type Database

    General and Gameplay Programming

    Myopic Rhino
    (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.

    [bquote]Store information which is common to Model types.[/bquote]

    [bquote]There is often a great deal of common information concerning types of objects. Artwork, basic statistics, etc. To avoid duplication, and to simplify editing, these are separated into a database.[/bquote]

    [bquote]A Type Database is conceptually static data associated with a model sub-class. However, the type database is rarely implemented this way; instead, it is often an independent relational database indexed by "type number" and referenced by such in a model instance.[/bquote]

    [bquote]Not available at this time.[/bquote]

    [bquote]Examples of fields which might exist in a type record:
    • Prototype state; e.g. max hit points, strength, range, cost, etc.
    • Size, extents, initial orientations.
    • Type categorization. (e.g. offense, defense, mobile, fixed, human, alien, etc.)
    • Execution scripts. (See Usecode.)
    • Artwork; e.g. meshes, texture-map, sprites. (These are frequently stored by reference to yet another database.)
    • Sound effect handles or references.
    • Appearance maps. (See Appearance Map.)
    Type lookup may be done directly to the a type database. For example, a view object might reference getType (typeBeingSorted)->getSize() to find an extent in a sort loop.

    Alternately, type lookups may be delegated to an object. For example: modelBeingSorted->getSize(). The delegated method allows a sub-class to override in strange cases. For example:

    int Spaceship::getSize()
    int size = getType()->size;
    if (shieldsUp) size *= 2;
    return size;
    Type databases often contain tweaky constants which are adjusted for game play reasons near the end of a project. Also, these constants may be editable by the players or mission builders. Consequently, type data is often loaded dynamically from text files or similar human readable input.

    Art importation is often closely associated with the type importation. It is common to see a compile-time tool(s) which handles both.

    A type database is usually read-only after game initialization, but may be read-write in editor mode.

    Type Databases occasionally implement Factories (See Design Patterns) to generate specific Model or Controller objects on demand by either type number or type name. This is especially common in edit modes.[/bquote]
    [size="5"] Issues and Risks
    [bquote]None at this time.[/bquote]

    [size="5"]Related Patterns
    [bquote]Type Database is read-only by Model, View, and Controller.

    Type Database may store global data for Appearance Map.

    Type Database may act as a Factory for Model or Controller objects.[/bquote]

      Report Article
    Sign in to follow this  

    User Feedback

    There are no comments to display.

    Create an account or sign in to comment

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

    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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!