Upon starting Inform for the first time, you’re prompted to create your first project by entering a title and author for your story as well as a place to store it. The title and author is used to create the title line of your new story, which is one half of Inform’s absolute minimum for a story. Every story needs somewhere to take place and a player to experience it, Inform is happy to supply you with a default player but you need to define atleast one room. Thankfully, due to Inform’s natural language syntax this is as simple as writing a declaration that something is a room, such as stating that ‘Library is a room.’ Unless informed otherwise, Inform assumes that the first room created is the starting location for the story. While this will compile (try copying the text over to your story, and press F5 to run), it makes for perhaps the most boring story ever written. The only description present is the title of the room, and while Inform has a built-in understanding of quite a few verbs, they won’t do anything interesting.
Before we start making the world more interesting, it’s time to introduce some of the basic properties in Inform. We’ve actually already seen two of them in action despite only writing the single statement ‘Library is a room.’ This statement creates the object name which we use to refer to the object in the source code, and is also used as the default value of the ‘printed name’ property which is printed to the player. By default Inform allows the author to use abbreviated object names, but can be forced to only accept fully qualified names through the ‘Use unabbreviated object names’ phrase. Going one step further, the object’s name is also what the parser tries to match the player’s input to. This can be altered in two ways; either by using the ‘understand’ phrase to assign synonyms for the player or by declaring the object to be privately-named to prevent the player from refering to it by object name. This latter purpose is an advanced effect mostly for objects that have complicated names that would otherwise confuse Inform.
There are two other properties which are similar but different, and are very important: Description and initial appearance. Initial appearance is how the item is presented to the player during the story, and for a room this is actually the description. Similarly to declaring objects properties values are set by statements that simply state what they are, like ‘The initial appearance of Library is “Seemingly endless rows of bookshelves fill the room.”‘ Writing the initial appearance of a room is such a common occurence that Inform has a special syntax for it: Text enclosed in double-quotes just after the object declaration is interpreted as the initial appearance property.
Writing good descriptions for the locations in a story is not an easy task, even trying to define what is a good description is tricky as not every location has the same requirements. A lot can be written about descriptions, and Stephen Granade has written an excellent article on the subject. Long descriptions aren’t necessarily better than short, it’s usually better to focus on what you intend the story to tell the player and how to draw attention to the correct objects. It’s also important to keep a consistent level of detail, or atleast only deviate from the default level with a conscious decision. Another issue to consider is that while Library’s appearance implies the existence of bookshelves, the player can’t interact with them in any way because they aren’t defined in any way. Defining new things is once again as simple as stating where they are, anything that isn’t given a kind is implied to be a thing.
With this in mind we can create a slightly more interesting library (copy the text below into your story):
Library is a room. "Seemingly endless rows of bookshelves fill the room."
Some bookshelves are in Library.
Testing this short story will show that we can indeed interact with the bookshelves, but there are two problems: Firstly, the bookshelves are also listed both in the room’s appearance and indepentendly afterwards. Although we refered to the bookshelves in the appearance, we did so in a way that was only humanly readable, and Inform lists any unmentioned objects that are present in the room separately. In order to let Inform know that the object has been mentioned, we can use what’s called text substitution: By making Inform print the name of the object that object will be flagged as mentioned so there’s no need for a second mention. Text substitutions are made by writing the substitution inside square brackets inside the text string, and writing the object name will substitute in the printed name. I find it a good practice to write in these substitutions while writing the initial appearance of the room as a reminder to create the mentioned objects.
The second problem is less immediately apparant, as all things are by default portable, the player can pick up the bookshelves. This is easily remedied by setting the already mentioned ‘portable’ property and it’s opposite ‘fixed in place’, but there is another solution. For things that are intended to decorate a room, we have the aptly named ‘scenery’ which defaults to being fixed in place. More importantly though, a scenery is usually omitted from the listing of unmentioned things in a room and thus is an alternative solution to the duplicate mentions we discussed above. If we need a scenery to be in multiple places at once (such as the sky or the ground, or the vision of something far away) we can use backdrop instead of scenery.
For all of what we’ve written so far we still only have the one room, albeit with some scenery. Unsurprisingly we can add new rooms in relation to existing rooms by stating where they are in relation, and because only rooms can be related to each other by directions we don’t even have to state that they are room. By default Inform is aware of the eight cardinal directions, as well as up/down and inside/outside. Inform also assumes that directions are two-way, and automatically creates the reverse for you unless told otherwise. It’s possible to create twisting, secret or one-way passages as well, but this is an advanced topic we’re leaving for another time.
Settling on the correct amount of locations for a story is a hard challenge. When mapping out a ‘known’ location such as a house, there are certain locations the player would expect to find but that serve no real purpose. Another challenge is ‘connetion’ rooms whose main purpose is to link together the more interesting locations. By clever use of room descriptions and the ‘before’ and ‘instead’ rulebooks it’s possible to give the player the impression of a larger world than what is implemented.
Include Erotic Storytelling by Fictitious Frode.
The player is wearing an outfit called your clothes.
Living Room is a room.
"At the heart of your house is your living room, with it's large
flatscreen TV and soft couch. Refreshments can be had in the
kitchen to the north, and a small hallway leads east towards the
bedroom. A small bathroom lies to the west, and the front door
is to the south."
Before going east in Living Room, say "You pass through the
hallway and enter your bedroom."
Instead of going west in Living Room, say "You don't have a
pressing need to go visit the bathroom."
The front door is a closed door. It is south of Living Room.
Instead of opening front door, say "You'd rather stay home tonight."
Kitchen is north of Living Room.
"Your kitchen is small but functional, containing cupboards, an
oven and a stocked fridge. As you consume most of your meals in the
living room to the south, you've never seen the need for a kitchen
Bedroom is east of Living Room. The decency threshold is indecent.
"This is where you sleep, and the mess in the room makes it hard to
do anything else in here."
Before going west in Bedroom, say "You pass through the hall on your
way back to the living room."
This example illustrates another small complication introduced by this extension, as it contains the notion of decency. In order to stop the player from running around in an inappropriate state of dress, each room has a decency threshold which defaults to ‘casual’ but the naked player is ‘indecent’. This can make testing the game a small annoyance at first, but one that can be easily remedied by giving the player an outfit to wear.