Skip to content

Instantly share code, notes, and snippets.

@lily-mara
Last active August 29, 2015 14:08
Show Gist options
  • Save lily-mara/95b52dfae30b1f987b5a to your computer and use it in GitHub Desktop.
Save lily-mara/95b52dfae30b1f987b5a to your computer and use it in GitHub Desktop.
Hunt The Wumpus Protocol

Wumpus Protocol

Overview

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.

Setup

  • 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 cave

        • CAVE_NAME ###: the name of this cave, where ### is replaced with the name
        • CAVE_ID #: id of the cave, where # is replaced with the cave's ID number
        • END_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 after ENTER_CAVE command, replace ### with the ip address and port of the Cave server relating to the ID sent by the ENTER_CAVE command

  • After client gets CAVE_SERVER ### from CaveSystem server, it connects to the Cave server specified by the IP and Port combination

Main Game

  • 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 server

    • CAVE_NAME ###: the name of this cave, with ### replaced with the cave name
    • CAVE_PLAYER_OCCUPANCY #: the number of players in this cave, with # being replaced with the occupancy
    • CAVE_WUMPUS_OCCUPANCY #: the number of wumpus in this cave, with # being replaced with the occupancy
    • MSG ###: 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment