
VVVVVV’s source code is now public, 10 year anniversary jam happening now - ciroduran
http://distractionware.com/blog/2020/01/vvvvvv-is-now-open-source/
======
klodolph
It’s always great to be able to study the source code for successful,
released, real games.

I will note that this is actually the source code of the C++ rewrite! The
original game was written in Flash, and this version was apparently written by
Simon Roth.

My impressions: The source code is a bit of a tangle here. There are magic
numbers ([https://wiki.c2.com/?MagicNumber](https://wiki.c2.com/?MagicNumber))
all over the place, plenty of god classes
([https://wiki.c2.com/?GodClass](https://wiki.c2.com/?GodClass)), and in
general you will have to do a bit too much archaeology to figure out what a
particular class or member function is supposed to do (the function and class
names don’t give you enough, and there are no comments to help out). There are
a few WTFs in here, like the "int i, j, j;" in Script.h.

THAT SAID, This is not really out of the ordinary for successful, released,
real games. It’s not really different in style from the Celeste Player code.

[https://github.com/NoelFB/Celeste/blob/master/Source/Player/...](https://github.com/NoelFB/Celeste/blob/master/Source/Player/Player.cs)

But if you’re writing a game of this size or complexity, I recommend doing
some refactoring work along the way. In my experience, this will reduce the
amount of insanity in the project towards the second half of the development
cycle.

But I am always more impressed by ugly code behind a good game than I am by
clean code behind an unreleased, unfinished, or unfun game.

~~~
chrisseaton
> The source code is a bit of a tangle here. There are magic numbers
> ([https://wiki.c2.com/?MagicNumber](https://wiki.c2.com/?MagicNumber)) all
> over the place, plenty of god classes
> ([https://wiki.c2.com/?GodClass](https://wiki.c2.com/?GodClass)), and in
> general you will have to do a bit too much archaeology to figure out what a
> particular class or member function is supposed to do (the function and
> class names don’t give you enough, and there are no comments to help out).
> There are a few WTFs in here, like the "int i, j, j;" in Script.h.\

> This is not really out of the ordinary for successful, released, real games.

Maybe these supposed anti-patterns don't really matter as much as we think
they do for successful software? Given that plenty of successful software has
them.

~~~
Seenso
> Maybe these supposed anti-patterns don't really matter as much as we think
> they do for successful software? Given that plenty of successful software
> has them.

There's more than one variable involved. You can write successful software
full of anti-patterns, but you'll probably pay for it in some other way (like
increased QA effort or a low bus-factor [1]).

[1]
[https://en.wikipedia.org/wiki/Bus_factor](https://en.wikipedia.org/wiki/Bus_factor)

~~~
mumblemumble
The motivations around those kinds of factors are different for games, though.

e.g., bus factor has to be weighted a lot more highly on software that needs
to be maintained indefinitely than it does on software that is going to be
shipped on a fast-approaching deadline and then (probably) never touched
again.

Also, bus factor's importance depends on the size of the team. In the limit
case - a 1-developer project like VVVVVV - it's meaningless.

~~~
heavenlyblue
It’s not meaningless when you’re spending exponentially more time debugging
random bugs due to lack of architecture (which usually implies you can’t
properly test anything, too).

------
pdpi
Oh gods.

VVVVVV's core mechanic is that you don't so much "jump" as you just flip
gravity, and you only get to do so when your feet are firmly on the floor.
This leads to some very interesting designs.

The stage "Veni Vidi Vici (Doing Things The Hard Way)" is possibly the evilest
level I've ever completed in a video game. Just a tiny little block, trivial
to jump over, but the lack of a jump button means you have to... do things the
hard way.

[https://www.youtube.com/watch?v=4CtiY5D6HCs](https://www.youtube.com/watch?v=4CtiY5D6HCs)

~~~
umvi
> is possibly the evilest level I've ever completed in a video game

That was the case for me too, until I recently picked up the game _Celeste_.
Some of the C-sides were so evil I just gave up and never beat them (I have a
wife and kids, time is limited). This is coming from someone who generally
likes hard games (big fan of Dark Souls series, for example, and yes, I know
"hard" is relative).

The Celeste Chapter 9 golden strawberry though... that has got to be the most
evil collectible I've _ever_ seen included in a mainstream game. I would bet
<.01% of Celeste players will ever earn the Chapter 9 golden strawberry.

To put it in perspective - to earn a golden strawberry you must beat the level
without dying once. If you die, you are sent all the way back to the
beginning. This isn't too hard if the level only takes 10 minutes to beat like
Chapter 1. However, Chapter 9 took me over 4 _hours_ to beat and I died over
1,000 times. And not only that, if you manage to beat Chapter 9 without dying,
you are transported to a secret _extra_ level (that you've never had a chance
to practice). You have one chance to beat the secret extra level without dying
- only then does the game award the golden strawberry.

I can't even fathom the amount of time and practice required to accomplish
this feat. It must be up there with some of those insane Mario Maker levels.

~~~
NoodleIncident
I got sucked back into Celeste recently; as of last night, the only golden
berries left for me are 5B-8B, Farewell, and the dashless winged berry for 1A.
(I also haven't gotten the moon berry yet, I kind of forgot about it when I
was polishing off the red berries earlier). At the same time, it's easy to
believe that this is as far as I'll ever make it; part of what makes going for
golden berries so addictive to me is that each new level has seemed pretty
much impossible before I start practicing it, so I guess we'll see.

The subreddit r/celestegame tries to keep track of everyone who's gotten the
Farewell golden berry; the official list only has about 20 people on them. Of
course, you have to record and post your gameplay to be eligible for this
list, but there can't be many more people than that who've done it.

But from the other side of things, there's actually a speedrunning category
for collecting all 202 berries, including the Farewell berry. TGH just set the
world record on Christmas Day, I believe, completing that chapter's golden
berry on his first attempt, along with the other hard golden berries. I think
this really puts into perspective how skill curves work in games; not only are
there very few people who ever approach the top level of skill, but the
individuals at the very top are separated by wider skill gaps than you can
imagine. This is why matchmaking at the top of a ranked ladder is so hard!

~~~
umvi
Dashless 1A isn't as hard as you think - just go into options and remap the
dash button and then take it one room at a time - you can die as much as you
want, you just aren't allowed to dash. Watch a video if you get stuck. I was
able to do it in one sitting.

~~~
NoodleIncident
I got it the other day after finishing 5B! I got curious about skipping the
keys in 5B, which involved a lot of spike jump tricks (ended up not doing
them), and then polished off 1A dashless the same day. I definitely followed
along with a video, and I had to restart after a few of the hard rooms after I
instinctively dashed to save myself.

I don't think I thought it would be hard, I just wasn't interested in learning
precise spike tricks when I started going for golden berries. It was more
interesting to see how the easy levels play out when you have to memorize and
execute the whole thing at once.

------
VonGuard
Terry Cavanagh is one of the greatest game designers of our time. His simple
mechanics and designs often remind me of something like Chess or Go, where a
simple ruleset covers a massively deep game, or is used to communicate a story
in a very minimalist fashion. Don't Look Back is one of my favorites:
[https://terrycavanaghgames.com/dontlookback/](https://terrycavanaghgames.com/dontlookback/)

A few years back, he did a beta of a game called Four Letter Word... Though
that's not the real title: [http://distractionware.com/blog/2011/11/the-four-
letter-word...](http://distractionware.com/blog/2011/11/the-four-letter-word-
thing/) The real title is a set of cryptic non-alphabet characters.

It was like an Atari 2600 cartridge from a space alien. It featured 2600-style
graphics, a hidden hard-as-nails FPS game, and a buncha hidden 2d content that
seems simple at first, but was super intriguing. So crazy non-traditional, and
with some obscure mechanics, it was one of my favorite things I've ever
played, and he never finished it, sadly. I love cryptic games, and I love
simple mechanics taken to extreme conclusions. That's why I adore Terry.

~~~
StavrosK
Super Hexagon is one of my favorite games ever, as it's extremely simple,
extremely hard and extremenly engaging at the same time. Brilliant.

~~~
enneff
Super Hexagon is a game that when I first played it I could not believe it was
possible to complete it, yet a year later I could get >60s in all the levels.
An insane grind but somehow immensely satisfying.

------
royjacobs
An interesting quote from the build instructions: " In particular, the Windows
version absolutely positively must be compiled in Debug mode, with /RTC
enabled. If you build in Release mode, or have /RTC disabled, the game behaves
dramatically different in ways that were never fully documented (bizarre
softlocks, out-of-bounds issues that don't show up in tools like Valgrind,
stuff like that)."

I wonder if people will spend the time to actually debug this properly now
that the source is available.

~~~
rob74
Considering other quotes, like this one: "For example, maybe my worst
programming habit is declaring temporary variables like i, j and k as members
of each class, so that I didn’t have to declare them inside functions (which
is annoying to do in flash for boring reasons). This led to some nasty and
difficult to track down bugs, to say the least." I wish those people the best
of luck :)

~~~
Jare
Cunning way to never have uninitialized variables!

------
JakeWesorick
I appreciate big successes revealing the jank-ness going on behind the scenes.
It helps me fight imposter syndrome knowing that everyone is always learning.

------
ddevault
Ethan Lee worked on this! Ethan Lee is an awesome person. Ethan is probably
the single biggest contributor to gaming on Linux, and he's always worked in
the background. Thanks Ethan, you rock, and deserve more credit.

~~~
cookiecaper
Maybe I've just been out of the scene too long, but can't let mention of Linux
gaming luminaries go without Ryan C. Gordon of Loki Games/icculus.org. For
many years, if there was a big project coming to Linux, Ryan Gordon was likely
to be the wizard behind it.

His homepage: [http://icculus.org/](http://icculus.org/)

Wikipedia:
[https://en.wikipedia.org/wiki/Ryan_C._Gordon](https://en.wikipedia.org/wiki/Ryan_C._Gordon)

Patreon: [https://www.patreon.com/icculus](https://www.patreon.com/icculus)

~~~
FreezerburnV
Ryan is currently working on on a new cross-platform game engine where you
write entirely Ruby: [https://dragonruby.itch.io/dragonruby-
gtk](https://dragonruby.itch.io/dragonruby-gtk)

------
scotth
If anyone is looking for a really great game, you should check out Terry's
latest, Dicey Dungeons. Incredible variation. Each episode and character has
you discovering new strategies and play styles.

30% off on Steam right now:
[https://store.steampowered.com/app/861540/Dicey_Dungeons/](https://store.steampowered.com/app/861540/Dicey_Dungeons/)

~~~
gpvos
Hmm, not anymore it seems (the 30% off).

------
ginko
Quite cool, although the license is quite strict:

[https://github.com/TerryCavanagh/VVVVVV/blob/master/LICENSE....](https://github.com/TerryCavanagh/VVVVVV/blob/master/LICENSE.md)

~~~
floatingatoll
Not much more strict than CC-BY-NC, unless I’m missing something? The “you may
not represent your fork as my product” is a good abuse prevention that I’m not
sure the equivalent CC contains, good call including that.

~~~
teddyh
“ _You may not alter or redistribute this software in any manner that is
primarily intended for or directed toward commercial advantage or private
monetary compensation._ ”

This kind of stuff is generally regarded as non-Open Source.

~~~
tudelo
Why? The source is open to the public?

~~~
teddyh
The term “Open Source” has a precise definition, determined by the Open Source
Initiative, who invented the term and started promoting it. Nobody used this
term in software contexts before they did. They get to define it.

~~~
xorcist
Not sure why this is downvoted. One of the criteria when the term "open
source" was decided on by the people who went to form the OSI was that it must
not have (much) documented earlier use in order to become eligible for
trademark protection.

It was always meant to be a trademark, even if they ended up losing that
particular battle. It was deemed to descriptive and generic to be
trademarkable, IIRC. The OSI published their criteria anyway, enforced it as
much as they could, and really publicized the term over the years. Of course
they get to define it.

------
jdlyga
It's such a good game, I highly recommend it. The level design, the music, and
the creative names of all the rooms you visit.

------
tombert
You know, people like to crap on Flash (and there are valid reasons to do so),
but I really miss how _quick_ you could get a game built with it, while it
still felt like "real" programming.

With Flash, I felt like a nice "one-stop-shop" in a lot of ways; you could
draw your graphics, animate them, and code them, and you could get a simple
game made in an hour or two.

I haven't tried Unity or really any other dedicated game engine, so maybe you
get that feeling with those, but I will always be nostalgic for Flash; it
really helped make programming "fun" for me.

~~~
azhenley
Flash was great and I haven't found a direct replacement yet (GameMaker Studio
2 is the closest I have found). I pumped out 8 Flash games about a decade ago
that generated enough ad revenue to cover all my bills for a few years! I miss
how easy it was. Another _huge_ win is how effortless it was to distribute
Flash games (they spread like wildfire after I uploaded it to one or two
sites).

~~~
Quenty
Have you tried Roblox?

~~~
ghostbrainalpha
I thought Roblox was a game... is it also a game making platform?

~~~
jandrese
Most of the Roblox games are user created. It ships with Roblox studio.

Just remember that the average age of a Roblox player is like 8, so in-depth
RPGs or complex sim games probably won't get a lot of traction.

~~~
asdasdasdasdwd
There was an interesting podcast about Roblox in Hanselminutes a few weeks
ago: [https://hanselminutes.com/709/robloxs-kelly-mayes-on-
communi...](https://hanselminutes.com/709/robloxs-kelly-mayes-on-community-
building-and-digital-civility)

~~~
mhast
There's also one on Software Engineering Daily, quite interesting and it made
me consider trying it out just to see what the building tools are like.

[https://softwareengineeringdaily.com/2019/12/18/roblox-
engin...](https://softwareengineeringdaily.com/2019/12/18/roblox-engineering-
with-claus-moberg/)

------
CodeArtisan
Did they use a transpiler or something for the mobile version? Lot of magic
numbers and odd code like this

    
    
        if (t == 0) t = 0;
        if (t == 1) t = 20;
        if (t == 2) t = 14;
        if (t == 3) t = 15;
        if (t == 4) t = 13;
        if (t == 5) t = 16;
    

or

    
    
        case 17:
            blocks[k].prompt = "Press ENTER to activate terminal";
            if(mobilemenus) blocks[k].prompt = "Activate terminal";
            blocks[k].script = "terminal_warp_1";
            setblockcolour(k, "orange");
            trig=0;
            break;
        case 18:
            blocks[k].prompt = "Press ENTER to activate terminal";
            if(mobilemenus) blocks[k].prompt = "Activate terminal";
            blocks[k].script = "terminal_warp_2";
            setblockcolour(k, "orange");
            trig=0;
            break;
        case 19:
            blocks[k].prompt = "Press ENTER to activate terminal";
            if(mobilemenus) blocks[k].prompt = "Activate terminal";
            blocks[k].script = "terminal_lab_1";
            setblockcolour(k, "orange");
            trig=0;
            break;
    

from
[https://github.com/TerryCavanagh/VVVVVV/blob/master/mobile_v...](https://github.com/TerryCavanagh/VVVVVV/blob/master/mobile_version/src/entityclass.as)

~~~
spiralganglion
This just looks like typical game dev code to me. You treat the code like a
scratchpad, exploring the space and looking for things that work well. Lots of
things written once and never touched again, lots of things written with magic
numbers because that makes it easier to delete.

~~~
tudelo
Whenever I look at game source code, I start to realize how all of the crazy
speedrun glitches exist

~~~
exikyut
Especially on limited platforms of old, where crazy hacks were necessary to
get the game to _fit_ in the cartridge/RAM/CPU speed.

------
ranger207
The Awesome Games Done Quick speedrunning marathon [0] ran this game this
morning. I didn't get a chance to see it, but I wonder if they mentioned
anything about its tenth anniversary? Watch for the video here [1] after
today's stream is archived.

[0] gamesdonequick.com [1]
[https://www.reddit.com/r/speedrun/comments/ek9zmz/agdq_vod_t...](https://www.reddit.com/r/speedrun/comments/ek9zmz/agdq_vod_thread_2020/)

~~~
KapKap55
This source code release was actually announced at AGDQ on a custom end-game
screen once the runner completed it, which is why you're hearing about it now.

~~~
ranger207
Whoops, I missed that. Have to watch it when I get home then!

------
buryat
I remember getting this game from the first humble bundle and enjoying it, it
had very simple gameplay, little to no time to get into and very enjoyable.
Going to play it again!

------
caconym_
This is a great game, by the way. If you haven't played it, you should.

~~~
xioxox
It's really good. Had a real 80s vibe and nice gameplay.

------
MrGilbert
I always love when something closed source goes open.

While I never played this game in particular (looks like I've missed
something!), I love to study code. It's always interesting to see how other
devs tackled a problem or just structured their code.

Thanks a lot!

~~~
ocdtrekkie
Indeed. Someone open sourcing their previously closed project will always get
my upvote. :)

In this case the code is likely pretty messy. The repo explains that it was
ported from a Flash game and a lot of the bad hacks used to make it work in
Flash were ported to C++ more or less verbatim.

~~~
quietbritishjim
From the article:

> For example, maybe my worst programming habit is declaring temporary
> variables like i, j and k as members of each class, so that I didn’t have to
> declare them inside functions (which is annoying to do in flash for boring
> reasons). This led to some nasty and difficult to track down bugs, to say
> the least. In entity collision in particular, several functions will share
> the same i variable. Infinite loops are possible.

~~~
lukebitts
> which is annoying to do in flash for boring reasons

Does anyone know what are these boring reasons? I've used AS2 and AS3
extensively and don't remember this ever being an issue

~~~
uhoh-itsmaciek
Same here. The only thing I can think of is variable hoisting, but I don't
think that's annoying enough to prefer this other approach.

------
newnewpdro
It's helpful/inspiring to see you don't have to be the greatest programmer to
create successful video games.

Just skimming the code a bit reminded me I probably spend way too much time on
elegant interfaces, clean implementations, and good naming, in my own games.

~~~
mhast
Well, I think most games err to the "quick and dirty" side of things. Tracking
down intermittent issues in code like this must be horrible, if not
impossible. Leading to delayed projects, buggy releases and developer burn
out.

------
AndreyKarpov
The PVS-Studio Team couldn't get past the source code of this game:
[https://www.viva64.com/en/b/0707/](https://www.viva64.com/en/b/0707/)

------
cambalache
I bought this game for 1 dollar (in the first Humble bundle) and I still
consider it as of the most fun games ever. Simple controls, catchy music,
interesting mechanics (for its time), nice difficulty, without being "unfair".
It has everything. If you like platformers and simple games you should check
it out.

~~~
jandrese
I'm giving a side-eye to that 'without being "unfair"' comment. I remember a
few levels with some real bullshit.

~~~
SquareWheel
Any difficulty spikes were usually for the optional trinkets, and not required
to beat the game.

------
tibbon
Oh this is really cool! I've been thinking how interesting this could be to
backport to NES or C64. I'm guessing there isn't too much in the game
happening that couldn't probably happen on those systems with minor
modifications.

------
diegoperini
I've spent days speedrunning this game. Highly recommend it!

I also suggest "Don't Look Back" from the same developer. It is a short but
touching platformer that fills more like a book than a game without even
telling a single word.

------
bscphil
VVVVVV is probably my favorite game of all time. I've gotten so many great
hours out of it, it's very relaxing. Thanks Terry for everything and now for
releasing the code as well!

------
alexghr
Gosh, this brings back sooo many good memories. If you haven't played it yet,
you must! It is an excellent game, with superbly simple gameplay and excellent
music!

------
jonahrd
I just replayed this over the holidays! Time for more :)

------
gameswithgo
It says a lot about vvvvv that, I don't like this TYPE of game, lots of jump
puzzles. But I like this game! It is just really well done.

------
egypturnash
Ah yes, fond memories of spending hours trying to navigate my little dude
through several screens of Godzilla’s Spiky Asshole.

------
gfxgirl
I got this confused with VVVV

[https://vvvv.org/](https://vvvv.org/)

------
jadar
This is one of my favorite games and one of my favorite game soundtracks!

------
joshu
i was so hoping this was about vvvv.

------
ddevault
This is really great! I wish they wouldn't call it "open source", though. It
looks like a source-available license:

[https://github.com/TerryCavanagh/VVVVVV/blob/master/LICENSE....](https://github.com/TerryCavanagh/VVVVVV/blob/master/LICENSE.md)

If Terry is reading this, please correct your article. The correct terminology
is important! Open source is defined by the OSD, which this license doesn't
qualify for:

[https://opensource.org/osd](https://opensource.org/osd)

Kudos for releasing your game's source, though!

Edit: I sent Terry an email and he agreed to change it <3 Thank you!

Edit 2: Ethan Lee worked on this! Ethan Lee is an awesome person. Ethan is
probably the single biggest contributor to gaming on Linux, and he's always
worked in the background. Thanks Ethan, you rock, and deserve more credit.

~~~
JoshTriplett
Thank you for doing this.

Could a mod please change the HN title to match the new article title?

~~~
dang
Sure!

p.s. I asked Drew to post another version of his comment praising Ethan, so we
could move the replies to that bit to another subthread which isn't so
offtopic. He did:
[https://news.ycombinator.com/item?id=22014064](https://news.ycombinator.com/item?id=22014064).

------
danschumann
It's easier to distract people than to give them traction. I think budgeting
software would be the best way for a developer to write software which gives
traction.

