Interactive Fiction_1 – Rooms

PLAY EXAMPLE

** Type out as much of the story as possible (don’t copy paste).  It will help you understand the mechanics of this language. **

ROOMS
The room creates geographic locations (indoors or outdoors) that are part of a map.
Rooms can be connected by 12 possible directions: north, south, east, west, northwest, northeast, southwest, southeast, in (inside of), out (outside of), up (up from), or down (down from).
 
The first room is created like this:
 
The foyer  is a room.
 
PATHWAYS (the 8 cardinal compass directions)
We create (and connect) additional rooms by stating the new room’s directional relationship to a previously declared room. Here are several examples:
 
The kitchen is west of the foyer.
or
The kitchen is a room. It is west of the foyer.
or
A room called the kitchen is west of the foyer.
or
West of the foyer is the kitchen.
 
This creates what we call a pathway that Inform will understand as a two-way connection. In this example, going west will take us from the Foyer room to the Kitchen room and going east from the Kitchen room will take us back to the Foyer room.
 
PATHWAYS (up and down & out and in)
We can also move up, down, out, or in. The wording for these directions is worded slightly different:
 
The attic is up from the foyer.
The basement is down from the foyer.
The closet is inside from the foyer.
The front porch is outside from the foyer.

 

MULTIPLE PATHWAYS
Any room can potentially have multiple entrances/exits and there are many ways to accomplish this. The most condensed way is to identify the room with the most connecting pathways (such as the Hallway) and do something like this:

The hallway is south of the bathroom, west of the guest bedroom, east of the master bedroom, and north of the landing.
 
Here we have created a new room called the Hallway which has four different pathways. Just indicate the various directions separated by commas and/or the word ‘and’.
 
DESCRIBING THE ROOMS
Room descriptions can be created by placing the description between double quotations
immediately following the room declaration.  Or using: The description of the … is “….”.
 
The foyer is a room. The description of the foyer is “The foyer is a boring space containing no furnishings. You can see exits east, south, and stairs that lead up.”.
or
The kitchen is west of the Foyer. The description of the kitchen is “The kitchen is a modern design and is remarkably clean. There is an exit west.”.
 
Room descriptions are (by default) displayed whenever they enter a room or whenever the player types ‘look’ or ‘L’.
 
**Lastly, remember to always mention the possible exits in your room descriptions as a courtesy to the player.**
 
COMPLICATING THE MAP
This section deals with more sophisticated (and complex) methods of creating your story world. These are purely optional but you may find them helpful in generating ideas for more interesting maps.
 
Dark Rooms
Room objects have, by default, a property of lit. This means that rooms always have light and we will be able to see the room description and any other objects located within the room.
Should you wish to create a room that is in total darkness do this:
 
The foyer is a dark room. The description of the foyer is “The foyer is a boring space containing no furnishings. You can see exits east, south, and stairs that lead up.”.
or
The foyer is a room. The foyer is dark. The description of the foyer is “The foyer is a boring space containing no furnishings. You can see exits east, south, and stairs that lead up.”.
 
Here is how this room will look no matter what the room description says:
Darkness
It is pitch dark, and you can’t see a thing.
.
ONE-WAY EXITS
Sometimes we may want to create a pathway that cannot be retraced (a one-way connection.)
We can accomplish this by the following:
 
The foyer is a room. “The foyer is a boring space containing no furnishings. You can see an exit to the east.”
 
The kitchen is east of the foyer. West of the kitchen is nowhere. The description of the kitchen is “The kitchen is of a modern design and is remarkably clean.  All that remains of the exit to the foyer is a distant memory.”.
 
Now, when the player goes west from the Foyer into the Kitchen, they will not be able to go back east to the Foyer as they normally would.
 
Here is how this would look in play:
Foyer
The Foyer is an austere space containing no furnishings. You
can see exits east, south, and stairs that lead up.
>west
Kitchen
The kitchen is of a modern design and is remarkably clean.
>east
You can’t go that way.
 
This is a situation where the player enters a room and the door slams shut behind them or they go down stairs which collapse preventing them from going back the way they came. Now the player will have to find (and the author must create) another way out.
 
“MAGIC” EXITS
Pathways can be configured to override the default two-way connections.
In the following example, you can enter the Closet but, when you return the way you came in, you will find yourself in another room.
 
The foyer is a room. “This is a boring place barren of any furniture. There is an exit to the north and to the west is a magic closet.”
 
The kitchen is north of the foyer. The description of the kitchen is “Red walls, marble counter tops and a silver stove, this kitchen reminds you of The Jetsons.”.
 
The tele-closet is west of the foyer. East of the tele-closet is the secret room. “Nothing here but a bare light bulb and one wire coat hanger.”
The secret room is a room. The description of the secret room is “This room looks like it came right out of a JC Penney catalog.”. 
Here is how it might look in play:
foyer
This is a boring place barren of any furniture. There is an exit to the north and to the west is a closet.
>west
 
tele-closet
Nothing here but a bare light bulb and one wire coat hanger.
>east
 
secret room
This room looks like it came right out of a JC Penney catalog.

*** IMPORTANT NOTE ***
The first line of code in the story is made by inform and has the title and the author.  The second line of code is a BLANK line.  Inform 7 does NOT read the second line.  So start your code on the third line.

____________________________________________________________________________________________________

 ASSIGNMENT

After working through the above examples…

Use Inform 7 or www.playfic.com and create:

three rooms connected by a hallway.
One of the rooms is to be dark.
One of the rooms is to have a one way exit or magic exit

Copy and past your working code into notepad and hand in your code.

____________________________________________________________________________________________________

 

This resources is from –  pages 1-7 of the pdf – http://www.hpiweb.com/newmedia/handouts/Creating%20Your%20World.pdf

There are several good resources on this site.  In particular there are some really useful snippets of code.  Seems to be a dead link now, and I don’t know where it went.

Leave A Reply

Your email address will not be published. Required fields are marked *