Thursday, March 16, 2023

April 1 is IF Source Code Amnesty Day

On the forum, Mike Russo writes:
One of the most valuable resources for folks learning an authoring system is source code for existing games, so they can see how others have solved problems similar to the ones they’ve faced. Publicly-available source is also nice to have for folks who appreciate a game and want to learn more about the nuts and bolts of implementation, and it also helps satisfy the archival impulse that animates many parts of our community.
[...] I’m proposing that April 1 be denominated Source Code Amnesty Day: a day when we can all show our dirty laundry to the world, confident that if we all do it at once no one person’s awful awful coding will come in for special attention or derision. Marking it to April Fool’s Day also hopefully indicates the degree of seriousness with which folks should take proceedings.
This is a great idea! Let's do it. End of post.

Okay, a bit more discussion.
This was posted on the IF forum; it's implicitly about interactive fiction source code. Of course I encourage you to release source code for all your projects! But if you're writing a tool or a web service, you probably already know where you stand. You may live in open-source world (like me), or you may have your own private garden, but you made that decision a long time ago.
Free games are different, for some reason. All of my tool projects are open-source, but it took a few years to feel comfortable releasing source code for my games. The back of my brain was saying, "What if people use this to cheat? What if they're playing the game wrong?"
I am here to say that's silly. Okay, I usually don't release the source code for an IF game immediately. I wait a few weeks, until the first batch of players has plowed through. If it's part of a contest or jam, I wait until the event is over. Maybe that's silly too. But it's a small delay. I know that my IF work is going to be online for as long as the Internet lasts. In forty years, nobody is going to be worried about spoilers.
So if you look at my IF page, you'll see "Read or download the source code" for all my games. Except Hadean Lands, because I still make money off that one.
(Yes, one of the games on that page is almost forty years old! Well, the original BASIC version is. The Inform 6 port is a bit younger. Feel free to dig around the Apple 2 disk image for the real source code, if you dare.)

In his post, Mike talks about a different hesitancy:
Still, there are far more games without release source code than games with it, and for many of the smaller authoring systems, there may only be a handful of worked examples out there.
The main reason for this is not exactly a mystery, of course – it’s the reason I haven’t released the source for my two games: the average author looks at the elegantly-conceived, deeply-commented stuff that the leading authors have put out, then looks at the regurgitated pile of dog sick that constitutes their barely-working game, and wonders what possible value there could be in inflicting such horrors on an unsuspecting public.
This is also silly. To summarize Josh Grams's excellent argument in that thread:
Your code is not terrible. You got a working game out. Maybe you didn't know some elegant shortcut that Inform offers, but so what? You solved the problem.
Also, nobody's IF code is all that great. I have lots of Inform experience, but when I'm fixing up one buggy response I'll whack in a global variable and have done. It solves the problem. I write Inform code the lazy way. It's not like I need to maintain it for years; I'm going to do a couple of bugfix releases and then archive it.
Really, every IF game is a towering pile of hacks -- it's the nature of the beast. If you try to make it all elegant, you'll never ship.

I've been knocking down the reasons not to release your IF source code. What are the reasons to do it? What's the benefit?
It's true, people may peek at your source code to see how you did a particular thing. That's good! You may not know the best way to accomplish that trick, but you knew a way, and maybe the reader needs that.
Consider Twine. A playable Twine game includes all its source material -- the boxes, the layout, the markup. You can load it directly into the Twine editor and have a look. This is a major reason for the rapid takeoff and spread of Twine as a system. (The same effect that led to the rapid adoption of HTML and the Web in the early 90s. Want to know how a web page works? View source and find out!)
(From that thread: Autumn Chen's Twine Garden v2, a blog of Twine node maps.)
Compiled IF systems like Inform, TADS, and ZIL miss out on this benefit. We should reclaim it by getting more source code out there.

There's future scholarship. I know, you cringed all over again, but stop. The point of research is to find out what people wrote. If you hide your work in shame, that just makes someone's life harder.
Remember this post about Zork's inventory limit? People were complaining that the "holding too many things already" message was randomized and thus unfair. I dug into the game file and wrote up an analysis. (Yes, it's randomized; no, it's not unfair per se; it's a deliberate part of Zork's design; how unfair Zork is by modern standards is a whole discussion.)
As it happens, I wrote that post before Jason Scott's release of the Zork source code on Github. I was relying on a long history of community effort to disassemble and annotate the Infocom game files. (Special thanks to Allen Garvin.)
Nowadays it's very easy to dig through the Infocom source code and answer questions about it. How did their parser code change from game to game? Did their inventory limit policy evolve over time? How many ways are there to die in Zork? Which games awarded ranks based on game score, and what were they? These are the sorts of questions people are asking when they dig into a source code repository. It's not about whether the code was good.

When Cragne Manor was in progress, I was fascinated by the idea of a source code collection. Here were eighty authors from the whole 25-year history of modern IF, all attacking a similar problem -- without looking at each other's work. What a sampler! What a variety of styles and approaches!
We didn't wind up with a complete source code release, but I undertook to collect source files from everyone who was willing to send them over. You can see the collection here. I think this is a terrific resource.

"So how do I participate?"
[...] if others would like to also post your stuff, please piggyback on the thread – or just quietly update IFDB or upload to the IF Archive so as not to draw attention to yourself, that works too.
The IF Archive /games/source directory welcomes all arrivals. Or post your files on Github, or on your own web site. Whatever works.
(Google Drive, Dropbox, and other such services are not good choices. Files left there may eventually be marked "abandoned" and thrown away. Remember what I said about forty-year-old games?)
Planning a game for Spring Thing, IFComp, or another festival in 2023? Plan to post the source code in April of 2024! This will be a repeatable feast.
And me? Well, I said a few paragraphs ago:
Except Hadean Lands, because I still make money off that one.
You know what? That's not an excuse either. Hadean Lands is almost ten years old. Nobody's going to clone the game and steal my slot on the App Store. Even if they wanted to, the source code wouldn't help them do it.
So here's my deal. If you -- you personally -- agree to put up some of your IF source code this April 1st, I will post all of the Inform source for Hadean Lands on that same day.
This source code has hitherto only existed as a limited-edition printed book. It was one of the high-end rewards for the original HL kickstarter. I only gave out about thirty of them. It's never been available in downloadable form.
Truthfully, I was already planning to post the source in October of next year, the tenth anniversary of HL's release. But this is a way better excuse.


  1. All well-said. I have gleaned so much reading what Inform 7 source code I have found over the years.

    I have no complete game source to offer, sadly. The best I can do is to open what is completed of my barely-started game The Codex of Hamurabi. I will do that on April 1: I'm not sure why I didn't do so six years ago when I stopped work on the game. Look for it at on that date.

  2. This is what's really nice of ecosystems that incorporates that philosophy on the "package", like Twine, Bitsy games also could be imported on the engine and look at the innards and pixel art. It marks the difference.

  3. "Amnesty" I haven't done anything wrong, and who exactly is pardoning me?

    1. I was thinking we’d largely be pardoning ourselves - telling our inner critic to let us off the hook - because when it comes to coding practices, personally I have done many many things wrong :) If the name fails to resonate feel free to mentally call it something else, or just release your stuff any other day or the year!