Friday, September 2, 2016

New Writing Platform: Ink


(Updated 11:50pm)
I must say, I was so excited to start penning with Ink, the scripting platform created by the folks over at Inkle (80 Days, Sorcery!).  The look of the language was super-lite, high level (from a programming standpoint), and full of affordances for writing stories.  I've been conducting some experiments in the language, and my early review is that this is a fantastic platform for introducing the core concepts of IF-writing, especially choice-based IF, though if you really want to go for the full experience, you're still probably better off with a more full authoring system like Inform or a merely using JavaScript (or some combo as we do with Undum and JS in the Mrs. Wobbles stories).

The Basics

Despite the liquid metaphor of its name, Ink uses a metaphor from the world of needlecraft: knots, threads, gathers (though sometimes they switch the metaphor, for example, tunnels).  The basic idea is that you write text that leads to choices (diverts), which can join together again in a gather.  The team have built this as a kind of general purpose text narrative choice system to be incorporated in lots other environs.

Ink even has its own editor (Inky), though it does not yet have a much-needed (please, folks, please) out-of-the-box author-ready Unity or JS implementation, which for now makes incorporation in a classroom challenging. That said, being able to edit and see the results as you type (reminiscent of the split screen of Inform 7) is enormously helpful when experimenting and helps with the debugging.  The editor has some nice features: autofill recommendations, for example -- though this did not always work.  But it's missing some features that I'd take as a given (search and replace).  That means you've got to scroll your way through the code.

Best news, Inky can export a web version that can easily be reformatted (a la Twine) with a bit of styling (yay!) for some independent publishing (without needing to post on Ink's host).

Documentation (full description at github).

As a choice-based system, the key syntax offers choices, merely by placing an *
     * Here is choice one.
But you can augment that by distinguishing display text from the choice text.
    * [Here is what you will see when choosing] Here is what you will see afterward.

But sometimes you need to fork, and for that they have knots (their name for lexias or chunks) and diverts (-> arrows that link to other knots).

Options not chosen will remain if you return, allowing for persistent conversation trees (think Monkey Island). Or you can make a choice "sticky" so that it will not disappear.

Gather: A point that draws the reading back into a single flow from a series of choices.

Glue -- Okay, now the metaphors are mixing too much. I'll let you find out what glue is.

Threads: Diverts that allow you to call two lexia at the same time.

Tunnels: These are diverts that send the text there and back, like subroutines.

The system can handle variables and very simple conditional statements -- (although these can get a bit tangly if you're trying to do something more sophisticated -- Mark Marino king of the yucky code work around).

The Good:

First, let me say, I really am enjoying using Ink for authoring. Together with Inky, it's just a lot of fun.  One reason is that it has some built in features that let you do some key CYOA/IF variation quite simply, elegantly event.  Ink is particularly strong at text variation and fairly good for gates and other conditions.  For example, I can alter a sentence easily with these inserts:

You've seen this { once | twice } already.

That structure gives me two versions of the same sentence, one the first time I see that lexia, the other the second (and none of them on the third.

The  {~cat | dog} jumped over the fence.

Will give me either a sentence about a cat or a dog.

Here we have some basic text substitution reminiscent of projects built on RiTa, Daniel Howe's Processing language tool kit.

Ink can also easily use simple conditions.

{thefirstscene: Here's the second part.}

This line will only give you "Here's the secondpart" if you've gone to "thefirstscene."
Or you can set conditional text based on variables by writing something like this:
{mystory > your attention: You start to get a bit board.}

 Such gates are key to basic Story-space like gates used in early Hypertext.  More importantly, they are the magic behind the subtle variations in Inkle Studios productions such as 80 Days and Sorcery.   Now that we've left the printed page, it's pleasurable to see variations of text that go beyond branching and into something more like changes of state.

However, you cannot use multiple conditions or an "or" condition in the basic text environment.  Which leads me to...

The Bad:

Ink is not yet (and may never be) a fully fledged programming language.  You can't insert images into the scripting language.  And, building a story out of flags triggered by leaps creates an awful lot of spaghetti code.   I've ended up writing some very strange jumps just to set flags.  Perhaps this will be developed in future iterations.

Also, currently Ink has no random number generator -- though it does have a shuffle function, which can serve that purpose {more or less}.

Also, though flags seem to work in most of the configurations, other times, you've got to kick the story out to another node just to work a bit of more complex logic, for example augmenting a variable and then running an evaluation.  In some instances, you can do this through Ink's functions (which are more or less lexia), but other times need to divert the flow entirely and cannot merely tunnel back where you were (specifically when wanting to call a tunnel as one of several text substitutions).

That said, I find the language rather joyous to write in because -- and here's the important part -- it keeps the focus on the text, the choices, and the variations, which is, of course, at the heart of choice-based IF writing.

Choose your Own Conclusion:

There are an increasing number of platforms out there for writing IF with a particular boom in choice-based IF.  While Ink does not give us much freedom as scripting in a programming language like JS, it gives you access to a code level that you don't get from the visual interfaces of Twine or Inklewriter.  Using Ink to write with children would be fun -- though you'd need a pre-built Unity framework to import it into. While there is a plugin for Unity integration and a {fairly complex} demo game, there is not yet a Unity file a newbie (to both Ink and Unity) could easily customize as in the case of using Undum, whose tutorial serves that purpose.

 I could see kids liking the editor interface of Inky though. In any event, I plan to continue experimenting with it and will report back as I encounter new developments.


  1. Hi. Nice review. I've also been using Ink and Inky recently, and have been really enjoying working with it.

    In reference to some of the Cons you mentioned:

    Inky missing features: I've been using Inky simultaneously with Sublime Text, using the Ink syntax package. Both programs automatically sync to files that have been modified externally, so you can safely go back and forth without losing work. I jump to Sublime when I need project-wide search / replace which is, as you mentioned, missing from Inky at the moment. I work in Inky for general composition and to test.

    Lack of Unity integration: I'm not sure what you mean by an "author-ready" Unity implementation, but it does come with a full functional Unity integration, and a complete demo game, which is a great base to build on. It also includes an editor extension for composing and testing your Ink script.

    When working in Unity it is possible to extend Ink by binding to C# functions, so you can, in theory, pull off any extra logical trickery you need (such as random number generation, or more complex text manipulation.)

    Unity developers sometimes use custom tags to embed additional meta data, and strip them from the text before rendering to the screen. These include things like sound effect triggers, embedded art, or things like Sorcery's magic system (which I spotted in a slide from a GDC talk by Jon Ingold).

    This is the technology used for the Sorcery series and 80 Days, which shows what can be done by enhancing Ink with extra game features.

  2. Thanks for the note, Lee.

    To clarify that last point: Yes, there is Ink-Unity integration and Intercept does serve as a demo that can be customized.

    However (and I've exchanged notes with Jon and the rest of the Ink team about this), there is not (yet) a simple Unity demo (for newbies to both -- like students and me) that uses Ink via the integration plugin. I'm thinking something more along the lines of the demo file (tutorial) that Ian Millington created for Undum.

  3. I see what you're getting at. The Unity integration does require some familiarity with Unity to make good use of. An interactive template for beginners sounds like a great idea. Are you thinking of making something like that yourself? I use Unity every day, so I'm very familiar with it. Feel free to get in touch with me if you would like some assistance. I really like Ink and would like to help make it more popular :)

    1. Yes, Lee! I am interested in creating a template for beginners and will get in touch. I've made some progress with some help but am hitting some roadblocks that are frustrating my efforts. Thank you for your offer! Email me at markcmarino gmail or let me know how to get in touch.