Welcome To Adventure: Lesson 1 (Setting Up Inform 7, Making and Connecting Rooms)

Introduction

This is the first in a series of quick-start Inform 7 tutorials using examples from Colossal Cave Adventure. More information about this tutorial series can be found here: A Quick-Start Guide to Inform 7.

Setting Up Inform 7

Inform 7 is available for Mac OS, Windows, and Linux from the official Inform 7 website. I am personally running the Windows version, so my screenshots will be for Windows.

Download, install, and run Inform 7.

Inform 7 start

Choose “new project” and fill out the title and author fields.

Adventure first screen

The IDE has two windows and a number of tabs for each window, including Source, Results, Index, Skein, Transcript, Story, Documentation, Extensions, and Settings.

Since this is a quick-start guide, we are going to ignore the vast majority of them, but the Documentation section contains all the in-depth Inform 7 information that this guide does not, and should be considered the primary resource for further investigation.

Making Rooms

Rooms are the most basic element of an Inform 7 game.

This is the first screen of Adventure.

Adventure game room highlight

The part enclosed in green is the room, divided into the room name (in bold) and the description (below it).

Here is the source code to replicate this room in Inform 7:

There is a room called At End Of Road. “You are standing at the end of a road before a small brick building. Around you is a forest. A small stream flows out of the building and down a gully.”

Enter this code and then click the “Go!” button. This will compile and produce a one-room game, as shown below.

Adventure first room

You can create as many rooms as you want this way, but you won’t have any way to get between rooms unless you connect them together. Rooms are connected either with doors or with compass directions.

Connecting Rooms with Directions

From At End Of Road, you can go north to In Forest, south to In A Valley, west to At Hill In Road or east to Inside Building.

With that first room (At End Of Road) already established in your source code, you can build more rooms off it by specifying the connecting direction, like this:

A room called In Forest is north of At End Of Road.
A room called In A Valley is south of At End Of Road.
A room called At Hill In Road is west of At End Of Road.
A room called Inside Building is east of At End Of Road.

Press Go! and try this out. Note that Inform will automatically set up the reverse direction as well – once you go west, you can then backtrack to the east.

Adventure directions

In the IDE, there is a link marked “Index.” Click on Index, then click on World. This will allow you to preview your work by looking at an automatically generated map of the rooms you have made and their connections.

Adventure world map

Connecting Multiple Directions

Sometimes, you will want to create more than one directional connection. This is the case in Adventure, where you can also get to In A Valley by going down, At Hill In Road by going up, and Inside Building by going inside.

Add the new directions to your existing ones, like so:

A room called In Forest is north of At End Of Road.
A room called In A Valley is south of At End Of Road. A room called In A Valley is down of At End Of Road.
A room called At Hill In Road is west of At End Of Road. A room called At Hill In Road is up of At End Of Road.
A room called Inside Building is east of At End Of Road. A room called Inside Building is inside of At End Of Road.

Non-compass directions such as up, down, in, and out will show up on the world map as indicative squiggles. Mousing over the squiggles will show you the connection details.

Adventure map squiggles

One-Way Connections

In Adventure, map connections are not entirely reliable. Going north to get somewhere does not mean you can go south to get back.

Adventure one-way directions

The source code to replicate this effect:

There is a room called In West Side Chamber.
A room called N/S And E/W Crossover is up from In West Side Chamber.
Down from N/S And E/W Crossover is nowhere.

Adventure one-way from source

Alternate Syntax

There is an alternate syntax for room creation and connection, as follows:

Your Living Room is a room.
Your Kitchen is east of Your Living Room.

Most Inform 7 examples will use this syntax instead of “there is a room called” and “a room called… is east”. However, this syntax can confuse the Inform 7 engine. For example, the line

In Forest is a room.

…will not compile, while the syntax

There is a room called In Forest.

…will compile.

In this lesson, as in future lessons, I have preferred to use more reliable syntax over less reliable syntax.

Further Reading

To expand your understanding of rooms and room connections, see the following parts of the Inform 7 manual:

§3.1. Descriptions
§3.2. Rooms and the map
§3.3. One-way connections
§3.4. Regions and the index map

Bookmark the permalink.

4 Comments

  1. I wouldn’t recommend using more than one “A room called” statement for each room. I think it would be better to change those, and you could introduce the concept of creating an object vs assigning properties then too.

    • Ideally, I wouldn’t recommend using the “a room called” syntax at all! Turned out to be a quirk of using the original Adventure room names. If they hadn’t broken the I7 compiler, I would have used the normal syntax.

      But given the choice between “use this syntax, except over here and here where it breaks, and then use a different syntax” or “this syntax will work everywhere, use it”, I opted for the faster version.

      By your reference to “creating an object vs assigning properties”, are you picturing setting up the rooms with printed name properties, or something else?

      • I was thinking of this line in particular: “A room called In A Valley is south of At End Of Road. A room called In A Valley is down of At End Of Road.”

        Someone could easily think that it is actually creating two rooms with the same name. Maybe this is more of a problem if you’ve been using I7 for a while.

        But seeing as you already have this, “Down from N/S And E/W Crossover is nowhere.”, why not say “Down from At End Of Road is In A Valley.”

        No good options really. Why is one down of and the other down from? A lot of the problems are coming from the prepositions in the names right?

        • At some point, I probably do need to address how to make more than one room with the same name. (Twisty little passages all alike!) I’m going to push it to later though.

          “Why is one down of and the other down from?”

          Because I didn’t even notice I’d done that. Whoops! Adjusting.

          “A lot of the problems are coming from the prepositions in the names right?”

          Yup.

Leave a Reply to Dannii Cancel reply

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