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

    Gateway

    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.


    [size="5"]Intent
    [bquote]Isolate database changes for index and/or client/server synchronization.[/bquote]

    [size="5"]Also called
    [bquote]Index Synchronization, Choke Point, Ethereal Void[/bquote]

    [size="5"]Problem
    [bquote]It is critical that all Spatial Indices remain synchronized with their associated Model Database. Similarly, a client must remain synchronized with a server. Since several things can cause a change to a Model Database, it is best to isolate all changes to two calls: push and pop (a.k.a. insert / remove). This creates two states: "in world" and "out of world" which is also known as "in ethereal void."

    This pattern gets its name from the way that all insertions and deletions are limited to one place like a physical gateway where all people must move through it to get in or out which allows you to control flow.[/bquote]
    [size="5"]Solution
    [bquote]A pop() method brings a model object out of the "void" and into the Model Database and its associated spatial index. A push() method removes the object from the database and index and into the void.

    There are three basic operations:
    • When an object moves, it pushes itself into the void, updates its position, then pops itself back into the world.
    • When an object is created, it is created in the void then popped into the world.
    • When an object is destroyed, it is pushed into the void first, then destroyed.
    The push / pop choke point may also be used to synchronize a client to a server by transmitting all database changes from server to client.

    It should also be noted that having one gateway of change allows multiple changes to be made simultaneously with minimal synchronization effect. For example, push(); move(); changeSize(); pop(); prevents an unnecessary update from happening around the changeSize() call.[/bquote]
    [size="5"]Structure:
    [bquote]Not available at this time.[/bquote]

    [size="5"]Examples
    [bquote]Some games have different world or index states. For example:
    • An object may be allowed to be placed inside of another object (a container).
    • An object may be attached to another object (a weapon, armor, etc.)In these cases, there may be more than one implementation of pop(). For example:
      • popIntoWorld( int x, int y); // pop into world
      • popIntoContainer( Model &container ); // pop into container
      • popOnto( Model &parent, Matrix4X4 &orient ); // pop onto another model.[/bquote][size="5"]
        Issues and Risks
        [bquote]none[/bquote]

        [size="5"]Related Patterns
        [bquote]A Gateway simplifies the synchronization of a Spatial Index with a Model Database.

        Gateways are often implemented inside of Model Database code.[/bquote]
        [size="5"]Uses and References
        [bquote]Thanks to Herman Miller and Tony Zurovec.[/bquote]


      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.