6.170 Software Studio | Spring 2012
Assignment 5: Adventure Game
Due: 1pm, Monday April 16, 2012
Purpose
The purpose of this assignment is to give you:
- Experience designing the conceptual model of system using object modeling;
- Experience designing a relational schema, by transforming an object model;
- Experience formulating database queries in SQL, and extracting results;
- Some more practice dealing with request and response data, and Ajax calls;
- A chance to exercise your innate creative and computer game designer skills.
Background
One of the early genres of computer games was text-based Adventure Games such as Colossal Cave Adventure (1976) and Zork (1979). The user interacts with the game through a text-based terminal interface, moving through a maze of rooms and interacting with items in the game through simple verb/noun commands such as "go north", "take key", or "unlock door". Here is a modern web-based example from The Things That Go Bump In The Night:
You are in the small security office at the local smelting/refining plant. The office has windows that overlook the entrance and main road into the plant. Three sets of security monitors afford you camera views from different areas within and without the complex. The door to your office is open to the east.
You can see Three Security Monitors, A Hand Radio, Some Cabinets and A Telephone here.
You can go east.
> look monitors
You scan all the monitors closely and find no activity on any of them. After a little bit they start to switch madly between cameras. Back and forth flashing rapidly. (What the duece!) You thought you saw some kind of strange shape in one of them. (Nah.. must be some kind of a power glitch or something.)
After a minute or two the monitors suddenly go completely blank and the power suddenly goes out! Emergency lighting kicks in but the cameras remain blank.
> take radio
You pick it up.
> go east
You are in the foyer of the security building. Your office lies to the west. To the east is a hallway leading to some private offices. There is also a short hallway to the north. The main door to the outside parking area is here to the south.
You can go north, south, east or west.
Many more examples of text adventure games can be seen and played here.
Your task
Your task is to design and implement a simple web-based text adventure game.
The design of your program and the user interaction is up to you. At the very least, your game should let the user:
- Interact with the game through simple text-based commands entered in a browser;
- Move between locations, restricted by a predetermined map;
- Pick up items in a location, and see a current inventory of items available in that location;
- Use items to make progress, for example, by entering a room that is accessible only if a given item is held;
- Win the game by reaching some predefined objective (e.g., by finding the holy grail in the final locked chamber, or escaping from the haunted caves without being eaten by a grue).
- Play when other users are playing too, but not necessarily interact with them (or even see them).
The details of your implementation are also left up to you, but must meet some basic requirements:
- The browser should communicate with the server using asynchronous calls, so that there are no page reloads when a command is entered.
- The game configuration (eg, the map of rooms, initial placement of items) should not be hardcoded, but should be loaded from a configuration file.
- The game configuration and the current state should be stored using SQLite on the server side.
- You should use Flask (and possibly Jinja) for the back-end, and HTML/CSS/JavaScript/JQuery on the front-end.
- Your game should run on the csail deployment server, as the graders will use when they try to run your game themselves. It should also work if moved to a different directory, as the staff may need to copy the contents of the folder onto their local machine and run it there. See also the requirement to supply a script to set up the database in the What to Hand In section below.
Deliverables
Your solution to this assignment should include the standard components, as listed in the
project checklist (and whose purpose is explained
here).
In addition:
- In your object model describing the state of the game, you should indicate which parts you expect to be stored on the server and which on the client.
- You should provide a sample transcript showing the text displayed for a complete game played from start to finish (as in the example above).
- Your code should include a file called setupdb.py that initializes the database to the point where the game can be played.
Handin
Follow the assignment guidelines for handing in your code. To deploy a live version of your site that will be used for grading, we recommend that you read our deployment tutorial.
Hints
- Keep it simple! The object model will be a big help in focusing your game's design. Start with the most rudimentary object model, and, initially at least, omit any feature that is not essential. Considering where the object model state will reside can save you a lot of implementation effort. Similarly, choose the simplest possible syntax for your command language.
- Resist the temptation to make a fancy JQuery interface. It's more fun and easier to simulate a console. Instead of having a button to display inventory, for example, provide a textual command. You are welcome to use a third party console component.
- When constructing your object models, remember that they are about problem domain notions, and should not include references to implementation notions (such as collections, database tables, software components, etc).
- Get everything working before spending time on your game narrative! One advantage of not hard-coding the configuration is that you can postpone this aspect until the end.
Clarifications
None yet.