06/10/2020

Terry Cavanagh celebrated the 10th anniversary of VVVVVV by releasing the game’s source code. Onlookers perusing the game’s make-up have been horrifying by what they’ve found, but the reality is that game development is messy, and often, games barely function…

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 laymans 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 isnt 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 VVVVVVs 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, its kind of a mess.
Theres this misconception that coding is by nature elegant and sophisticated, because after all, its kind of like writing logic, isnt it? Dont 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 dont come together until the last possible secondif they come together at all.
Theres a word for games where the code is barely hanging together, with stupid layout, utterly unscaleable fixes and workarounds on top of workarounds.
Shipped
Mike Bithell (@mikeBithell) January 11, 2020
Almost every single game Ive 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 Ive ever spoken to says the same thing.
Games arent 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, theres a particular portion of the VVVVVV source code that is sparking discussion due to its sheer messiness. Basically, its something that helps decide what state a game is in, whether thats 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 didnt 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, Im 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 its so poorly written. Even other members on the team dont 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 players 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.
Every screenshot I see posted of terrible things in the VVVVVV source code only makes me more powerful
Terry Cavanagh (@terrycavanagh) January 10, 2020
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 VVVVVVs source code is that is stands as proof of what you can hack together even if youre not much of a programmer.