Twine in 10 Minutes: Write Interactive Fiction Today
(This article originally appeared as a Luna Station Quarterly’s Chick on the Draw column, February 6, 2015)
Think IF might be fun, but don’t know where to start? Here’s how to get hooked in ten minutes.
1) Watch an introduction by Chris Klimas, the founder of Twine.
It’s about two minutes and will prime your brain. Anything that can be done in a web browser, you can do with Twine. ANYTHING. But we’ll begin at the beginning.
2) Take a look at your Twine 2.0 home page.
While Twine 1 was an app to download and install (for Windows or OSX), Twine 2 is a web app that runs right in your browser. Open it in a new tab.
If it’s your first time there, it’ll look like this:
Hit the big green “+Story” button and create a new story.
3) Take a look at the big blue Twine 2 workspace.
It should look about like this.
Buttons do what you might guess. Hover over any of them, and a tooltip will explain.
For extra credit, click on the story title and take a look at the options.
We won’t use any of these right now, but it’s good to know they’re there.
4) Edit the “Untitled Passage.”
The little soft blue square is our first passage. In Twine, a passage is a unit of the story–kind of like a page is a unit of a book. To edit a passage, you can either double-click it OR hover over it and select the pencil icon.
The passage editor looks like this:
There are instructions in the passage! They are true instructions. Write some text in your passage, and include a link to another passage. Links belong in double square brackets, so Twine knows they’re links.
For what it’s worth, you can the link after a word in your story:
Go to the [[cellar]]
Or name the link something else.
[[I went to the cellar.->Spooky Place]]
You can also rename the passage, though this isn’t required.
Here is our gripping tale so far:
5) Close the passage, and see that Twine made new passages automatically.
Neat! You can also add a new passage by clicking the green “+Passage” button. You can delete a passage by hovering over it and clicking the “Trash” icon (or by hitting the good old “Delete” key.)
For fun, I’m going to edit the “prince” and “heel” passages, too.
6) “Play” what you’ve got so far.
Hit the “Play” button. The story will build and open in a new tab.
Click on a link and see where it goes!
7) Set a variable.
Let’s make a “trust” variable and change it depending on the reader’s choice.
In the “prince” passage, add this line of code:
(set: $trust to 10)
In the “heel” passage, add this line of code:
(set: $trust to 0)
It doesn’t matter where the line of code is within the passage. It will be run when the passage is displayed.
(It’s maybe good practice to set the variable to some default starting value at the beginning, and then update it as you go, but let’s not worry about that right now.)
8) Use that variable.
That “trust” variable should have an impact on our story. Let’s add a passage that uses it.
Add this link to both the “prince” and “heel” passages:
To think I wouldn't have met him if it weren't for Lord Coddish's [[funeral]].
And add this to a new “funeral” passage:
Reynaldo sat next to me during the service and I was sure
(if: $trust > 0)[I'd never met a man so dignified](else:)[he'd make off with my handbag].
9) Hit “Play” again.
The story will rebuild in the same tab as before.
Now, if you choose “heel,” you arrive here:
You can also hit the “Bug” button to play the story in debug mode. This gives you more information if you run into trouble.
And that’s it! You’ve written a Twine story!
The official full documentation is here, and the forum is here. There are more story formats and controls and stylesheets and anything you could want to do. WELCOME TO THE RADDEST ADVENTURE.
If you’re interested in interactive fiction and writing games in general, you might enjoy the Sorting Hat built by the Quinnspiracy. BE CAREFUL. You might find yourself writing a visual novel, or a platformer, or a puzzle game, or some other wonderful thing.