WebFund 2013F: Assignment 4

From Soma-notes
Jump to navigation Jump to search

Solutions are now online as a zip file and an unpacked directory. Note these solutions do not contain an editor (question 7) or keys (question 8). However student solutions with some or all of these features are available.

In this assignment you will be extending adventure-ajax-demo covered in Tutorial 9 with a simple editor interface and a persistent MongoDB datastore. The assignment is worth 50 points with 20 bonus points and is due on December 9th. You should upload a complete node application (including modules) as a zip file. Please also include a sample room backup containing at least three rooms. Your modifications should be as follows:

  1. [5] Store the rooms data in a MongoDB collection entitled "2406rooms" and have the game use this collection rather than the in-memory rooms object.
  2. [4] Make the starting room "start" (rather than bridge). Optionally make it so that any room can be the start room.
  3. [5] Have the string "<?player>" be automatically replaced in a room's description by the player's name.
  4. [1] At the bottom of the player name screen (/, index.jade) add a heading "Administration" that has three bulleted links under it: Editor, Export Rooms, Import Rooms.
  5. [10] Have the Import Rooms link lead to "/import", a new screen that asks "Upload what rooms file?" and has a file input field. This field should be part of a form that allows the selected file to be uploaded to the server when the button "Upload" (a form submit button) is pressed. The server, upon receiving the file, should check to make sure the uploaded file is valid JSON with all the necessary fields (including the special "start" room). Then, if it is valid file, it should overwrite the current 2406rooms MongoDB table, replacing it with the contents of the uploaded file. The server should return a page stating whether the import was successful or not and should give a link to go back to /.
  6. [5] Have the Export Rooms link return a JSON object (in a text file) containing all of the rooms in the 2406rooms MongoDB collection. This file should be suitable for importing back into the game. Note the file may be displayed in the browser or you can force the browser to prompt to save it.
  7. [20] Have the Editor link lead to /editor the URL of your editor (just as /game is the URL for the game). In one or more screens implement a simple room editor of your own design. At a bare minimum your interface should allow for the following:
    • [4] Edit each room link name, title, and description.
    • [2] Add rooms
    • [4] Add and remove exits, giving feedback whether specified rooms exist. Either give clear warnings regarding invalid rooms or automatically create rooms as needed.
    • [4] Delete rooms, either giving clear warnings about exits that now refer to non-existent rooms or automatically deleting such exits.
    • [1] Have a quit button to return to /.
    • [5] Do all of the above with style.
  8. [BONUS 20] Add locks and keys to the game and editor, meaning that a player should be able to pick up a key in one room and use it to open a locked room (go through an exit that they couldn't before) in another room.