Network Jeopardy Protocol
Server Specification (ver. 1)
-
Game-master starts server. Wait for clients to subscribe. Client will establish a TCP connection, and send a
CM_SUBSCRIBE
message with team info. InCOLLECT_SUBSCRIPTIONS
state. -
Once
MIN_PLAYERS
number of players have subscribed (i.e.,MIN_PLAYERS
players have an active TCP connection with the server), the game has started. SendSM_NEW_GAME
to all players, notifying them that a new game has begun. InGAME_IN_PROGRESS
state.NOTE: A player that has joined may leave before
MIN_PLAYERS
join. When you think you haveMIN_PLAYERS
, check to make sure nobody disconnected. If anyone did, then continueaccept()
ing more connections. -
Game-master clicks on "Start Round." If a player is not already selected (i.e., first round), pick a player at random. ``Broadcast'' an
SM_NEW_ROUND
message. This message will carry the selected player's name. In `ROUND_IN_PROGRESS` state. -
If a
CM_CATEGORY
message is received, ensure that the message was sent by the selected player. Notify all players of choice through anSM_CATEGORY
message broadcast. InCATEGORY_SELECTED
state. -
Game-master sends
SM_QUESTION
to players, letting all players know the current question. Then Game-master stays idle, waiting for the firstCM_RING
message. InWAIT_FOR_RING
state. -
Once the first
CM_RING
message comes, Game-master stops accepting any otherCM_RING
messages and sendsSM_RING_CLIENT
message to all players, letting they know who is picked up to answer the current question. Then Game-master waits for the answer. InWAIT_FOR_CM_ANSWER
state. -
If a
CM_ANSWER
message is received, ensure that the message was sent by the selected player and then check whether the answer is correct. BroadcastSM_ANSWER
to all players, telling them the answer from the player and whether the answer is correct. InEND_OF_ROUND
state.
Client Specification (ver. 1)
-
Player starts client. Send
CM_SUBSCRIBE
message to the server. InJOINING_GAME
state. -
SM_NEW_GAME
message received from server. Update state and display info to player. InGAME_IN_PROGRESS
state. -
SM_NEW_ROUND
message received from server which includes the selected player's name. InROUND_IN_PROGRESS
state.- If selected player is this player, wait for player to choose
category. Send
CM_CATEGORY
message to server with chosen category. Continue inROUND_IN_PROGRESS
state.
- If selected player is this player, wait for player to choose
category. Send
-
SM_CATEGORY
received from server, carrying the category selected for this round. Display this info to the player. InCATEGORY_SELECTED
state. -
SM_QUESTION
received from server, carry the question for this round. Display the question to player, start a ring-in timer and wait for player to ring in. InDISPLAY_QUESTION
state. -
Once player rings in before the ring-in timer expires and
SM_RING_CLIENT
message is received, sendsCM_RING
message to server. InDISPLAY_QUESTION
state.- If the ring-in timer expires, change state from
DISPLAY_QUESTION
toWAIT_FOR_ANSWER
. Disable player to ring in.
- If the ring-in timer expires, change state from
-
SM_ANSWER
message received from server, further ring-in from player will not be accepted. Display the answer from player and the correct answer. InANSWER_SHOWN
state.
Message Definitions and Formats (ver. 1)
Server messages:
SM_NEW_GAME
s0: Message to indicate start of a new game.
Variable number of fields: #players, player names, #categories, category names, #questions in each category,
points per question, default timeout (in milliseconds).
Player ids are integers starting at 1, and are assigned in the order that they are listed in this message.
No player can be assigned the id 0 (reserved use).
Category ids are integers starting at 0, and are assigned in the order that they are listed in this message.
SM_NEW_ROUND
s1: Indicates start of a new round.
1 field: player id.
SM_CATEGORY
s2: Message carrying selected category.
1 field: category id.
SM_QUESTION
s3: Message carrying the question of current round.
1 field: question.
SM_RING_CLIENT
s4: Message carrying the id of the selected player to answer the question of this round.
1 field: player id.
SM_ANSWER
s5: Message carrying correct answer from server and the answer from player.
2 fields: correct answer and answer from player.
Client messages:
CM_SUBSCRIBE
c0: Subscription message with player info.
1 field: Player name.
CM_CATEGORY
c1: Selected category announcement message.
2 fields: category id and player id.
CM_RING
c2: Telling server a player rings in.
1 field: player id.
CM_ANSWER
c3: Answer typed by player.
1 field: player's answer.