Take it to (LÖVE) 11

Have you ever heard the expression "ripping off the Band-Aid?"

So, Refactor is written using LÖVE, which is a wonderful little game-development framework. LÖVE had been on version 0.10.2 for ages, with version 0.11 in the works for quite some time. The idea of it never reaching version 1.0 was even a long-running joke and the subject of several April Fool's jokes, so this year they actually did it for real - or rather, they skipped straight to version 11, capitulating to the current trends in software development.

I had actually missed this release announcement as I'd been busy on another project at the time (I still am — several projects, actually, which is why I haven't been actively working on Refactor for a while), but last night I finally found out about it and decided to see how hard it would be to upgrade.

You can see how well that went at first:

So, yeah, LÖVE 11 changed a bunch of fundamental stuff; the main visible issues in that screenshot are that they switched from an old-fashioned color range of 0-255 to a more modern, consistent range of 0-1, and they changed the high-DPI API considerably. Other stuff had to change to even get to that point, as well; the Canvas API is somewhat different (using a property bag for configuration rather than an increasingly-growing list of arguments), and the audio API has also been changed considerably.

At first I was pretty frustrated, because my (incredibly incorrect) gut reaction was that these changes were unnecessary and only broke everything, and I thought briefly this might even be the end of Refactor because I thought it would be an enormous effort to get everything updated.

But the actual upgrade process only took me a couple hours, and I think the code is much better for it.

The change to colors was the most pervasive and required the most work, but it also ended up simplifying almost all of my code (aside from the cases where I need to match a color from an image which gets slightly more complicated), and it also brings draw-call colors in line with how shaders do colors, and also makes way more sense in HDR and floatingpoint buffers. Honestly, this is one of those things where they should have made this change ages ago, since 8-bit integer colors haven't made sense for at least a decade now.

The audio API changes were also a big improvement; previously, the state transition diagram for what things like "stop" and "play" and "resume" meant was enormously complicated, and now they've clarified and simplified it to an extreme. So all of the sound code of mine that was impacted had actually been stuff where I was working around the old code. So that simplified my audio code immensely.

The canvas API change makes no real difference to anything and it lends itself well to future expansion (and I suspect they mostly did it to ease the DPI-independent API as well).

On the note of DPI-independence, for now I've disabled high-DPI display support, because, well, LÖVE 11 does a bunch of stuff automatically and I have a lot of code which tries to do things manually which is no longer necessary. I'll have to go through and redo a bunch of stuff; I suspect that in the long run I'll have much simpler code, which is great. Even if it means Refactor is temporarily ugly on my 5K display. :)

Now, all that said, it would be nice if LÖVE had a better deprecation mechanism. Previously, games just specify which version of LÖVE they're built for, and if that doesn't match you get a warning:

and that's it. There's no attempt at backwards compatibility whatsoever. And the nature of LÖVE's toolchain is that it's only really convenient to have a single version installed, so if you're working on multiple projects where one can't upgrade for some reason, things get way messier for you.

I would much rather see them adopt an approach like the Java world (which has also been adopted by C++, even!) where the runtime maintains a compatibility layer for the last 1-2 major versions and then prints deprecation warnings when an old API is being used. It's a lot more work for the runtime maintainers, though, and it's not even rewarding work. I'm also not sure what the migration strategy would even look like for APIs like love.graphics.setColor() where the API is the same but the meaning of the values is different; sure, they could detect when someone uses a value greater than 1 and if so, set the color system to divide by 255 (and print a warning), but that's just putting off the inevitable and makes things even more confusing when you do upgrade. (Not to mention there are cases where it makes sense to use values outside of the range; there's a few spots in Refactor where I do that both for shader purposes and for supersaturating the alpha channel, like on text outlines.)

Anyway, another nice thing about LÖVE 11 is that they are now distributing pre-built AppImage binaries for Linux, which makes distributing standalone Linux builds much, much easier. The old process was so harrowing that I opted to just not support Linux beyond a LÖVE package (requiring players to install their own binaries), but now I should be able to start supporting Linux directly — good news for those of you who have been requesting that! I can't say when that will actually happen, but hopefully before I make the next track.

Also, goodbye Super Toast. Balloon duck will take some getting used to.

UPDATE: It turns out that there is a deprecation mechanism now, so hopefully this means that future releases won't be as difficult or surprising as past ones were.

Oh, and I finally looked at the actual changelog. Lots of good stuff in here! I'm looking forward to finding a use for a lot of these functions (especially the audio filters).


macOS, x86 64-bit 43 MB
Version May 16, 2018
Windows, x86 64-bit 30 MB
Version May 16, 2018
Windows, x86 32-bit 30 MB
Version May 16, 2018
LÖVE bundle 26 MB
Version May 16, 2018

Get Refactor

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.