Dark Forest Crow Notes - Interactive fiction, text-interactions based and roleplaying games

Monday, July 11, 2016

Overview of interactive fiction frameworks #2: Inform7

I continue my analysis of interactive fiction and text-based games development frameworks in this article. Why do I need it? I am not only writer and manager, but I am also software developer so I need to know frameworks and tools that are already present on the market and that are already used by other fellow developers - I need to know their features, paradigms and ideologies as well as their limitations to produce better decisions and estimations.

My conclusion for Twine was 'this tool is for you if you want to create something simple and fast'. Now I am trying to find something advanced.

So, here's a brief (as always) overview of Inform7. Again, it's not a tutorial although I have a list of references to good tutorials for Inform7 below. This post will contain mostly criticism and high-level analysis of Inform features. Every mention of 'Inform' below corresponds to Inform7; Inform6 is completely different tool.

Golduck thinks he is smarter than Psyduck. He uses Inform7.

As the Inform's site says,

"Inform is a design system for interactive fiction based on natural language. It is a radical reinvention of the way interactive fiction is designed, guided by contemporary work in semantics and by the practical experience of some of the world's best-known writers of IF.

Sounds pretentious. I think the amount of those who knows what is interactive fiction is so small that the term 'best-known writers' sounds really naive and funny.

Let's get started. I decided to just install Inform and launch it. Usually it's one of the best practices to understand if particular application has good design. I see this:

It looks like Moscow metro map:

Start a new project.

What I see is the list with tutorials and documentation on the right side of the screen. This can be useful. I try to launch my project immediately:

Tons of text in error message. It says I need a room so let's create a room. You can create a room in Inform by writing 'X is a room' so I type 'Nest is a room' and launch my application again:

The way this tool allows you to define things is not common: it pretends you can do it in English. Let's try to print something like 'Nest is a room. Nest is beautiful.' and launch it again:

Tons of text. Was it hard to just print 'redefinition error' or 'double definition error'? The design of these error messages and the Inform itself says this tool was created for those who knows nothing about programming. I seek for advanced tools, but maybe it's just a first impression...

Also I see we can't really use English. We can use something that looks like English in a way that developers of Inform defined for us. 

We have a place - now let's add a character: 

There is a Crow in the Nest.

As we can see, Inform has predefined sentences like 'You can see X here'. I didn't even asked to use it. Maybe we can redefine this sentence? I suppose I can overwrite output strings like this when player enters into particular room writing something like 'when X enters Y print Z'. 

Let's add some objects to our scene: 

Nest is a room.
There is a Crow in the Nest.
There is a Bottle of Pepsi in the Nest.
There is no Bottle of Pepsi in the Nest.

I added two contradictory statements.

Inform didn't understand it - well, it's not so important, but still.

I noticed that Inform not only has predefined sentences which describe things but also it has some predefined actions. I can take that Crow right now: I launch the game, enter 'take Crow' and my game answers: 'Crow taken'. Wow. Now 'drop the Crow': 'Dropped'. Funny.

I can change this behavior adding this lines of 'code':

After taking the Crow:
    say "Taken damn Crow, son"

Now if I enter 'take Crow' game will show my message. Let's specify that Crow is just a name of a man and launch the application again:

Crow is a man.

Mettlesome tool. 'I don't suppose the Crow would care for that.' So, my statement 'After taking the Crow:...' doesn't work anymore? That's right, Inform decided I can't take a character and refused to execute my line of code (which is actually simple if-else construction that you can find in any programming language). It's a bit strange. I searched for a solution and found this: you can use 'Instead of' construct:

Instead of taking the Crow: say "You can't take the Crow - it's a man."

Let's polish our code a bit and add an opportunity to talk with mister Crow and the description of our Nest:

Nest is a room. "Actually, it's not a room, it's a nest"

There is a Crow in the Nest.
There is a Bottle of Pepsi in the Nest.
Crow is a man.

After asking the Crow about "parrot":
    say "You talk about parrots. It's the best conversation in your life."

It works, as you can see. I want to add yet another location with additional character:

Tree is a room. "Actually, it's not a room. It's a tree."

Tree is north of Nest.
There is a Parrot in the Tree.
Parrot is a man.

Now if I sit in the Nest and type 'go north' game transports me to the tree so I can see mister Parrot there. I also can bring my Pepsi as a present to fellow Parrot. Predefined actions. Great.

Final version of Inform 'code' which produces two connected rooms with two characters and one item:

Nest is a room. "Actually, it's not a room, it's a nest"

There is a Crow in the Nest.
There is a Bottle of Pepsi in the Nest.
Crow is a man.

Instead of taking the Crow: say "You can't take the Crow - it's a man."

After asking the Crow about "parrot":
say "You talk about parrots. It's the best conversation in your life."

Tree is a room. "Actually, it's not a room. It's a tree."
Tree is north of Nest.
There is a Parrot in the Tree. "Angry Parrot".

Parrot is a man.

Actually, this pretty much describes everything what Inform is. If you have some development experience (enterprise, indie,...) you already see a lot of 'interesting' things.

Inform hides what is actually going on so I'll rewrite it via normal programming language like C++ using hypothetical Inform library for this language:

Room Nest(LOC(1, "Nest"), LOC(2, "Actually, it's not a room, it's a nest"))

Character Crow(LOC(3, "Crow"));
Crow.addAction(LOC(11, "take"), LOC(4, "You can't take the Crow - it's a man."), ActionTypes::SimplePrint);

Item BottleOfPepsi(LOC(5, "Bottle of Pepsi"));


Room Tree(LOC(6, "Tree"), LOC(7, "Actually, it's not a room. It's a tree."));
Nest.connect(LOC(12, "north"), &Tree);

Character Parrot(LOC(8, "Parrot"), LOC(9, "Angry Parrot"));
Parrot.addConv(LOC(10, "You talk about parrots. It's the best conversation in your life."));

ConversationGroup Conv;
Conv.add(Nest, CrowBottleOfPepsi, Tree, Parrot);

MovableGroup Movable;

Game(Conv, Movable).launch();

Pretty simple, right? Well, if you are familiar with at least one programming language. 

It's not only simple, it's also more flexible. When you see what is actually going on you can change the behaviour in the way you want. I mean, you have classes. You have objects. You can completely change the behaviour of classes. You can easily take the Character class as a base and override any method you want. You can add your subclasses easily. You can rewrite the entire object model of the game.

You cannot do it easily with Inform. There is no normal object oriented model in it - this programming language is actually rule-based with all the disadvantages. Inform supports inheritance and some other kinds of abstractions but in a very unnatural way.

Inform incorporates basic world model with default behavior. Characters, items, zones, basic actions. Almost everything has default description strings and default action strings. Sometimes you can rewrite default behaviour using constructions like 'Instead of', but most of the time you don't want to change anything in Inform because it's hard and usually your solutions aka adhocs aka crutches look really ugly. Changes in the world model of Inform are not recommended.

You also may notice strange LOC symbols near each strings in my example. That's right, guys, I indicated localization functionality: LOC(identifier of localization resource, default value).

Inform doesn't support localization.

Here is a brief summary:

- Inform targets people who knows nothing about software and game development. If you are not a software developer (and you are not planning to become a software developer in your future) you can use this tool and skip the text below.

- Inform is a bit more advanced if we compare it with Twine.

- Inform contains a lot of predefined features - these features can be useful if you are a beginner.

- The world model of your game is already defined for you in Inform as well - and changes in this model are not recommended (hard to implement, look ugly).

- The world is defined, the model is incorporated - so you can't actually create a game that is not an interactive fiction and text-based one using Inform. Learning Inform is a complete waste of time if there's a possibility of you switching your mind in this way: 'Hmm, I just finished my awesome text-based game and now I want to add images of characters, sounds and any kind of advanced gameplay'. Only text-based games. Dead end.

- Real things are hidden under the skin that 'looks like English'. In my opinion this is the worst possible design solution. Differences between the code and simple text are washed away. Reading of such kind of code is a complete torture - especially if you write something that is more advanced than bunch of one-liners. You need to understand where is real English and where is Inform7. I don't even want to discuss debugging here.

- Inform is a rule-based language with all the disadvantages. Actually it doesn't look like a programming language, it looks like a simple 'English-language-like' wrapper over programming language with some predefined features for writing specific kinds of interactive fiction games.

- Yeah, with Inform you can publish your game fast on your website (as well as with Twine).

I think you still can use this tool if you want to create something simple and fast and you already understand that Twine is unsuitable in your case. An opportunity to create and publish a game instantly can be useful for newcomers.

As I promised, here is the list of comprehensive tutorials for Inform7:

1.) Inform7 for programmers guide.

2.) Comparison of Inform7 and TADS3 (other tool for interactive fiction) A lot of useful information.

3.) Blog of a girl with Inform7 tutorials.

4.) Getting Started with Inform7 tutorial

5.) Inform7 documentation, also available via the application itself.

Do I underestimate Inform7? Any features of this tool you enjoy?

No comments:

Post a Comment