Yarn Spinner Localisation

Earlier this year, we were approached by the rad folks at Infinite Fall with a very interesting challenge: could we please add support for localisation in Yarn Spinner, the dialogue system we wrote, for Night in the Woods?

Yarn Spinner was written to be a more advanced interpreter for the Yarn language, a Twine-inspired tool for writing interactive dialogue. Yarn Spinner lets you write your game's dialogue in a very natural way, with minimal technical syntax and a strong focus on getting your words into the game.

Because Yarn Spinner has such a strong focus on minimising the amount of stuff you have to write on top of your dialogue, we have to be careful whenever adding new features to the language. Our goal is always to reduce the amount of stuff you have to think about when writing. However, any kind of localisation system requires you to add additional information, in the form of a key that links a line's original text that of a translated version.

We created what we think is a pretty neat solution to this: hashtags. To localise a line of text, you add a hashtag that contains a short tag, like this:

However, Night in the Woods has a lot of dialogue. Like, buckets of it. Tagging each and every line would be hugely laborious. Fortunately, we already have a tool that's very good at quickly and thoroughly processing large amounts of Yarn dialogue: Yarn Spinner itself!

We therefore put together a little tool that can extremely quickly (like, 2 seconds quickly) tag every single line of dialogue that needs it. The tool only counts text that needs localisation - that is, anything that a player will see. It ignores all other stuff, like if statements and other behind the scenes stuff, as well as any line that already has a tag, which allows you to run the tool on files that have been partially tagged. In other words, it's a tool you can feed your dialogue through without worrying about anything it's doing.

Once you have some tagged dialogue, you can then generate a file that contains every line's text, as well as its localisation tag. The tool generates a CSV spreadsheet, which is the easiest format for most people to read.

Once you have the spreadsheet, you can send it off to your translators. In our case, we sent it off to a translation team in Italy, who converted the entire text of the Night in the Woods demo into Italian. They then sent back a spreadsheet that contained the Italian versions of all of the lines. We then dropped this into the Night in the Woods demo, and presto: localised!

The code for the localisation tool has already been merged into the development branch of Yarn Spinner, and we'll be putting out more info on how to use it soon. We can't wait to see more games in more languages using Yarn Spinner. Stay tuned for more!

GovHack 2016

For the fourth year in a row we went to GovHack, the world's biggest open-data hackathon, and made a game. We (Paris and Jon) teamed up with Rex, Seb, Matthew, Tim, Arabella, and Josh, and build Beat the Press, a game about news (sort of?) Check out the video, and the website for the project! It was a great way to spend 48 hours.

We're looking forward to coming back to GovHack next year! Thanks to all the organisers and volunteers in Hobart, as well as the other participants. Everyone made it such a great experience as usual!

In London, in October, we'll be giving a talk about our experiences turning open data into video games at OSCON; it's one of our favourite conferences, and we'd love to see you there!

Building Swift Applications

We're running 2-days of online live training, through O'Reilly Media, and covering the latest in Swift programming.

We'll give you an in-depth introduction to Swift, the new language for developing iOS and OS X apps and services. We’ll focus on the latest stable version of Swift, together with the latest Xcode and iOS. We’ll start by getting up to speed with the Swift language, becoming familiar with its fundamentals, and then explore the details of Swift and its standard library, including some of its more sophisticated features. Using Playgrounds, you’ll get hands-on experience writing Swift code throughout the course.

Attendees will get a copy of our latest book, Learning Swift. The course is July 20 and 21, 12:00 PM to 3:00 PM PDT, and you can learn more and sign-up on the O'Reilly Media site.

Conferences in May 2016

It's May and we're off to a whole lot of conferences, all in the USA:

If you're at any of these events, come say hello, email us, or tweet us @thesecretlab!

Melbourne iOS Developer Training

Learn to build apps with us! We'll be running our fantastic 2-day iOS developer training in Melbourne next month! Join us on the 2nd and 3rd of May, and learn all you need to know for iOS development. Only a few tickets left! Everyone gets an electronic copy of our new  book, Learning Swift. Email us if you have any questions.

Yarn Spinner

Complicated stories don't have to be complicated to build. We've already seen how Twine has made it easier than ever to create interactive fiction. Another tool, Yarn, has taken inspiration from Twine, and made it awesomely simple to craft interactive fiction.

This is where we come in. We also love telling stories, so we're absolutely delighted to introduce Yarn Spinner, an open source implementation of the Yarn language that's designed to make dialogue in your games a snap.

We built a tiny little demo game, which is set in space and available for you to play right now! It requires a keyboard to play it, and is compatible with most modern browsers.

What's Yarn?

Yarn is a very simple text based format, designed to let you write interactive, branching conversations with the greatest of ease. Here's a snippet:

    // Check to see if we've spoken to Sally already
    <<if $spoken_to_sally is 0>>
        // We haven't spoken to her - run the initial conversation
        Player: Hey, Sally.
        Sally: Oh! Hey.
        Sally: You kind of snuck up on me.
        Sally: Don't do that.
        
        // Remember that we've spoken to her
        <<set $spoken_to_sally to 1>>
    <<else>>
        // Run a different conversation
        Player: Hey.
        Sally: Hi.
    <<endif>>
    
    // Now present some options to let the player choose how they'll respond.
    [[Anything exciting happen on your watch?|Sally.Watch]]
    [[See you later.|Sally.Exit]]

Yarn's used in a number of cool games, including Night In The Woods and Knights and Bikes.

What's Yarn Spinner?

Yarn Spinner is a parser and runner for Yarn. It's written in C#, and is designed to be super simple to integrate into Unity games. You just drag and drop a few objects, drag in your Yarn file (which you've written using the excellent Yarn editor), and you've got dialogue running!

I'm already using Yarn's original parser. What does Yarn Spinner do differently?

Yarn Spinner adds a number of useful features:

  • Functions are now part of the language, and you can write your own in C#, where they'll be available to your scripts.
  • The expression parser is quite a bit more powerful, and can handle most things you throw at it.
  • Yarn Spinner is available as a separate .DLL file, which means that it's more separated from your Unity code.
  • Yarn Spinner adds more types of values to the language. Where you previously only had numbers, you now also get strings, booleans and null! Woo, programmer toys!

Is it Open Source?

Yes! The whole source code is available under the MIT license, which means that you can use it in commercial games if you want! The only requirement is attribution.

Where can I learn more?

Check out the Yarn Spinner page, here on our site, or the GitHub page to learn more.