Watson Game, Fall 2004: The Server Group. 1. The Protocol Joseph Wong.
-
date post
20-Dec-2015 -
Category
Documents
-
view
221 -
download
3
Transcript of Watson Game, Fall 2004: The Server Group. 1. The Protocol Joseph Wong.
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
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
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.
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.
Scoring Module
• New Scoring Module– More efficient and “real”– Requires a 2.0 GPA to graduate
2. The Score Module
Martin Goldman
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
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
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
3. Game Statistics
Ryan Andrew
Watson Game Server
• Has five global singleton objects– ChallengeDispatcher– DatabaseObject– Scorer– WGListener– GameKeeper manages the game
statistics• I will focus on this object
Watson GameKeeper
• getPosition() / setPosition()• addNewItem() / dropItem()• addNewPlayer() / dropPlayer()• getTotal()• setWorldDescription() /
getWorldDescription() • showAll() - // debug• showItems() - // debug
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
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
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
4. Challenge Dispatching(Part 1)
Gene Cumm
Challenge Dispatching•Seems complete•Ensure functionality of current dependencies:
WatsonGameServer.getDatabaseObject()
DatabaseObject.getChallenge()WGCommand.getCmdID()WGConnection.writeToClient()WatsonResultSet: .nextRow(), .getData(), .hasMoreRows()
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
5. Challenge Dispatching(Part 2)
Larisse Voufo
Input and Dispatching Visualization
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?
Future
• Incorporate the level and type of challenge while getting the Information?– Player’s level vs. Challenge’s difficulty
level– Add True/False questions.
6. Challenge Trigger Handler
Roy Chung
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.
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.
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.
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’
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.
New Challenges
• Posting flyers on bulletin boards around the building
• Buying items from vendors, i.e. extra pencil or paper.
• Other ideas?
7. Login-Logout Support
Steve Safranek
What the LoginLogout Class Does:•Handles logging in the player
•Authenticates player
•Logs player out
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
8. Player Maintenance &
Character Creation Support
Priyal Shah
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
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)
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)
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
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
9. Game Status Info&
Database Object Support
Brian Wolf
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
The End
(Applause)