CSci 115: Computing and the Internet
Home Syllabus Assignments Tests

Assignment 7: Room 587

Due at:9:40am, Thu 29 Nov
Point value:30 pts
Groupwork:You may work with one other student if you wish.

You may be familiar with Myst, a 1993 computer game. In it, the user navigated an imaginary three-dimensional world (though there were only still shots) and solved some minor puzzles. When it was released, the software proven to be a phenomenal success; today, it ranks as the sixth best-selling PC game of all time. (The top is The Sims, followed by The Sims 2, StarCraft, World of Warcraft, and Half-Life.)

In this assignment, we'll do something akin to Myst, but through a single PHP Web page. You should use session variables to remember the user's current location and direction.

Part 1: Navigating

The set of shots we'll use are of a single hotel room. There are 11 shots (plus 5 more that we'll see in Part 2), arranged according to the map at right. Each shot is a single JPEG file, named according to the location and direction. For example, the starting location is at the circle labeled 1, looking north (in the direction of the green 1); the file is named room-1-1.jpg.

I've already created a XHTML file from which you might start the assignment, room.php. You can see that this file presents a picture of the room, with a compass rose allowing the user to go forward, to turn left, or to turn right. If the user clicks left, then room.php should display room-1-4.jpg. (The above map shows that from location 1, the next shot available counterclockwise is direction 4.) In displaying room-1-4.jpg, the XHTML should include no link for forward, since there is no way to go forward facing that direction.

If, however, the user clicks right to get back to room-1-1.jpg and then clicks forward, then the program would then go to room-3-1.jpg. Clicking back from there should send the user back to room-1-1.jpg.

Note that when you get into location 2, the only way to get to another location is to click back while facing in direction 2. This also applies to location 4 (when facing direction 1).

Part 2: The window curtains

After you have the above working, you can then worry about allowing the user to open and close the curtains. This option is available only when the user is at room-3-3.jpg. At this location, the PHP should display open (or close) as one of the actions, next to the compass rose.

After opening the curtains, a number of the shots will change; these locations are indicated by asterisks in the above map. The corresponding filename when the curtains are open includes a b after the direction. Thus, if the user is viewing room-3-3.jpg and then opens the curtains, the user would then be viewing room-3-3b.jpg. When the user is at location 4 and facing north, either room-4-1.jpg or room-4-1b.jpg would be displayed, depending on whether the curtains are closed or open. (At this location, the lamp reflects the opened curtains.)

(The images used in this assignment are taken from the open-source software Pyzzle, an attempt at creating an engine for creating Myst clones. The images were created by Malefico, and they are released under the Lesser General Public License.)