Challenge Dispatcher – Input

Download Report

Transcript Challenge Dispatcher – Input

Johnny Loi
Dimitri Syrow
Him Seng Wong
The Server Group
Greg Miles
Adam Marczyk
CS 495
Prof. Steflik
Spring 2004
Kyle Lippincott
Matt Dietz
Shengsheng Liu
Protocol Handling
Johnny Loi
CS 495 Senior Seminar
Prof. Steflik
Available Protocols
 TCP




Reliable (Acknowledgements)
Virtual Circuit Connection
Full duplex connection
Data flow in stream of bytes
 UDP




(Transmission Control Protocol)
(User Datagram Protocol)
Unreliable
Connectionless delivery
No ordering of incoming messages
No feedback to control information flow
Protocol Chosen
 TCP
 Advantage
Reliability
 TCP packets accepted almost everywhere
 Full duplex communication
 Persistent

 Disadvantage

More overhead (higher bandwidth)
Watson Game Protocol
 Handshake
 Initial
connection: “OK” if successful
 Login
 “OK”
if user name and password are
correct
 “WRGPWD” if password is incorrect
 “NOUSR” if no such user exists
Watson Game Protocol
 Data
stream format
Number to identify the command
End of arguments list
CMD;CMD_ID;PARAM1=ARG1;…;PARAMk=ARGk\n
Command


List of arguments for the command
; used as the delimiter
Both client/server talk in same format
Watson Game Protocol
 Common

LOGIN cmd_id usr pwd


Ex. LOGOUT;2\n
CREATE cmd_id attr1 attr2 … attrk


Ex. LOGIN;1;usr=bob;pwd=abc123\n
LOGOUT cmd_id


Commands
Ex. CREATE;12;height=tall;group=student;year=sophomore\n
MOVE cmd_id x y z

Ex. MOVE;15;x=2;y=0;z=5\n
Watson Game Protocol
 Common

GETCRS cmd_id course1 … coursek


Ex. GETCRS;14;crs=CS495\n
GETSCR cmd_id [score]


Commands
Ex. GETSCR;9;scr=5000\n
//server sending back score
UPDTSCR cmd_id score

Ex. UPDTSCR;20;scr=1000\n
//client sends to server
Watson Game Protocol
 Common

GETSCHD cmd_id [semester]


GETSCHD;2;sem=spring04\n
SETSCHD cmd_id semester course1 … coursek


Commands
SETSCHD;5;sem=fall04;crs=CS210;crs=PE101\n
GETSACK cmd_id [item1 … itemk]

GETSACK;6\n
Watson Game Protocol
 Common

UPDTSACK cmd_id item1 … itemk


UPDTSACK;7;item=books;item=money;item=id_card\n
GETSTAT cmd_id stat1 stat2 … statk


Commands
Ex. GETSTAT;19;bank=$200;gpa=3.5;health=75%\n
UPDTSTAT cmd_id stat1 … statk

Ex. UPDTSTAT;29;bank=$500;gpa=4.0;health=25%\n
Watson Game Protocol
 Common

HOTSPOT cmd_id x y z



Commands
Ex. HOTSPOT;5;x=34;y=2;z=5\n
Expect a CHALL from the server if location x,y,z is a hotspot,
else the server will send back the same command.
CHALL cmd_id quest [choice1 … choicek] | ans





Ex. CHALL;5;quest=What is y = x++ if x =
2?;a=4;b=3;c=2;d=1\n
cmd_id is the same as the cmd_id from the HOTSPOT
command
Ex. CHALL;5;ans=2\n
cmd_id is the same as the question cmd_id
Server sends back “OK” if answer is correct otherwise
“WRGANS”
Watson Game Protocol
 Common

MEET cmd_id x y z [fac, npchar, stu]



Commands
MEET;5;x=6;y=0;z=35\n
//client sends
MEET;5;x=6;y=0;z=37;fac=Prof. Steflik\n //server sends back
MSG cmd_id gd | er



LOGIN;5;bob;abc123\n
MSG;5;er=WRGPWD\n
msg
MSG;5;gd=OK
msg
//client sends
//server sends back error
//server sends back good
Server Command Handling
 Receives
stream from client
 Tokenizes the received data
 Looks at command
 Sends arguments to appropriate
command handler
 Handler sends results back to client
Threads
Dimitri Syrow
Database
Client
Server
Threads
Core
Statistics
Challenge Dispatch
Threads
Core
Login/Logout
Character Creation
Scoring
Statistics
Challenge Dispatch
Threads
Core
Login/Logout
Character Creation
Scoring
The Watson Game:
Character Creation
CS 495b – Senior Seminar
Him Seng Wong
Prof. Steflik
Characters
 Role
Playing Game - Diablo II
 First
Person Shooting - Counter-Strike
 Simulation
- The Sims
Game Category (PC)
Action
Adventure
Racing
RPG
Simulation
Sports
Strategy
RTSS
Arcade
Puzzle
Creating a Character
 Steps
to create a character
 Choose
 Pick
a status
a profession
 Decide
one’s attributes
Status
 Name: All
 Age:
characters should have a name.
How old the character is in the game.
 Gender:
Is the character male or female?
 Nationality:
This is where the character is
born.
 Education:
college standing. In this game,
when creating a new character, its standing
should be Freshman.
Profession

In this game, players are only able to pick
student as a profession.

Watson Student – representing players

Harpur Student – representing players

SOM Student – representing players

Decker Student – representing players
Profession – non playing

Teaching Assistant – provide assistant when
players face challenges

Faculty – help students when they face
challenges. However, he/she also generates
challenges.

Support Staff – these represent wizards in
this game. They are very helpful in
overcoming some random challenges, such
as hard-drive crashes, PC gets infected by
virus, and etc…
Profession
 The
purpose of creating teaching
assistant, faculty, and support staff is to
enhance interaction, playability in the
game.
Attributes

Beauty: The physical attractiveness of a
person.
 Charisma: Indicates the attractiveness of a
person. It does not tell how well looking a
person is, but instead, it tells whether people
like a person by his or her attitude.
 The attributes are decided by either client or
database group.
Server group – character creation

Players create the characters through client
interface.
 Client sends all the characters’ information to
the server.
 Protocol handler sends list of arguments.
 Character creation has to parse through the
arguments to get the value.
 Insert the value into the database.
Login/Logout Tool
Gregory Miles
CS 495: Senior Seminar
Prof. Steflik
What we need
 Server
side verification
 Not just authentication
 Coordinating class
 Calling method
 Constructor
 Authenticate Method
What the class will do
 Takes
Login and password
 Sends both to database of users
 Database verification
 No encryption necessary
 If incorrect and user exists
 If incorrect and user does not exist
 If correct
Constructor and global variables
 Class
variables login and password
 Constructor simply assigns the log and
pass variables coming in to the global
login and password variables.
Authenticate method
 Contain
a local variable of type int
 Sends password to database
 Database returns value

Determines what Authenticate() will return
 Returns
local variable to calling method
for processing
The Challenge Dispatcher
Adam Marczyk
CS 495 – Senior Seminar
Prof. Steflik
Challenge Dispatcher – Input
When players bump into an “invisible
polygon” that signifies a challenge, it will be
the client’s responsibility to send to the server
coordinates of the polygon just contacted.
 This information will pass through the
protocol-handler module and to the thread
handler, which will assign it to the appropriate
thread for that currently logged-in character.
 The character’s thread will contact the
challenge dispatcher and pass in the
coordinates of the challenge.

Parsing Input

The challenge dispatcher will contact the
database query object to look up information
about the challenge based on its coordinates.
 The database query object will return
information such as:




The type of the challenge (true/false, MC)
The text of the challenge
The correct answer
Any preconditions for taking the challenge (i.e.,
some upper-level challenges may be off-limits to
new players).
Processing and Output

First consider whether the player has already
completed the challenge.
 Next, query the character’s thread for their
level to determine if they’re eligible.
 If not, return a message telling them so.
 If they are, send the text of the challenge and
the choices to the client.
 Once we get an answer, inform them whether
it was right or wrong; if correct, use the
database write object to record their success.
Open Questions
 Should
the player be informed of what the
correct answer is if they get it wrong?
 Should players be able to re-take a
challenge they got wrong?
 Should there be any penalty for getting a
challenge wrong or reward for getting it
right?
Scoring Object
Kyle Lippincott
CS 495: Senior Seminar
Prof. Steflik
Score Types
 User
General (Life Experiences)
 GPA
 Enrolled
Course Current Grade
 Completed Course Grade
User General

Attached to user, not individual classes
 Not range bounded, positive and negative
 Positive examples:



Honor Society
Good health/going to the gym
Negative examples:


Getting ill
Trouble with the law
GPA
 Pseudo-score
(not stored separately)
 Average of all completed courses’
grades multiplied by how many credits
the course was
 Read-Only
Enrolled Current Score
 Bounded
0-100
 ‘Additive’ scoring
 Get/Set
 Obtain
current value (but not current
maximum)
 Add to current value
 No negatives/ex-post-facto deductions
Completed Course Grade
 Internally
bounded 0-100
 Complete
 Externally
a course, save that score
represented on 0-4.0 gpa
scale
 Decimal
 Multiply
value, 3 places after decimal
by course credits, divide by
total credits, obtain GPA
 Read-Only
Object Diagram
Database Object
Matthew Dietz
CS 495: Senior Seminar
Prof. Steflik
Server/Database
 Database
 Handles

Object
all types of queries:
SELECT, DELETE, INSERT, UPDATE
 Creating
a packaging system between
database and server
 Incorporate an efficient command system
Database Channel
QueryResult Class
 Implements
 Results
a HashTable and a Vector.
can be referenced by column
names, and a list of column names can be
returned for easy access.
 Formats the data without the server
needing to know how it was done.
Database Object with QueryResult
Database Messaging
 Implement
a message parser as a
database object front end
 Allows
the clients and servers to only ask
for information they want without knowing
how the database works
 Incorporated with bandwidth-saving
messaging system.
Database messaging

Proprietary message format

Number category choices, and allow server to
pass only those with parameters




Ex. 3 471
 Could request Information on
CS 471
Pro: Faster, less network intensive
Pro: Client/Server unaware of db format, only
know how to get desired information
Con: Client and Server still need to know codes
for information requests, which can get ugly
Object Structure
 The
message parsing system
 Knows
how to index a table of Strings
given input parameters
 String
table
 Contains
 Query
all queries
Builder
 Knows
how to compile queries using the
String table and input parameters
Watson Adventure (WA) Game
Statistic
Shengsheng Liu
CS 495
Professor Steflik
World and Characters
Reference: http://www.diabloii.net/
WA World Statistic

Time

The characteristics of the environment

Example: floor may be wet

Number of the players

Positions

Both the players and the object
WA Character Attributes
•
Identification
–
•
Equipments
–
•
Money and Objects in the knapsack
Goal
–
•
An unique identification number and a name
Enrolled courses, Score, GPA and Status
Movements
–
Position, direction, activity status and interaction with
environment and other players.
3-Value Interaction Range
• 2 Points and 1 length variable to determine
the interaction range
• The range decides what one can see and
interact with
Interaction Range
 Basic
 The
Idea:
game keeps a list of players and objects
that are within one’s interaction range.
 And one only interacts with the players and
objects within the range.
 Benefits: reduces the amount of data needed
to process.
Additional Features
 Health Attribute
 Randomly
Generated Accidents:
Fall down the stairs
 Eye glasses drop on the ground and shatter

 Sickness
 Objects
in the Knapsack
 Glasses,
Medicines and cheat sheets
 Walk slower if the knapsack is too heavy