Posts in Unity
Doing things the hard way

This year, we gave a talk at GDC called “Making Night in the Woods Better with Open Source”. In it, we talked about how Night in the Woods, which came out last month and you should totally go buy, used the open source process in its development.

Unlike most of our other talks, we did something a little ridiculous with this one - we built an entire presentation system, from scratch, into Night in the Woods. We’re actually pretty proud of this, and so we put together a video showing how it was done. Check it out!

The talk from GDC is also available online, and we've embedded it below:

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!

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.

What we're up to in 2015 (so far!)
Swift Development with Cocoa, new from Secret Lab.

Swift Development with Cocoa, new from Secret Lab.

Swift Development with Cocoa

The new year started off with the official launch of our latest book (co-authored with Tim Nugent): Swift Development with Cocoa.

It covers everything an existing programmer needs to know to build OS X and iOS apps with Apple's new programming language, Swift. You can buy it at O'Reilly, Amazon, as well as many other reputable book sellers.

Ultimate Swift Programming 

We also released, through O'Reilly and again working with Tim Nugent, a 12-hour video tutorial on Swift and Cocoa programming for OS X and iOS: Ultimate Swift Programming: Language, Frameworks, Tools. It's an excellent learning resource on its own, but it also serves as a great accompaniment for the book. It's available at O'Reilly.

Webcasts

Video production command centre, during webcasts.

On top of making pre-recorded videos (Hobart has been a hive of video production and post-production!), we also did two live webcasts for O'Reilly: one on Five Swift Essentials, and one on Building a game in under an hour with UnityThese were recorded and broadcast on Tuesday, 11 February 2015/Wednesday, 12 February 2015 (depending on your timezone), and by all accounts were a great success. Both webcasts were recorded, and the videos are available in their original format via the links above. We'll also post the code and notes right here when it's ready (in a day or two).

New Books

We're working on five more books at the moment (yes, we're possibly insane), and we'll be announcing them very soon. Stay tuned for news! 

New Games

There are three games we're currently working on: Button Squid, Rocket Box, and Gnome's Well That Ends Well. Our local newspaper featured us recently as well, talking to us about our games.

Button Squid, our squid-themed puzzle game is in development, and you can follow it on the Button Squid Tumblr and on Twitter @ButtonSquid. There's also a teaser site at buttonsquid.com

Rocket Box, a working title, is our economic space empire building game, and you can follow it on the Rocket Box Tumblr, and on Twitter @RocketBoxGame.

And finally, Gnome's Well That Ends Well, a puzzle game featuring gnome dismemberment, which you can follow on Twitter @GnomesWell, and the Secret Lab Tumblr.

Webcasts – Swift and Unity

These webcasts have both happened already! We'll be posting the content here within 24-48 hours! Thanks for watching!

We're doing two webcasts with O'Reilly Media in the coming week. They're both free and the content we cover is a lot of fun. They are:

Both webcasts are free, and you can register for them via the links above. We'd love to see you there!