Game Career Guide is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Get the latest Education e-news
 
  • Orkward Devlog: Getting Ink

    [06.24.21]
    - Joe Clark

  • Tags

    Ink allows me to add arbitrary 'tags' to any line. These are a bit like comments, in that the player won't see them. But they are seen by the runtime engine. Tags allow me to broadcast messages to the game's frontend from within the story. You can use this to change visual styles, synchronise art assets, play music or sound. I use tags to broadcast a return to the main menu screen (hiding the story and showing the gallery menu), trigger an ending or game over screen, and unlock trophies.

    Here's an example of unlocking a trophy by out-drinking Chompa:

    Ink source showing a trophy tag, captured from Inky

    The first line sets the trophy variable by incrementing a number. The second line is the tag, where 'trophy' is the tag name and 'bottoms_up' is the variable name (minus a prefix).

    When the frontend sees this tag, if the variable count is 1 (ie, the first time a trophy is triggered), we'll show a little pop-up to tell the player they're just unlocked a trophy. Neat!

    Weaves

    Finally, here's a neat trick using a thing called a weave. This is a bit tricky and maybe only makes sense when you've used Ink and got a feel for how it works.

    The Ink I've shown so far uses diverts at the end of each option to go to the next section - which is a good proxy for how Twine works.

    But that can mean you have very fragmented script, with little sense of structure and flow. Ideally you want the start of the story at the top of your script, and the bottom at the end, and the rest flowing in a broadly chronological order (as much as possible!). And you can do this with sticthes and diverts.

    Weaves are a neat trick which helps you reduce this fragmentation and have longer sequences of prose. It's denoted by a dash (yes,a  dash can mean a lot of things in Ink!) and it will 'gather' or 'catch' the story here unless otherwise diverted.

    Here's an example. This section of Orkward lets you pick a name for your knife:

    Syntax for a weave, shown in Inky

    It presents the player with three options ("Dis is Clara/Stabba/Julius") and, whenever one is picked, it sets an internal variable which we can use later.

    The weave is the dash after the choices, on line 251. It basically acts as a section break for Ink, telling it not to associate line 251 or anything after it with the previous section. It also tells Ink where to go next after any previous sections (unless they explicitly divert).

    That's a bit complicated, isn't it? Basically, after each choice, unless there's a divert, we jump to the next weave. So all three options above end up in the same place.

    This gets really useful when you have branches which all end up in the same place, because the start and the end are in the right place in the file so you get a natural structure. It's a bit hard to show this in a screenshot, but here's a very brief example (you might imagine that each choice has a lot more content before joining up at the weave at the end):

    An example of intented choices, gathered with a weave, from Inky

    This generally works better with shorter sections, but it's a really useful trick.

    Other stuff

    There's a lot more I haven't talked about. Stitches can be scoped a bit into knots (think sections and subsections) and accessed by paths (-> section1.subsectionb ).You can pass parameters to stitches and knots. You can even pass diverts through. You can define functions to compute values. I haven't really talked about variables but you can see them in this blog. You can nest choices and weaves, which quickly becomes useful when inlining text.

    It's a really rich language which has helped Inkle ship some very complex interactive storytelling experiences.

    A Few Stains

    Working with Ink has been pretty great, but I do have a couple of criticisms.

    Firstly, there's a lot of jargon involved. Ink documentation talks about knots and weaves and diverts and tunnels. Now, there's a pretty good reason for this because Ink introduces a lot of concepts which are pretty unique to it. But mostly I think it's a bit of a barrier to learning and makes the language look harder than it really is. You might argue that some characters get a bit over-used too - dashes, in particular, can mean very different things in subtly different contexts. You get used to all this and it's clear enough, but you do need to wrap your head around it. 

    In the end, it's a programming language and so it does take a bit of comprehension.

    Secondly, the tools available leave a little to be desired. Inkle's Inky editor is basically really really good. It runs the game alongside your script and instantly updates - which is just brilliant for editing while you play through.

    A screenshot of the Inky editor

    But it does have shortcomings. It's only really good for editing a single file - if you're working with several files, it quickly becomes hard work. I can't really use it for Orkward - I have too many files, and because the structure of the game is non-standard, I often need to see things rendered in-game.

    I get the sense that the community use Visual Studio Code for a lot of Inking. And I'm using it, too, because it's a great tool for JavaScript development and vital to the frontend. There are few plugins for syntax support and stuff, but they too have many shortcomings. It's great for large projects with multiple files, but I really miss the preview/live-reload modes.

    Ink has just recently received investment from Epic, so I'm really hoping to see a better range of tools (and maybe documentation) coming out over the next year to make it easier and better to work with.

    Ok I'm bored and want to get back to game dev please
    So to round up, Ink is:

    An elegant scripting language which reminds me very much of markdown
    A runtime which exports to Unity and JavaScript and is ideal for embedding into a bigger game.
    Mostly, I picked up ink for this project just for the sake of trying it out. I've wanted an excuse for years, so I'm pleased Orkward came along and gave me a chance to get stuck in. The runtime API means I can deeply integrate with whichever game engine I'm using, while the text-first approach to scripting the narrative means I can stay glued to the keyboard and iterate very quickly.

    I've really enjoyed my time with Ink and would absolutely use it again to drive any text-heavy storytelling in future games.

    In the next devlog, I'll be joined by a very special guest to talk about narrative design in Orkward. See you then!

Comments

comments powered by Disqus