clock menu more-arrow no yes mobile

Filed under:

The truth is that many games are held together by duct tape

Looking behind the curtain can be eye-opening

Photo: Terry Cavanagh

Last week, Dicey Dungeons creator Terry Cavanagh celebrated the 10th anniversary of an earlier game, VVVVVV, by releasing its source code to the public. In layman’s terms, this means that the average person can now look at how the game is built, because every line of code can be perused.

This isn’t the sort of thing that happens often, and by that metric alone, the value of releasing this information is immense. People can learn from it, or improve it. Some of the response to VVVVVV’s source code has been horror, as onlookers pick apart things that could have been written better. Cavanagh maybe foresaw this — in his blog post announcing the release, he admits, “VVVVVV is not a technically sophisticated game! Even by the standards of self taught indie devs, it’s kind of a mess.”

There’s this misconception that coding is by nature elegant and sophisticated, because after all, it’s kind of like writing logic, isn’t it? Don’t they call it computer SCIENCE for a reason? But the reality is much more complicated than that. Time and time again, development stories of video games reveal that, because video games have so many different moving parts, from game design to sound, that things often don’t come together until the last possible secondif they come together at all.

“Almost every single game I’ve worked on has shipped at the exact moment that the bits of spit and prayer holding the whole edifice together are on the *brink* of collapse,” wrote game developer James Patton, in a Twitter discussion about game code.

Nearly every game developer I’ve ever spoken to says the same thing.

“Games aren’t just an ordinary piece of software, they are a complex beast that require many different disciplines to successfully ship, and often on timelines that require sacrifices to be made,” said game developer James Simpson in an email. “I know many developers get bent out of shape trying to make their code perfect. Open source code like this makes it clear that you can successfully ship without that level of perfection.”

In this case, there’s a particular portion of the VVVVVV source code that is sparking discussion due to its sheer messiness. Basically, it’s something that helps decide what state a game is in, whether that’s a cutscene or a piece of dialogue. Normally, many of these states might be grouped separately — the mini-game portions written in a different area than say, a jump mechanic — but not in this case. As a random example, Cavanagh appears to have dozens of game states referring to cutscenes sprinkled among parts of the code that are also about things like gameplay modes and the main menu.

Zach Gage, who has worked on mobile games such as Pocket-Run Pool and Really Bad Chess, broke the infamous switch statement down for Polygon by stating that it is “the perfect example of something Terry probably didn’t know about when he started writing the game: how many cutscenes there would be, how the main menu would work, and how many weird potential end states of strange modes there might be.”

If Cavanagh was trying to code something immaculate, he might have stopped to change how he was putting it together so that it was organized better. But instead, he opted to go forward and do what he could, making one monstrous portion of the code handle hundreds of disparate possibilities.

“Instead of ever stepping back to organize it, Terry just decided something like, ‘Hey, I’m going to just keep adding on states into this gigantic switch statement as I encounter the need to have them.’ Which is totally 100% normal, and basically crucial for shipping a game.”

Gage is intimately familiar with this sort of thinking — he tells Polygon that looking back on hit game Ridiculous Fishing, he “literally [has] no idea how that code works because it’s so poorly written.” Even other members on the team don’t fully understand how their game works.

And you know what? Ridiculous Fishing still won awards and made nearly a million dollars in a few months. Obviously, developers should care about game-breaking bugs, or anything that gets in the way of a player’s enjoyment of the experience, but as they say, perfect is the enemy of good.

“There are always going to be parts that are unplanned, and stepping back to coherently organize code means time spent not writing new code, building new features, or doing art,” Gage says.

But for all the eyebrow-raising that VVVVVV has sparked on social media, Cavanagh still seems to have a good sense of humor about all of it.

“What can I say?” he wrote in the source code blog post. “I was young and more interested in getting something on the screen than implementing it properly. Maybe the best thing about VVVVVV’s source code is that is stands as proof of what you can hack together even if you’re not much of a programmer.”