TDI.online Tech. Music. Games.

Open Sourcing Games

Programming Pitstop

I think it’s possibly the whole hitting 40 thing, but conversations about software increasingly make me feel like I’m antiquated. I’m not quite the generation of the stereotypical Unix beard, but I’ve lived long enough to see the home computing and Internet revolution take their course, and with that, quite a few changes to how people feel about source code.

My first forays into computer programming were much like any other child of the ’80s, the magazine type-in. Imagine a page of densely packed hex numbers, typeset in some flakey mono-spaced font, the result of which was pushed through the cheapest mass-duplication printer available, onto toilet paper. If you were lucky you’d only have 30 minutes of debugging per 100 lines of code. If it was the late 80s, you’d be shit out of luck, you were basically hunting for the typo in a 400 line hex-dump of assembly.

Have fun with that.

Magazine type-ins were the start of Extreme Programming. Teenagers around the globe paired up, one shouting out Hex, the other mashing at the rubber keys, both hoping to get a shit Pacman clone working. Or some monstrous hack for Elite (yes, Your Sinclair. I’m looking at you). Pre-internet, even this kind of pair-programming was a fucking lonely experience.

It didn’t stop me or most of my friends, though. I remember every programming book from the local public library. Big chunky tomes with brightly coloured cartoons of kids having fun on the front cover, each promising to unlock the secrets of your computer if you could only pour enough hours into the keyboard. In reality, if you were lucky, they might contain 15 “games” the author had phoned-in while writing a serious book about “operating systems” on the side. If you weren’t, they’d contain 15 type-ins for the fucking Acorn Electron. As if anyone ever owned one of those… And once you’d flicked through the 4 books available in your village library? Well. I don’t know. I never got past that bit. I was 12.

So it seems crazy to me - now that I’m living in the future - that we really have very little in the way of source code available for the thing nearest and dearest to me, the computer game. And by that I don’t mean Unreal 4, because we do have the source code to that, but Mario 3. And X-Com. And Llamatron. And… Lumo.

Why is this?

I think it’s worth a detour into what ’Software Freedom’ means and we can’t do that without quoting Unix Beard, and bad songwriting, Richard Stallman [RMS], who defines it thusly:

  • The freedom to run the program as you wish, for any purpose (freedom 0).
  • The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.
  • The freedom to redistribute copies so you can help your neighbour (freedom 2).
  • The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.

Which sounds fair enough. It’s hard to argue against any of this as a technically literate person.

It is, unfortunately, very easy to argue against this as a capitalist. Software is power. Software is control. Software is, increasingly, one of the best ways to make money in the modern world. Software allows you to deliver advertisements, which is basically all our future holds for us before the AI singularity arrives. Software. IS.

But despite this, so much of the software we use in the modern world is built upon open libraries, the work of people who’ve willingly given access to their code, that it’s hard to imagine a world without it.  TCP-IP stacks, anyone?

So why do I think this is important?

Well, my entry into programming (the type-in’s I jokingly referred to above) are a large part of it. But also because I’m seeing a lot more start-ups - and a lot more junior game developers - now that I’m doing a bit of teaching. I’m all for the de-skilling that middleware provides - without it Lumo would have taken at least a year longer to make, and it more than likely wouldn’t have looked as good - and I’m really happy that the barriers to entry for wannabe developers is much, much lower. It’s good for me, because it makes my life easier as well.

Another aspect that I think is important is preservation. We’re utter shit at this in the games industry. Unless there’s a tidy sum to be made repackaging a game, or doing an HD make-over, then the likelihood that you’re going to be able to play that game in the future is left almost entirely the hands of the emulator makers. And we’ve let our governments do quite a lot to make this illegal through things like the DMCA.

Of course, there have been quite a few games that have been open sourced. Wikipedia has a list of them. This list is far from complete, but it’s interesting to note just how infrequently games make their source code available, and how old most of the games that have done so actually are. Why aren’t more games opened up? Why do the junior game developers I see at TAMK every year have nothing like the access to working game internals that I had?

Tutorials just don’t cut it, especially on YouTube. Despite all the tutorials, and the books, I see the same mistakes in Unity time and again. I even make some of them. It’s practically impossible to keep a clean structure in a project, especially once Asset Store purchases are littering your root folder. The component model’s flexibility is always the thing that trips up junior developers. When no structure is enforced for global state, or how best to control a scene, components are duplicated, more things end up running in the scene than need be, and dirty hacks on triggers end up being everywhere. Monolithic components get written that are hard to debug and keep working. The layers of nested if statements I’ve seen just to control something simple, like moving between scenes, can boggle the mind. It takes a long time to explain how to architect this stuff and I know from my own experience that it’s easier to poke around in someone else’s code to see how they did it. As for getting your head around Mecanim, or how to actually get the audio system to do something useful…

Of course, if you’re not using middleware then you have some good things to look through. We’ve all flicked through John Carmack’s Doom source, for instance, or at least read the review of it. I just wish there was more of this stuff out there.

We did talk quite seriously about opening up the Crackdown 2 codebase and toolchain after it was released, as well as seeing if there was something we could do with the assets. Stuff like this litters every studio I’ve ever worked at and it’s often used in one project and then never touched again. Sometimes the engine will progress and receive more internal funding - ie: it’ll be used on more than one game - so there’s often a concern about giving away the “Crown Jewels”, but with more and more people using middleware that’s increasingly not the case.

Tbh, I’ve heard the conversation come up in a few different places, but between the legal side, and the cost of “cleaning up” the code base (removing the swears), or actually getting the bugs out of an editor so it’s fit for public consumption - you’ll be surprised at the level of bugs people put up with in bespoke toolchains - I’ve never been anywhere that’s gone past the “this would be nice” stage.

So I had a look at what would be involved in making an Open Source version of Lumo available at some point in the future. And this is where I hit the same problems:

  • I don't have a license to distribute the props, textures and code that I've purchased from the Asset Store. There isn't actually a lot of this, but the two code bits that I do use are fairly fundamental: UI and Input. That's a reasonably big job to work around. On the graphics side, removing the props is trivial, and the textures could just have a picture of my face slapped on them. People will quickly update them to something else. But the prefab system doesn't save me here (for reasons I'll save for another rant)
  • Bit Rot: Lumo's been through 4 major updates of Unity (it started on 4.0.1 iirc), and every upgrade has broken something. I have absolutely no way of ensuring an open version of the project will even build in 6 months.
  • Hosting: turns out it's non-trivial to find good, cheap (ie: free) hosting when you're living on a shoe-string. Lumo's a few gig without Git history, although removing a lot of 2048x2048 textures will definitely help.

I should be worried about people rifling through 2 years of code that was never thought through (ie: designed) but tbh, at this point in life, the state of my code is really of little concern to me. It works. Some of it could be better. Some of it’s perfectly fine, thank you very much.

I’m also not worried about the commercial impact, which I know is a negative for larger studios. I’m pretty sure that the secret sauce in Lumo isn’t it’s code or assets, but that I’ve basically entertained myself for 2 years, trying to make myself laugh. I’ve also used commercially available middleware, so there’s none of the “proprietary tool / chain crown jewels” stuff to get in the way.

So it’s literally re-working the game to remove all the graphics and code that I can’t distribute, and I’m not sure I can work around that without a month (?) of work. As much as I’d like to, I can’t afford that, and nor am I likely to in the future. :(

But I do want to do this. I do want to open up my games, and I do want to encourage other people to open up theirs, as well. The Gamemaker source bundle was an excellent move, but it shouldn’t just be independant developers that do this. I just can’t see any easy way to persuade larger companies to do it, especially when they can wait 5 years and sell the same games again, but this time in 4k. (Halo Remastered Master Master Remaster Chief collection will be a thing. You know it.)

So I’m going to keep Lumo on the backburner, if I do get into a position where I can afford to spend the time on it, then I’ll go back to it. Tbh, I should have thought of this earlier. If I’m fortunate enough to carry on making my own games then I’ll take this whole idea a lot more seriously.