Project_ The Watson Game-Gene Cumm

Document Sample
Project_ The Watson Game-Gene Cumm Powered By Docstoc
					                                 Project: The Watson Game
                                      Function: Server
                              Subsystem: Challenge Dispatching
                                    Author: Gene Cumm
                                       Date: 05/07/05




1 Introduction .......................................................................................................................4
   1.1 Goals and objectives ......................................................................................................4
   1.2Statement of scope ..........................................................................................................4
   1.3 Software context ............................................................................................................4
   1.4Major constraints ............................................................................................................4
2Data design.........................................................................................................................4
   2.1Internal software data structure .......................................................................................5
   2.2Global data structure .......................................................................................................5
   2.3Temporary data structure ................................................................................................5
   2.4 Database description ......................................................................................................5
3 Architectural and component-level design .......................................................................5
   3.1Program Structure ...........................................................................................................5
      3.1.1 Architecture diagram ...........................................................................................7
      3.1.2 Alternatives .............................................................................................................7
   3.2Description for Component ChallengeDispatcher ..........................................................7
      3.2.1 Processing narrative (PSPEC) for component ChallengeDispatcher ........................8
      3.2.2 Component ChallengeDispatcher interface description...........................................8
      3.2.3Component ChallengeDispatcher processing detail ....................................................8
          3.2.3.1Interface description ................................................................................................. 9
Class: CS-495 Spring 2004                                                                           Author: Gene Cumm
Project: The Watson Game                                                                                Date:05/07/2005
Function: Server
Subsystem: Challenge Dispatching
         3.2.3.2Algorithmic model (e.g., PDL) ................................................................................. 9
         3.2.3.3Restrictions/limitations ............................................................................................. 9
         3.2.3.4Local data structures ................................................................................................. 9
         3.2.3.5Performance issues ................................................................................................... 9
         3.2.3.6Design constraints ..................................................................................................... 9
  3.3Description for Component LifeChallengeHandler ........................................................9
     3.3.1 Processing narrative (PSPEC) for component LifeChallengeHandler .....................9
     3.3.2 Component LifeChallengeHandler interface description. .......................................9
     3.3.3Component LifeChallengeHandler processing detail ................................................10
         3.3.3.1Interface description ............................................................................................... 10
         3.3.3.2Algorithmic model (e.g., PDL) ............................................................................... 10
         3.3.3.3Restrictions/limitations ........................................................................................... 10
         3.3.3.4Local data structures ............................................................................................... 10
         3.3.3.5Performance issues ................................................................................................. 10
         3.3.3.6Design constraints ................................................................................................... 10
  3.4 Software Interface Description ....................................................................................10
     3.4.1 External machine interfaces ...................................................................................10
     3.4.2 External system interfaces .....................................................................................11
     3.4.3 Human interface .....................................................................................................11
4User interface design........................................................................................................11
5Restrictions, limitations, and constraints .........................................................................11
6Testing Issues ...................................................................................................................11
  6.1Classes of tests ..............................................................................................................11
  6.2Expected software response ..........................................................................................11
  6.3Performance bounds......................................................................................................11
  6.4Identification of critical components ............................................................................12
7Appendices .......................................................................................................................12
  7.1Requirements traceability matrix ..................................................................................12
  7.2Packaging and installation issues ..................................................................................13
  7.3Design metrics to be used .............................................................................................13
  7.4 Supplementary information (as required) ....................................................................13
SOFTWARE DESIGN SPECIFICATION



 Introduction
The WAG, also known as the Watson Adventure Game, is an interactive
computer based networkable game. Three primary components comprise the
system, the client, the server and the database. The server is divided
into many objects, two of which are the ChallengeDispatcher and the
LifeChallengeHandler.


 Goals and objectives
         The major goal of this project is to create a game which
         simulates the experience of attending Binghamton University as a
Class: CS-495 Spring 2004                                    Author: Gene Cumm
Project: The Watson Game                                         Date:05/07/2005
Function: Server
Subsystem: Challenge Dispatching
        Watson School Mechanical or Electrical Engineer or Computer
        Scientist while educating the class about the complexities of the
        development of a major project


Statement of scope
        The computer based game simulates attending classes within
        several majors, the ability to see other players, or “students”
        in the game, tracking progress, and displaying prerequsite
        awareness.


Software context
        The purpose of the game is as a recruitment tool for attracting
        high school students to Binghamton University


Major constraints
        The program must be designed in a fashion such that it can be
        exposed to the greatest audience within reason.




Data design
Many data elements are used within the game. Most are component
specific and do not cross components. The primary two structures that
cross components are command/response pairs and database queries.


Internal software data structure
        Within the Watson Game Server, several structures are used.
        WGConnection encapsulates the connection to a single client. The
        database object separates the basic functions and purposes of the
        database from the exact SQL query syntax and implementation. the
        WatsonGameServer coordinates all function within the server and
        can track all of the child objects. WatsonResultSet represents a
        data structure of a response from a database query.


Global data structure
        Commands are described in the paper about the CommandParser
        subsystem of the Server function.
Class: CS-495 Spring 2004                                  Author: Gene Cumm
Project: The Watson Game                                       Date:05/07/2005
Function: Server
Subsystem: Challenge Dispatching
Temporary data structure
      None


Database description
      Please see Database function group papers.




Architectural and component-level design
      Within the Watson Game server, there are two basic types of
      classes, static and dynamic. Static classes, threaded to always
      run, include WastonGameServer, ChallengeDispatcher,
      DatabaseObject, DarsReport, ElevatorHandler, GameKeeper,
      LifeChallengeHandler, Scorer, WGCmdParser, WGListener, and
      WGPositionHandler. Dynamic classes, created as needed, include
      CharacterCreation, LoadGloabalStatHandler, LoginLogout,
      WatsonDatabaseException, WatsonResultSet, WGArguement, WGCommand,
      WGConnection, WGItem, WGKnapsack, WGLoginSaveLogoutHandler, and
      WGPlayer.


Program Structure
         The WatsonGameServer is the master control class of the server.
         It spawns as independent threads a ChallengeDispatcher, a
         DatabaseObject, a WGListener, a Scorer and a GameKeeper. The
         ChallengeDispatcher takes a query from a WGCommand via a
         WGConnection, queries the DatabaseObject, parses a
         WatsonResultSet and returns the appropriate information about a
         given academic course challenge. If the query was for a Life
         Challenge, it passes the information to the LifeChallengeHandler.
         The DatabaseObject attaches to the database and returns
         WatsonResultSet objects for queries executed by its methods.
         WGListener listens to new connections to the server and generates
         new WGConnection objects, passing them to the server. The Scorer
         determines a given player's Grade Point Average, or GPA, based on
         the academic challenges that they have completed. The GameKeeper
         tracks the IP and XYZ coordinates of all of the players and adds
         and removes items from a player. WGCommand separates a command
         from the client into WGArgument objects. WGConnection allows
         other objects to talk to a single client in a discussion.
         LifeChallengeHandler acts like ChallengeDispatcher but for
         Residential Life Challenges, also known as ResLife Challenges or
         Life Challenges. WGLoginSaveLogout coordinates login, logout,
         save and restore functions. WGCmdParser takes a WGCommand,
         parses it to WGArguments and proceeds to pass the command to the
Class: CS-495 Spring 2004                                    Author: Gene Cumm
Project: The Watson Game                                         Date:05/07/2005
Function: Server
Subsystem: Challenge Dispatching
                                    Watson
                                    Game
                                    Server




           Challenge     Database     WG                   Game
                                                Scorer
           Dispatcher     Object    Listener               Keeper




                                      WG
                                      Con-
                                     nection




                                      WG
                                    Command




            WGCmd          Login               Character
            Parser        Logout               Creation
                                       WG
                                    Argument




         appropriate handler for the given command. CharacterCreation is
         used for the creation of new players/characters/students.
      Illustration 1Diagram Author: Johnny Loi, Spring 2004
    Architecture diagram

    Alternatives
        No alternatives were investigated as this project was the repair
        and improvement of an existing software package.


Description for Component ChallengeDispatcher


Class: CS-495 Spring 2004                                           Author: Gene Cumm
Project: The Watson Game                                                Date:05/07/2005
Function: Server
Subsystem: Challenge Dispatching
        The ChallengeDispatcher is a singleton object that is threaded to
        run at any time required without blocking processing. It answers
        queries for challenges that exist in the Database.


  Processing narrative (PSPEC) for component ChallengeDispatcher
                A single ChallengeDispatcher object is created by the
                WatsonGameServer object at its instantiation. Upon
                construction, the ChallengeDispatcher accepts a handle for
                the server and creates a handle for the DatabaseObject.
                ChallengeDispatcher.getChallengeInfo is called by the
                WGConnection to retrieve the Challenge information for the
                client. The command is parsed for the arguments of the
                type and connection unique challenge request. If the
                Challenge type is an academic challenge, it queries calls
                the DatabaseObject to query the database for the given
                challenge. It parses the WatsonResultSet for the
                questions, answers, and correct answers. This data is then
                returned to the WGConnection to pass to the client. If the
                query is for a LifeChallenge, the a new
                LifeChallengeHandler object is constructed to dispatch the
                challenge.


   Component ChallengeDispatcher interface description.
                ChallengeDipatcher.getChallengeInfo accepts a WGConnection
                and a WGCommand describing the connection to the client to
                return responses and the command for which a response is
                desired.

Component ChallengeDispatcher processing detail
                The constructor uses the passed argument of the parent
                WatsonGameServer to create a handle for it. The
                constructor then uses the handle to obtain a handle for the
                DatabaseObject. getChallengeInfo generates a vector of the
                command's argument. Integer.parseInt is used to parse the
                integer from the vector elements 0 and 1's WGArguments. If
                the type is a Life Challenge, a new LifeChallengeHandler
                object is created to dispatch the challenge.
                DatabaseObject.getChallenge is used to get a
                WatsonResultSet object containing the Challenge
                information. For each row in the WatsonResultSet,
                WatsonResultSet.getData is called with the argument of each
                desired field to obtain the data element within each.
                These data elements are appended together in the standard
                format of parameter=argument; with the type of challenge,
                the id of the challenge and the challenge type of academic
                challenge. After the elements are assembled for each row,

Class: CS-495 Spring 2004                                    Author: Gene Cumm
Project: The Watson Game                                         Date:05/07/2005
Function: Server
Subsystem: Challenge Dispatching
                the challenge question data is written to the client using
                WGConnection.writeToClient.


Interface description
                See 3.2.2

Algorithmic model (e.g., PDL)
                None

Restrictions/limitations
                Will return nothing if the challenge does not exist.

Local data structures
                None

Performance issues
                None

Design constraints
                None




Description for Component LifeChallengeHandler
        A LifeChallengeHandler object is created for every Life Challenge
        query given to the server. It queries the DatabaseObject for the
        given Life Challenge and returns the data to the client via the
        WGConnection. LifeChallengeHandler has been restructured such
        that it may in the future be reimplemented as a singleton
        threaded object with minimal changes.


  Processing narrative (PSPEC) for component LifeChallengeHandler
                LifeChallengeHandler accepts as options to its constructor
                the WatsonGameServer, the WGConnection, the command ID and
                the challenge ID. It queries the DatabaseObject for the
                challenge, parses the resulting WatsonResultSet for the
                data and returns the data to the client via the
                WGConnection.


   Component LifeChallengeHandler interface description.
                LifeChallengeHandler's constructor accepts the
                WatsonGameServer to which it belongs, the WGConnection
                across which it must communicate, the client's command
Class: CS-495 Spring 2004                                    Author: Gene Cumm
Project: The Watson Game                                         Date:05/07/2005
Function: Server
Subsystem: Challenge Dispatching
                identfier and the life challenge identifier.
                LifeChallenge.getLifeChallenge accepts the WGConnection
                that it must talk across, the command id and challenge id.

Component LifeChallengeHandler processing detail
                LifeChallenge constructor takes the WatsonGameServer
                argument and uses it to obtain handles for other objects it
                needs. It uses WatsonGameServer.getDatabaseObject to get a
                handle for the DatabaseObject that it should use. It then
                calls LifeChallenge.getLifeChallenge.
                LifeChallenge.getLifeChallenge queries the database via
                DatabaseObject.getLifeChallenge, which returns a
                WatsonResultSet. The remaining processing is identical to
                ChallengeDispatcher, explained in 3.2.3.


Interface description
                See 3.3.2

Algorithmic model (e.g., PDL)
                None

Restrictions/limitations
                Will return nothing if the challenge does not exist.

Local data structures
                None

Performance issues
                None

Design constraints
                None



Software Interface Description
        The WatsonGameServer communicates over an IP, Internetworking
        Protocol, network to clients. The IP network can be as simple as
        within the IP stack of a single machine or as complex as the
        entire Internet.


   External machine interfaces
                Connections are established using TCP, Transmission Control
                Protocol, over IP via a telnet session communicating data
                in a text based format. The text lines are separated by
Class: CS-495 Spring 2004                                    Author: Gene Cumm
Project: The Watson Game                                         Date:05/07/2005
Function: Server
Subsystem: Challenge Dispatching
                newlines and elements within a text line are delimited by
                semicolons. The command type followed by the client unique
                command id are the first two elements. Any other elements
                are in the format of parameter=argument


   External system interfaces
                See 3.4.1


   Human interface
                Human interface is given via the client or a telnet client.



User interface design
                Not applicable to the server.   See 3.4.3.



Restrictions, limitations, and constraints
The server was designed to be eventually platform independent while the
client is currently platform dependent upon Windows 32 bit
architectural.



Testing Issues
Basic functionality of the ChallengeDispatcher and LifeChallengeHandler
showed ideal function.


Classes of tests
        After initializing a server on a single computer, a telnet
        session was opened to the port upon which the server operates.
        Commands were issued in the same manner as a client would
        dispatch.

Expected software response
        The server should respond with the Challenge data.


Performance bounds
Class: CS-495 Spring 2004                                    Author: Gene Cumm
Project: The Watson Game                                         Date:05/07/2005
Function: Server
Subsystem: Challenge Dispatching
        None noted.


Identification of critical components
        Formating of the commands must match the desired criterion




Appendices
Additional data concerning the Watson Adventure Game is as follows.


Requirements traceability matrix
        Matrix only applies to the ChallengeDispatcher and
        LifeChallengeHandler.
1

Packaging and installation issues
        See appropriate documentation on the Watson Adventure Game
        website for client and database installation. The server
        requires IP connectivity such that clients may reach port 1500 of
        the server and a JDK, Java Development Kit, install.


Design metrics to be used
        None noted.


Supplementary information (as required)
        WAG home at http://www.cs.binghamton.edu/~steflik/cs495b/




Class: CS-495 Spring 2004                                    Author: Gene Cumm
Project: The Watson Game                                         Date:05/07/2005
Function: Server
Subsystem: Challenge Dispatching

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:47
posted:2/8/2010
language:English
pages:10