Yarnspin v2.0 Dev Update


It has been a while, but recently I picked up working on Yarnspin again, making some additions and improvements. I find it very easy to work with, very enjoyable both adding features to it and making games/stories with it, so doing this is fun, and I can see myself continuing it for a good while. In this post, I’ll tell you a bit about what I’ve added, and also what I plan to add in the near future, all building up to a new Yarnspin 2.0 release sometime in the next few months.

More pixels

So far, Yarnspin has had a fixed resolution of 320x240, with a customizable palette of up to 256 colors. This came from the intention to make something with a distinct retro feel. One of the new features is support for higher resolutions. I chose to stick with a selection of fixed resolutions, rather than being able to pick an arbitrary one, just for the simplicity of it.

There is now a new ”resolution:” keyword, which recognize the parameters: ”retro”, ”low”, ”medium”, ”high”, ”full” They result in the following resolutions:

  • retro  320x240
  • low  400x300
  • medium  480x360
  • high  640x480
  • full  1440x1080 

I feel that this is a practical set of resolutions, with more fine grained control in the lower resolutions, for recreating a retro feel, and with the highest resolution being full hd (cropped to the 4:3 aspect ratio)

Because of the new resolutions, I also had to change the ways fonts are used. Rather than always assuming every font is a pixel font and auto-detecting its size, it is now possible to specify a point-size manually, to get a font that is the right size.

More colors

Another thing is support for full RGB mode in addition to the 256 color palette mode. In fact, there are two RGB modes - a normal 24-bit (8 bits per components) mode, but also a 9-bit mode (3 bits per component). The latter one supports dithering just like the palette mode.

The RGB9 mode is useful to get a retro-style look with dithering and banding, without locking yourself to a palette. I find that he extra bit, taking it from the 256 colors of the palette mode to 512 colors can make a big difference. Just a particular sweet spot I guess.


Image editor

Adding support for more resolutions and color modes also meant updating the built in image processing tool to support the new features, and that was actually more work than adding them to the game - but well worth it of course. 

And the image editor has another new thing: I’ve added the ability to tweak the processing per image. You can still control the settings applied to all images, but now you can also click an image to tweak it separately. Very useful.

Player death

One thing that can be a bit of a problem, is how to deal with the player dying. Having death in a game can be good to add tension and excitement, and used to be a staple in many choose-your-own-adventure games. But having to restart from the beginning would frustrate many players.

What would be nice is some sort of ”retry” option, to be able to go back to before the fatal choice and continue from there. To support this, i’ve added two new commands, ”quicksave” and ”quickload”.

It is up to the developer to call ”quicksave” before going down a path that might end in death. And when death occurs, simply use the normal game options to have a ”retry” option that calls ”quickload” which will restore everything to the point when quicksave was last called.

There will also be a full savegame system (working on it, almost there), but for dealing with death, this system strikes the right balance of getting the job done while being simple to use.


Another new feature, small but useful, is a new ”return” keyword. It can be used when you want to jump to a location or dialog from several different places, and then return to where you came from. This required adding a stack of visited locations, which could also help debugging.

Debugging

Speaking of debugging, I have added a new command line flag ”—debug”. I imagine i will add more functionality to it going forward, but for now it supports two things: setting the initial state, and disabling compression.

Normally, the compiled yarn is LZMA compressed, but applying this compression takes a few seconds, which is annoying when iterating on the game. So it makes sense to disable it when running in debug mode, as it then launch pretty much instantly.

In debug mode, you can override starting location, and also set inventory items and flags, making it possible to start at any state, rather than having to play all the way up to the part you’re working on. I guess savegames will be another option, but still good to have

Companions

Another feature I added recently is the ability to have a character that follows you around. Previously, characters could only be in specific locations, and you could click on their name to talk to them. Now you can call “attach” to have a character that’s always present, in every scene.

It will still require that you specify in each location where you can talk to that character - but if a location does not have that, the character will still show up in the list, but clicking it will be disabled. “detach” stops the character tagging along.

Audio

A much requested feature, the ability to play sound and music. There is support for wav/ogg/mp3/flac audio files. At some point I will add support for midi music files as well, with support for custom soundfonts. 

Music and ambience loops are handled on dedicated sound channels, so no other sounds will be able to interrupt them. They also support crossfading, and starting at a random position (useful for ambience loops to get a bit of variation).

You can play sound effects, with optional delay (which can also be an interval, for a bit of randomness), with or without looping. 

For both sound and music, you can control the volume (this can also be specified as an interval for some random variance).

I expect to be adding more capabilities for audio in the future, but this is likely to be it for the 2.0 release.

New CRT filter

Yarnspin already has three filter settings: none, pc and tv, where pc/tv are two variants of my CRT shader. I’ve added another called lite, a new crt mode, less blur, no color shift, no curvature. Just a much lighter CRT.

Filter mode NONE
Filter mode NONE
Filter mode PC
Filter mode PC
Filter mode TV
Filter mode TV
The new filter mode LITE
The new filter mode LITE

I really like the new one, and I can see myself using it a lot. As a developer, you can specify which filters are available for the user to cycle through.

Going forward

I’ve not yet done a new release on itch with these new features, but will do at some point. But already, all of it is available on github, for you early adopters who are comfortable building from source. 

The new features are not fully tested yet, so if you try it and find any issues, please do let me know.

The main thing I am working on at the moment is load/save and options screen.

Preview

To round out this already long dev-log, here’s a work-in-progress preview of the new full hd resolution, running the tutorial sample:

 https://mattiasgustavsson.com/wasm/yarnspin-hd


I am using Midjourney AI to generate the pictures for the new full-res version of the tutorial, and I think it works ok.

The fades does not look so smooth, as this is still using software rendering, so it is a bit slow updating the screen. I am planning to implememy hardware accelerated rendering which will fix this.

Get Yarnspin

Comments

Log in with itch.io to leave a comment.

This is absolutely fantastic! I can see myself writing lots of stories with this. I've also spent hundreds of hours making AI art, so this will be perfect for incorporating them into a story. The addition of sound is a dream! Thanks so much for making this. I'll be sure to make a small donations as a gesture of support.

...and news on a release date please? Thank you,

Today :) It's out!

:O  I'm so happy - thank you so much!