watson game, fall 2004: the server group
DESCRIPTION
Watson Game, Fall 2004: The Server Group. 1. The Protocol. Joseph Wong. WAG Protocol. TCP Connection Port 1500 Communication between: Server and Client Server and Database. End of arguments list. Number to identify the command. Command Number. List of arguments for the command. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/1.jpg)
Watson Game, Fall 2004:
The Server Group
![Page 2: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/2.jpg)
1. The Protocol
Joseph Wong
![Page 3: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/3.jpg)
WAG Protocol
• TCP Connection– Port 1500
• Communication between:– Server and Client– Server and Database
![Page 4: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/4.jpg)
Watson Game Protocol
• Data stream format
CMD;CMD_ID;PARAM1=ARG1;…;PARAMk=ARGk\n
– ; used as the delimiter– Both client/server talk in same format
Command Number
Number to identify the command
List of arguments for the command
End of arguments list
![Page 5: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/5.jpg)
Commands• Command Numbers:
– 1 – Login– 2 – Logout– 3 – Create– 4 – Load Player– 5 – Load Game State– 6 – Save– 7 – Load Challenge– 8 – Complete Challenge– 9 – Get DARs
• Examples– Can be found in previous semester’s PowerPoint slides.
![Page 6: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/6.jpg)
Scoring Module
• Old Scoring Module– Fake GPA:
• Number of question correct / Number of questions * 4 = GPA
– Example:• 11 correct, 15 questions• GPA = (11/15) * 4 = 2.933
• Required a score of 4.0 to beat the game.
![Page 7: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/7.jpg)
Scoring Module
• New Scoring Module– More efficient and “real”– Requires a 2.0 GPA to graduate
![Page 8: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/8.jpg)
2. The Score Module
Martin Goldman
![Page 9: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/9.jpg)
In the Current Scoring System...
• Course grades are precise numeric representations
• GPA = (Class1Grade + Class2Grade + ... + ClassNGrade) * (4/5N)– Example: Class1Grade = 3/5,
Class2Grade = 3/5, Class3Grade = 5/5•(3+3+5)*(4/5(3)) = 2.933
![Page 10: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/10.jpg)
In Real Life...
• Course grades are letters -- loose representations
• The new scoring module will attempt to simulate this concept more closely
• GPA = (Class1GradeValue + Class2GradeValue + ... + ClassNGradeValue) / N
![Page 11: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/11.jpg)
An Example
• Example: Class1Grade = 5/5, Class2Grade = 3/5, Class3Grade = 3/5– Pick a grading scale, e.g. A=5/5, B=4/5,
C=3/5, D=2/5, F=1/5 or 0/5– Class1Grade = 3/5, Class2Grade = 3/5,
Class3Grade = 5/5– Class1GradeValue = 2.0, Class2GradeValue
= 2.0, Class3GradeValue = 4.0– GPA = (2.0 + 2.0 + 4.0) / 3 = 2.667
![Page 12: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/12.jpg)
3. Game Statistics
Ryan Andrew
![Page 13: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/13.jpg)
Watson Game Server
• Has five global singleton objects– ChallengeDispatcher– DatabaseObject– Scorer– WGListener– GameKeeper manages the game
statistics• I will focus on this object
![Page 14: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/14.jpg)
Watson GameKeeper
• getPosition() / setPosition()• addNewItem() / dropItem()• addNewPlayer() / dropPlayer()• getTotal()• setWorldDescription() /
getWorldDescription() • showAll() - // debug• showItems() - // debug
![Page 15: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/15.jpg)
To Be Added…• Statistics button to Client• When pressed, GameKeeper receives a
request for statistics of all players in the database currently logged onto the Watson Game
• GameKeeper does a database query through the DatabaseObject
• Format results and send back to the Client for the player to view
![Page 16: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/16.jpg)
To Be Added…
• Statistics to return to Client about currently logged on players– Total time logged on this game session– Total time logged on in total– Total number of times player has logged on
• Proper fields must be added to the database– With timestamp and calculations
![Page 17: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/17.jpg)
My Responsibilities
• Debug showItems(), and showAll() if necessary
• Interact with Client and Database groups to design Statistics button handling and database field creation
• add necessary functions to display and track these new statistics
![Page 18: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/18.jpg)
4. Challenge Dispatching(Part 1)
Gene Cumm
![Page 19: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/19.jpg)
Challenge Dispatching•Seems complete•Ensure functionality of current dependencies:
WatsonGameServer.getDatabaseObject()
DatabaseObject.getChallenge()WGCommand.getCmdID()WGConnection.writeToClient()WatsonResultSet: .nextRow(), .getData(), .hasMoreRows()
![Page 20: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/20.jpg)
Challenge Dispatching•Ensure functionality with client
Output matches Protocol Client expects
•Ensure that the Table attribute names are correct
Matches with Database•Work with WGConnection owner to integrate ChallengeDispatcher
![Page 21: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/21.jpg)
5. Challenge Dispatching(Part 2)
Larisse Voufo
![Page 22: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/22.jpg)
Input and Dispatching Visualization
![Page 23: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/23.jpg)
Process and Output: Methods Used
• getChallengeInfo – Text and choices– Correct answer– Major
• checkChallengeAnswer– Right answer?– Return correct answer to client?– Allow second-chance if wrong?
![Page 24: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/24.jpg)
Future
• Incorporate the level and type of challenge while getting the Information?– Player’s level vs. Challenge’s difficulty
level– Add True/False questions.
![Page 25: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/25.jpg)
6. Challenge Trigger Handler
Roy Chung
![Page 26: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/26.jpg)
Goals
• New hot spots will have to be defined.• Some will be constant, for example, the
elevator button, opening/closing doors.• Others hot spots will be at specific
points, i.e. a specific corner or a certain wall.
• A challenge will be generated depending on the hot spot.
![Page 27: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/27.jpg)
Handler Duties
• Client will send a message stating that the player has triggered a challenge.
• The handler will determine whether the challenge is academic or a residential life challenge.
• This can be identified by keeping track of the hot spot ID.
![Page 28: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/28.jpg)
Handler Duties• The handler will respond with the
appropriate type of challenge. • A query will be made to the database to
get the appropriate challenge.• The handler will then send the
challenge back to the client.• Since players can only attempt one
challenge, other current challenges will have to be suspended.
![Page 29: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/29.jpg)
Implementation Ideas
• New challenges will have to be devised and entered into the database.
• May need a new field to designate the type of challenge (academic or residential life).
• Have specific ID numbers assigned to hot spot, i.e. academic starts with ‘1’ and residential life challenges start with ‘2’
![Page 30: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/30.jpg)
New Challenges• Possible new residential challenge
ideas:• Bumping into the wall that causes
damage to laptop which will require repairs.
• Delivering packages to other professors or teaching assistants and possibly getting a reward (like money).
• This will allow players to familiarize themselves with the environment.
![Page 31: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/31.jpg)
New Challenges
• Posting flyers on bulletin boards around the building
• Buying items from vendors, i.e. extra pencil or paper.
• Other ideas?
![Page 32: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/32.jpg)
7. Login-Logout Support
Steve Safranek
![Page 33: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/33.jpg)
What the LoginLogout Class Does:•Handles logging in the player
•Authenticates player
•Logs player out
![Page 34: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/34.jpg)
How the Class Accomplishes This:•User enters name and password
•These are sent to database
•Database returns int value for one of three cases
•User exists and password is correct, 1
•A logged in message sent from db connection
•User exists and password is incorrect, 0
•Message sent telling user incorrect password has been entered
•User does not exist, -1n
•Message sent to user asking if they are new to the game
![Page 35: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/35.jpg)
8. Player Maintenance &
Character Creation Support
Priyal Shah
![Page 36: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/36.jpg)
PlayerMaintenance Class
• Purpose: keep track of user activity– If a character in the database has not
played the game for three months, activity status turns to Inactive
– No activity for six months leads to account deletion
![Page 37: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/37.jpg)
Player Maintenance (2)• Implementation Requirements:
- Need a Date field in Character Table of the database to keep track of most recent user login
- Another Number field in Character Table to keep track of user activity
0 – Active 1- InActive• methods in DatabaseObject class:
• lastLoginDate(String username)• activityStatus(String username)
![Page 38: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/38.jpg)
Player Maintenance (3)Variables:Two final int variables: ACTIVE & INACTIVEDatabaseObject to connect to the
databaseMethods:getLastLogin(String username)setActivityStatus(int activity)getActivityStatus(String username)deleteAccount(String username)activate(string username)
![Page 39: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/39.jpg)
Player Maintenance (4)
When is it used:• While internal Maintenance is run• On Login:
– Checks if the user is active– If active – Normal process path– If inactive – sends a message to
client, so that it can prompt the user to activate the account before he/she can login
![Page 40: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/40.jpg)
Character Creation support
• Currently, code for character creation is stubbed off in WGConnection.
• Fix code in WGConnection• Test the support code in
CharacterCreation,• LoginLogout, ChallengeDispatcher
classes• Fix code where needed
![Page 41: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/41.jpg)
9. Game Status Info&
Database Object Support
Brian Wolf
![Page 42: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/42.jpg)
Wrap-up
• Time is short; we wish to especially update comments & documentation
• Many hands make work light• Bugs & commented out code now
examined by new eyes
![Page 43: Watson Game, Fall 2004: The Server Group](https://reader036.vdocuments.us/reader036/viewer/2022081511/56815225550346895dc06bf1/html5/thumbnails/43.jpg)
The End
(Applause)