The Card: Sprint Review – Leia
Leia was a pretty off-beat sprint for me, and I didn’t think it would turn out nearly as well as it did. During the first half, I got so bogged-down with incorporating YarnSpinner and running into limitations with Unity’s serialization that it felt like it wasn’t making any progress at all.
As you’ll see below this was a really fantastic step forward once I got past a lot of those roadblocks, and it’s really starting to shape up into something substantive.
Sprint Leia: 02/10/2020 – 02/21/2020
Things to stop doing:
- Getting caught up in trying to reinvent the wheel
Things to keep doing:
- Making use of free assets
Things to start doing:
- Creating prototype assets for actual characters to use instead of the placeholders for proof of concept
For roughly the first quarter of the sprint, I got stuck trying to integrate YarnSpinner. I really love their team and I think their narrative engine is great, but it’s also incredibly new and their documentation is wildly out of date. That said, they were extremely helpful when I jumped into the community Slack with questions and their developers helped me get past all the issues I had setting it up.
I also wasted a lot of time running into Unity limitations. By default, Unity does not serialize dictionaries to the editor, which is difficult because it’s one of the most useful data structures for managing the narrative variables. I ended up implementing my own version with two lists and an editor script, but it still didn’t end up looking very good.
By the time I got into working on a generic sprite component I decided to check out the asset store to see if there was anything available. I had been recommended Odin but I think it’s a little overkill for the moment (aside from also costing $55). Within a couple minutes I found my way to Serialized Dictionary Lite which is exactly what I need at the moment and also completely free. Shoutout to Rotary Heart!
There’s a lot to unpack from this one gif. On the one hand, I’m really proud of how it looks with placeholder art. On the other hand, it also looks very similar to gifs I’ve posted in the past. So what’s changed?
Meet YarnSpinner — the narrative engine behind such titles as Night in the Woods. Under the hood, it’s a pretty solid script parser with a lot of built-in features for narrative games. You write .Yarn files which each contain one or more nodes, which the engine manages like a finite state machine. It has an API for saving variables (in the form of a bool, string, or int) and event hooks for things like the beginning of a line of dialogue or the end. You can also call Yarn Commands directly from a script and create your own. This is how I’m changing the facial expression on my sprites above.
A lot of YarnSpinner comes down to how you decide to implement certain features. I created a YarnStorage scriptable object to hold my Yarn variables persistently and will be using it to track state and save it between sessions. I also have hooks so that as YarnSpinner’s DialogueRunner passes new lines of parsed dialogue, my TextController slices the name of the speaker off from the line and places it in the little speaker UI and passes the rest of the line to the actual dialogue box.
With YarnSpinner set up, getting sprites to change has been a fairly simple process. Behind the scenes it’s using the same scriptable object architecture I mentioned in my last sprint review. The character sprite set is a little different from the more generic sprite set object because characters are keeping track of body and face, but both follow the same logic.
In either case, YarnSpinner sends out a command that’s picked up by either the Background object or a specific, named character. Both execute a command which basically sets the Image reference to the value at the key in a dictionary based on the command parameter.
While I’ve been getting all this set up, my artist has made the second pass at character concepts with a focus on nailing color schemes this time:
I’m pretty pleased with how far I’ve come this sprint, and I’m looking forward to finishing up enough to really get a vertical slice through the intro scene. We’re rapidly approaching the point where enough foundation will be laid that I’ll mostly be doing a lot of scriptwriting, and I can’t wait.