The protocol should be text based and use TCP as the primary communication method: TCP communication streams are simpler to maintain and more reliable than UDP streams. A Java class can be used to hold String
constants that correspond with each of the commands.
-
NEW_GAME
: This is sent by the client to the CaveSystem server initialy to provision the new game -
GAME_DESC
: Sent by server to client, begins the description of the game-
GAME_ID #
: the game id of the newly created player where#
is the id -
HUB_DESC
: begin the description of caves in the hub-
CAVE_DESC
: begin describing one caveCAVE_NAME ###
: the name of this cave, where###
is replaced with the nameCAVE_ID #
: id of the cave, where#
is replaced with the cave's ID numberEND_CAVE_DESC
: end the cave description
-
END_HUB_DESC
: end the hub description
-
-
END_GAME_DESC
: signals the end of the descripton to the game
-
-
ENTER_CAVE #
: Sent by client to CaveSystem,#
should be replaced with the ID number of the cave to be entered -
CAVE_SERVER ###
: Sent by CaveSystem server to client afterENTER_CAVE
command, replace###
with the ip address and port of the Cave server relating to the ID sent by theENTER_CAVE
command -
After client gets
CAVE_SERVER ###
from CaveSystem server, it connects to the Cave server specified by the IP and Port combination
-
RESUME_GAME #
: initial request sent by client to Cave server, replace#
with the game ID recieved from the CaveSystem server -
CAVE_DESC
: Sent by Cave server to client, begins description of this cave serverCAVE_NAME ###
: the name of this cave, with###
replaced with the cave nameCAVE_PLAYER_OCCUPANCY #
: the number of players in this cave, with#
being replaced with the occupancyCAVE_WUMPUS_OCCUPANCY #
: the number of wumpus in this cave, with#
being replaced with the occupancyMSG ###
: a banner message to display on the client terminal, replace###
with the message to be displayed. Can be sent any number of times, from 0-n.END_CAVE_DESC
: ends the description of this cave