[Twine](https://twinery.org/) is an open-source tool for telling interactive, nonlinear stories. Compiles to HTML and other [[FanFiction Export]] technologies. There is also a formal export format for Twine source code called [Twee](https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md) which is a mixture of JSON and some unique syntax for defining "passages" (AKA rooms) and tags. # Notability It is mentioned in a friendly way from the [[Inform]] home page and I keep seeing it pop up. I think since it can be browser-based and exported as HTML it is very low barrier to entry which makes it very useful. I might argue that Twine would be a better website user communication tool than all the crappy paid marketing ones like Telecom that are all half-baked. - :) Uses wiki-link style markup for navigation, similar to Obsidian. # Example ```harlowe [[Go to the cellar->Cellar]] is a link that goes to a passage named "Cellar". [[Parachuting<-Jump]] is a link that goes to a passage named "Parachuting". [[Down the hatch]] is a link that goes to a passage named "Down the hatch". ``` # Use Cases Below sections taken from the Twine reference: ## What Is Twine Good At? - Text-based storytelling. Twine is very text-focused, though you can use images, sound, and video. - Branching narratives. Twine's user interface is designed to make it easy to visualize the flow through branches of a narrative. - Web-based publishing. Twine publishes to HTML files which can be uploaded on any web hosting service or shared privately. People can play the things you make without installing any extra software. ## What Is Twine Bad At? This is especially difficult to define, because authors are so ingenious and constantly push at the boundaries of what is possible. Because Twine is deeply enmeshed with the web platform, anything that can be done in a browser can be done with Twine--but you might be better-served using a different tool. - ! Heavy use of multimedia. It's possible to incorporate images, sound, and video into the things you create with Twine, but the workflow can feel awkward, especially if you are using lots of multimedia assets. You might be happier using a tool like Ren'Py. - ! Online and multiplayer play. There have been experiments with making Twine games that are playable by multiple people simultaneously, but doing so requires a good deal of programming knowledge. There have not been many modern successors to the MUD model, but [[tworld#^be2720|Seltani]] is one. - ! Works that involve a world model, or that use interaction models other than clicking links, like a text parser or a graphical world. [[Inform]] or [[Bitsy]], for example, might be better fits for these. # Story Formats It's almost 7am and I've been up all night, but the below information taken from the [reference](https://twinery.org/reference/en/getting-started/basic-concepts.html#story-formats) doesn't make a lot of sense to me: > Twine is a tool for editing interactive narratives. It isn't a tool for playing interactive narratives. When you share a story with players, it exists as an HTML file that can be opened in any web browser, and doesn't require players to install Twine themselves. Twine helps to edit a story, but what happens once players actually open it in a web browser is the job of story formats. > > Story formats handle displaying your story onscreen: displaying text and images, playing sound and video. They provide additional ways for players to interact with your story, like buttons or drop-down menus. And they offer the ability to add conditional logic, variables, and other kinds of programming to your story. > > Story formats are like game engines or small programming languages. There is no one best story format to use, just as there is no one best pencil or paintbrush. Like any creative tool, each is suited for some kinds of things and a poor fit for others. ## Chapbook [Chapbook](https://klembot.github.io/chapbook/guide/) is supposed to be a new and simplified markup language for Twine. - [Documentation](https://klembot.github.io/chapbook/guide/) ### Formatting | Typed | Displayed | | ------------------------- | ----------------------- | | `_Unconventional_ tastes` | _Unconventional_ tastes | | `*Unconventional* tastes` | _Unconventional_ tastes | | `__Unconventional__ tastes` | **Unconventional** tastes | | `**Unconventional** tastes` | **Unconventional** tastes | | `**"I'll _murder_ you,"** she hissed.` | **"I'll _murder_ you,"** she hissed. | | `` `Beep boop,` HAL commented. `` | `Beep boop,` HAL commented. | | Typed | Displayed | | ------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | `Above the door was a ~~NO TRESPASSING~~ sign.` | Above the door was a NO TRESPASSING sign. | | `At the bottom of the page, nearly completely covered by the government censor's pen, was that same code name you had seen before: <del>S-5900</del>.` | At the bottom of the page, nearly completely covered by the government censor's pen, was that same code name you had seen before: ~~S-5900~~. | > To add a section break to your text, type `***` (three asterisks) on a line by itself. > To created a bulleted list (or, in the parlance of the web, an unordered list), type `*`, `-`, or `+` at the beginning of a new line. It doesn't matter which character you use, but you do need to be consistent in each list. > To create a numbered list (also known as an ordered list), start each line either with a number and a period, or just a `#`. The numbering you use doesn't actually matter--you can have two items starting with `2.` and the list will still be numbered correctly. ### Links | Typed | Displayed | | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | | `You [[open the door->A Grisly End]] with great confidence.` | You open the door with great confidence. | | `The [[Miss Scarlet<-young lady]] seated in the chaise seems inexplicably guilty to you.` | The young lady seated in the chaise seems inexplicably guilty to you. | | `You [[open Twine->https://twinery.org]] on your computer.` | You [open Twine](https://twinery.org) on your computer. | | `You [[open the door\|A Grisly End]] with great confidence.` | You open the door with great confidence. | (the backslash in `\|` is an Obsidian artifact, without it, the table breaks) There are also these "insert links": ``` {back link, label: 'retreat for now'} {restart link, label: 'Oh forget it all'} {link to: 'https://mozilla.org/firefox', label: 'Firefox'} {reveal link: 'something odd occurred', text: 'I saw five deer staring at me from one side of the road, all in a line'}. ``` With the general format: `{ insert name : value , parameter name : value , parameter name : value }` ### Forks Forks are conversation choices. This is largely a formatting choice from lists. ``` > [[Walk along the beach]] > [[Climb the rocky hall]] ``` ### Text Modifiers ``` Above the cave mouth, someone has carved: [align center] _Lasciate ogne speranza, voi ch'intrate_ [continue] You feel a little less confident in your plan. ``` > The text `[align center]` is never shown to the player. Instead, Chapbook centers the text following it. As you might have guessed, you can also write `[align right]` and `[align left]`. > `[continue]` simply cancels all active modifiers. You can abbreviate it as `[cont'd]` or `[cont]`. ### Delay ``` [after 300 milliseconds] [after 300ms] [after 1 minute] ``` ### Merging and Embedding To merge a divergent thread, you simply link it to another section. But you can also embed a passage and continue in the current thread. ``` {embed passage: 'L.A.'} ``` > Remember that like any insert, `{embed passage}` can be placed at any point in the text of a passage. It can be sandwiched between text in a passage, or even repeatedly used. ### Variables Kinda similar to frontmatter, but weirdly with only two dashes instead of three, and none leading. ``` strength: 18 dexterity: 7 constitution: 14 intelligence: 9 wisdom: 8 charisma: 11 -- ``` > If a passage is embedded in another using the `{embed passage}` modifier, its vars section will also take effect. ``` name: 'Chris' -- "Hi, {name}," your guide greets you. ``` ### Conditionals The word `continue` is used instead of the traditional `end` and I don't hate it. Whereas `end` implies a more foreboding termination of the current thread of execution, `continue` implies a return to the usual way of things. ``` [if hasKey] You could try [[unlocking it]] with the key you found. [else] Nothing to do here but [[turn back]]. [continue] ``` ``` [if stringVariable === 'red'] [if dollarsInPocket > 5] [if 2 + 2 === 4] ``` ### Randomness Simulated dice rolls. ``` random.d4 ``` ## Harlowe [Harlowe](https://twine2.neocities.org/) is the default story format for Twine, and is included in both the download distribution and online editor. ### Formatting ```harlowe You //can't// be serious! I have to go through the ''whole game'' again? ^^ ``` - `//italics//` - `''bold''` - `~~strikethrough~~` - `*emphasis*` - `**strong emphasis**` - `^^superscript^^` > Emphasis and strong emphasis appear identical to italics and boldface by default (though they can be changed using CSS) and are offered for those with familiarity with the Markdown language. Italics and boldface are offered for those with familiarity with SugarCube, Twine 1, or TiddlyWiki. > > The alternative Markdown emphasis syntax `_text_` and `__text__` is not available. Harlowe reserves the use of the `_` character for temp variables. ### Features #### Variables They store data persistently. #### Macros Mostly just functions that can be embedded into text. Delimited with parenthesis. ``` (set: $battlecry to "Save a " + $favouritefood + " for me!") ``` The documentation is not fun so I will only list a few: - `set` - sets the value of a variable, optionally typed - `move` - same as set, but deletes the original instead of copying, and the syntax is flipped - `print` - output variable or expression as text - `display` - output contents of a named passage - `either` - randomly select a value from a list - `enchant` - change all subsequent appearances of a passage with a javascript function - #### Hooks Hooks are basically code blocks. Delimited with square brackets. ```harlowe (font: "Courier New")[This is a hook. As you can see, this has a macro call in front of it.] This text is outside the hook. ``` - Named Hooks - code blocks assigned to a name, allows them to be manipulated after the fact ```harlowe [This hook is named 'opener']<opener| |s2>[This hook is named 's2'] [Fie and fuggaboo!]<shout| (click: ?shout)[ (replace: ?shout)["Blast and damnation!"] ] ``` ## Paperthin While Paperthin is the default "proofing" format, whatever that means, and is also built in. Three other story formats are available but unused in the web version: [Snowman](https://videlais.github.io/snowman/) (the original, demi-deprecated format), [SugarCube](http://www.motoslave.net/sugarcube/), and [Chapbook](https://klembot.github.io/chapbook/) (the original creator's current pet project). There are a great many more story formats out there. They seem to bundle themes with additional features as best I can tell right now. Proofing formats seem to also include [graph views](https://github.com/mcdemarco/dotgraph). ## Sugarcube - [Documentation](http://www.motoslave.net/sugarcube/2/docs/) > [SugarCube](http://www.motoslave.net/sugarcube/) is an alternate JavaScript library for Twine that handles media, media playback functions, advanced linking for passages, UI elements, save files, and much more. It can turn your basic text adventure into a multimedia extravaganza rivaling such adventure games as Myst or Beneath the Steel Sky. ### Formatting | Type | Syntax & Example | Displays As (_roughly_) | | ------------- | ----------------------- | ----------------------- | | Emphasis | ```//Emphasis//``` | _Emphasis_ | | Strong | ```''Strong''``` | **Strong** | | Underline | ```__Underline__``` | <u>Underline</u> | | Strikethrough | ```==Strikethrough==``` | ~~Strikethrough~~ | | Superscript | ```Super^^script^^``` | Super<sup>script</sup> | | Subscript | ```Sub~~script~~``` | Sub<sub>script</sub> | ### Markup ``` * unordered * list # ordered # list > blockquote >> nested blockquote {{{code}}} ---- (horizontal rule) ``` ### Naked Variables ``` $name $thing.name $thing[0] $thing["name"] $thing['name'] $thing[$member] ``` ``` /* Explicitly printing the value of $name via the <<print>> macro */ Well hello there, <<print $name>>. /* Implicitly printing the value of $name via the naked variable markup */ Well hello there, $name. /* Assuming $name is set to "Mr. Freeman", both should yield the following */ Well hello there, Mr. Freeman. ``` ### Links Links are flipped around from the Obsidian standard and also include a "setter" section which is not explained in the docs. ``` [[Grocery]] [[$go]] [[Go buy milk|Grocery]] [[$show|$go]] [[Grocery][$bought to "milk"]] [[$go][$bought to "milk"]] [[Go buy milk|Grocery][$bought to "milk"]] [[$show|$go][$bought to "milk"]] ``` # See Also ```cardlink url: http://mcdemarco.net/tools/hyperfic/twine/catalog/ title: "A Catalog of Twine Story Formats – m. c. de marco" description: "A Catalog of Twine Story Formats" host: mcdemarco.net ``` List of articles about hyperlinking concepts: ```cardlink url: https://klembot.github.io/chapbook/guide/text-and-links/ways-to-link.html title: "Ways to Link" host: klembot.github.io favicon: ../favicon.svg ``` Other interactive fiction languages: [[Inform]], [[Ink (programming language)|Ink (programming language)]], [[Bitsy]]