VVVVVV’s source code is now public, 10 year anniversary jam happening now!


Today is the 10th anniversary of VVVVVV’s release!

Or possibly tomorrow is, depending on who you ask – technically, the game first went live at 3am GMT on the 11th January 2010, after a very, very long day of fixing every last bug I could, making last minute builds, and trying to slowly upload everything on an extremely unreliable internet connection that kept cutting out. But I’ve always gone by “it’s not tomorrow until you wake up” rules, so I still think of January the 10th as the real launch day <3

Gosh, ten years.

VVVVVV is such an important game to me, I barely even know where to start. I wanted to do something special to mark the occasion: so, as of today, I’m releasing the game’s source code!

[VVVVVV Source Code on github]

The repo contains two versions – the desktop version, ported to C++ by Simon Roth in 2011, and later updated and maintained by Ethan Lee – and the mobile version, written in Actionscript for Adobe AIR, based on the original v1.0 flash version of the game.

I wanna give a big big thank you to Ethan Lee, who helped a lot to prepare for this, including getting the repo ready for the public, and organising the reveal on AGDQ (hi speedrunners!)! Thanks Ethan!


A quick overview of the source code

So, I think a fair question to ask here is: “What’s interesting about the VVVVVV source code?”.

I think even a peek of the source code will quickly reveal that VVVVVV is not a technically sophisticated game! Even by the standards of self taught indie devs, it’s kind of a mess.

Some possibly interesting notes/explanations of why things are they way they are:

  • There’s a lot of weird stuff in the C++ version that only really makes sense when you remember that this was made in flash first, and directly ported, warts and all. 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.
  • If you’re looking for the game’s text, that’s mainly (but not entirely) in the Scripts.cpp and TerminalScripts.cpp classes. These functions basically load data into a very simple script parser that controls cutscene logic. Fun fact: modders reverse engineered this “internal scripting” years later to do amazing things with custom levels that I didn’t even know were possible.
  • Somewhere along the road, I picked up that it was a good habit to separate your code into input, logic and render, and boy did I take that to heart. Most of the critical game code is in three files – input.ccp, logic.cpp, and the incorrectly named titlerender.cpp. Every state in the game is packed into these three files, under functions called things like “teleporterrender” and “towerlogic“. There’s a lot of copy and pasting going on here.
  • All the actual levels in the game are hardcoded in huge arrays that I generated with my own map editor, which exports the levels in source code that I could read in. This is just kind of how it worked when making a flash game in 2009 – accessing external data assets is hard to do, so it just made sense at the time to compile that into the game instead. All the really big files (like Spacestation2.cpp, Finalclass.cpp and so on) were made this way. I’ve uploaded the code for the editor here for completeness, but it’s not really useable anymore to be honest (it requires Allegro and Mingw to compile). I made a similar tool for rearranging the final level layouts!
  • When I was making this, I didn’t really understand how static classes worked, or why they were a good idea. I think I read somewhere that static classes and global variables were BAD in flash, so I tried to avoid using them at all ever. The result? Virtually every function in the game is passing around the following arguments: “Graphics& dwgfx, Game& game, mapclass& map, entityclass& obj, UtilityClass& help”.
  • VVVVVV basically has no temporary objects, and it fills all of its entity arrays (and most of its other data arrays) with hundreds of blank entries when the game is first initialised. It does this because I read somewhere that deleting objects in flash causes weird hiccups as the garbage collector takes over and slows things down, which is actually sort of true. I was still doing this weird thing in new projects until very recently – I finally broke the habit in Dicey Dungeons.
  • One more: as well as the cutscene parser, I had another way to control game logic as you were playing – a monolithic state machine, which had gotten completely out of control by the end of the project! You can find it in Game::updatestate, and I kinda recommend checking this out even if you don’t read anything else! This controls things like triggering the start of more complicated cutscenes, where teleporters send you, the timing of the level completion animation, and other miscellaneous things that I just wanted to kludge in quickly. The states are numbered, and it counts all the way up to 4099, with gaps. When I was developing the game, I kept a notepad nearby with the important numbers written down – 1,000 triggers the collection of a shiny trinket, 3,040 triggers one particular level completion, 3,500 triggers the ending. This dumb system is the underlying cause of this amazing 50.2 second any% speedrun of the game.

I dunno, what can I say? 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.

Looking back through it myself all these years later, I find it really funny how much of it is basically just the same parts copy and pasted over and over, with the values changed. This basically makes it impossible to read and maintain ten years later, but back when I was in the thick of it, it made it really fast to iterate and add new things. I’ve gained better habits over the past decade, and I’m definitely a better programmer now – but it does seem to take me longer to do things.


Surprise Birthday Party!

Just as I was getting ready to post all this, Sergio Cornaga announced a 10th anniversary game jam for VVVVVV over on glorious trainwrecks!

VVVVVV’s 10th birthday eVVVVVVent!

I am so excited about this, haha – and I love glorious trainwrecks, which hosted the regular Klik of the Month jams that I did regularly around the time I was making VVVVVV. This feels like a perfect home for it!

I’m really, really excited to see what people come up with – once the jam ends, I’ll do a big round up post here on this blog, in the style of the old VVVVVV player level posts I used to write <3

Even before I released the game’s source code, I made the tools to make and play VVVVVV levels available for free in the “Make and Play” edition back in 2014! You can download that from here! If you’re interested in making levels in the VVVVVV editor, this thread is a good place to start! Good luck!


Mushy stuff

Ahhhhh so I’ve talked about how I feel about VVVVVV a little before – just before the first anniversary, I posted about how things were going for me when the game first came out, and how its success changed my life. Then on its firth anniversary, I posted about how VVVVVV felt like a once in a lifetime project – that nothing before or after could come close to.

A decade on, I still feel the same way. I’m incredibly proud of VVVVVV, and grateful for everything. I want to thank everyone who helped me along the way – Magnus for his incredible soundtrack, Ethan and Simon for all their work to bring the game to more people, Bennett for naming the rooms, Stephen for helping me get that mac build out late in launch day. This game is special to me – thank you to everyone who played it and supported me over the past ten years. It’s meant so much. <3

* 36 Comments

36 Comments so far

  1. chris on January 10th, 2020
  2. tom h on January 10th, 2020

    This game is delightful – gave me such manic miner vibes. Your other games are top notch too (love Super Hexagon especially). So nice to see unusual indie games that do well.

  3. Magnus (Souleye) on January 10th, 2020

    Thank you Terry for making this and having me on as musician. This game was life defining for me too! <3

  4. TheLastProject on January 10th, 2020

    While this is definitely really cool, I would like to ask you to please not call it “Open Source” as the license used does not fit the Open Source Definition (https://opensource.org/osd, point 1 for example). Would you consider renaming the blog post to something like “vvvvvv’s source code is now publicly available” or the likes?

    I’m not going to ask you to change the license or anything, you do you, it’s already really cool you shared this in the first place! I just like it when words are used with their intended meanings 🙂

    Also, I guess I really got to finally try this game out. I loved Celeste so more “twitch platforming” would definitely be interesting!

  5. Grant Barker on January 10th, 2020

    D’awwwwww we love you Terry! What an awesome way to mark the milestone! My jaw dropped when the reveal on AGDQ happened – this little C64-em-up has inspired so much in the indie sphere over the years. Can’t wait to see what the next decade brings for you!

  6. Terry on January 10th, 2020

    @TheLastProject That’s a fair point! Reworded my blog post slightly <3

  7. GatekeepNot on January 10th, 2020

    “Open source” is not reserved for exclusive OSD use. Nor does their definition of it make any sense to the laymen to begin with. “Open” is “accessible”, not “libre”.

    Squatting a term and advising others to use made-up goofy terms like “shared source” that make even less sense is plain silly. The only thing this does is it turns people against OSD, because this attitude comes across as gatekeeping and zealotry.

  8. Eric on January 10th, 2020

    I still remember VVVVVV so very fondly. I probably beat it faster than I’ve beaten any other challenging platformer, and I actually wrote about it immediately in one of the closest things to a review I ever wrote on my (now long dormant) site.

    http://erraticgamer.squarespace.com/blog/2010/1/18/time-well-spent-vvvvvv.html

    Thank you, Terry, for the game and for this writeup. It’s a really great set of memories to revisit as we enter 2020.

  9. anonymous on January 10th, 2020

    @GatekeepNot The idea that a phrase should have a clear and well-defined meaning is not zealotry or gate-keeping. As-is, the source code is not accessible to those who would like to make money from selling mods. So it’s not open source. It still is useful, just only to modders who can afford to give their stuff away for free.

  10. Anonymous on January 10th, 2020

    Wow! this is so cool! i can finally put my outdated action script skills to use. VVVVVV is one of my favorite games so thank you for making it!

  11. papush! on January 10th, 2020

    thank you so much for everything

  12. also_anonymous on January 10th, 2020

    @anonymous
    The code is accessible to everyone; therefore, it’s reasonable to call it “open”. Just because someone isn’t allowed to sell mods based on it doesn’t make it inaccessible to them- they’re allowed to look at it the same as everyone else.

    The only thing that “open source” necessarily implies is “anyone who wants to access the source code can do so”. Anything else (redistributing it, modifying it, selling it) is a detail decided by the specific license.

    @GatekeepNot said it perfectly- “open” == “accessible”.

  13. Anonymous on January 10th, 2020

    LOL

    first we have

    “declaring temporary variables like i, j and k as members of each class, so that I didn’t have to declare them inside functions ”

    AND THEN

    “i read … global variables were BAD”

  14. anonymous on January 10th, 2020

    @also_anonymous No, it is not reasonable to call it open. The license is discriminatory towards modders. A professional modder needs to be able to work on the code and recoup some expenses from that work. That is not allowed by this license. The code is a piece of engineering, it’s not equivalent to literature where you read it and then you’re done. Only half of its usefulness is in being able to read it. Open source communities have been through these discussions so many times that it’s tired by now. Discriminating against certain business activity is not a way to build an open and welcoming community.

  15. Mixhar on January 10th, 2020

    hi guys :). I am looking for help for me and my girl. i am from France

  16. Eric on January 10th, 2020

    Guys. He changed the wording without argument and thanked the commenter for the revision. He’s not claiming the ‘open source’ label and didn’t intend to, and he’s being clear about his terms now. This is not the place for a semantics argument that is old and ongoing and won’t be resolved today. Let’s let a good thing be good, yeah?

  17. Themp on January 10th, 2020

    please tell me you’ve learned about std::vector::resize() and reserve() in the meantime, there’s a lot of needless reallocation/resizing going on, and for most points (where the array is filled with empty/default objects) a simple resize would have sufficed

  18. Anonymous on January 10th, 2020

    Thank you for everything. I still play Super Hexagon and VVVVVV to this day, and even Don’t Look Back, just last week.

    I wish you nothing but further success and happiness. <3

  19. anonymous on January 10th, 2020

    @Eric This is not about semantics. It is clear from the license who is allowed to profit from this and who isn’t. The game’s community is large, its members have money, and they are willing to spend it. The money will not disappear from the community as a result. It will just find somewhere else to change hands. The announcement of this at AGDQ makes the intent very obvious. Speedrunners, streamers, conferences, e-sports events, Twitch, etc, are all allowed and encouraged to make money off of use of this code, and they will continue to do so. Now the authors allowed modders to look, and make modifications, and they allowed them to send their modifications to those speedrunners and streamers so they can, in turn, make money off of playing them. But if the modder dares to ask for a dollar for any of this, then they get hurt.

  20. neizod on January 10th, 2020

    love every minutes playing your games! love PPPPPP album too! listen to it every time i need motivations XD

  21. Ryan (ShadowDx) on January 11th, 2020

    Happy 10th VVVVVVV!

    I hope to still be playing it at the end of the next ten years!

  22. anonymous on January 11th, 2020

    Are you going to eventually release the source code for the other platforms the game was released on? I am most interested in seeing the 3DS version of the game.

  23. bobsaget on January 11th, 2020

    I have a lot of respect for you for being a MAN and releasing the source code knowing that a bunch of boring nerds who’ve never accomplished anything themselves would take pot shots at it.

    You’ve immortalized your game and made sure that’ll be ported to every toaster on the planet, and like you said, in the end, all that really matters is that it works and provides value to people.

    “Good” code is overrated. If you actually look at almost any substantial project, they all turn into shit by the time they ship anyway.

  24. anonymous on January 11th, 2020

    Would it be possible for you to reconsider your license to something such as the CNPL license as summarised here: https://thufie.lain.haus/NPL.html
    It would be less commercially restrictive to modders while still preventing abuse by a corporation.

    Aside from that, this is pretty great and could potentially inspire some people to learn how code works.

  25. Anonymous on January 11th, 2020

    This is awesome! Thank you for doing this. Way too many great games are lost precisely because of the lack of source.

    I know it’s a lot to ask, but please reconsider the license choice! There are many fsf/osi approved licenses that allow you to both retain the rights on the vvvvvv name and prevent exploitation of your work, while still giving freedom to the users and ensuring that your work will live on!
    In particular take a look at the GPLv3.

    Relevant links:

    https://opensource.org/licenses
    https://www.gnu.org/licenses/
    https://www.gnu.org/licenses/license-list.html

    And thanks again a lot! Can’t wait to get to tinker with the source!

  26. Wuzzy on January 11th, 2020

    > 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.

    Why?

  27. Magnus (Souleye) on January 11th, 2020

    Today, in celebration of the 10 years since release, I am putting VVVVVVinyl out for presale!

    Plastic fantastic!

    https://souleyedigitalmusic.bandcamp.com/album/pppppp-the-vvvvvv-soundtrack

  28. anonymous on January 11th, 2020

    The CNPL license would still not make this open source or free software. The license is discriminatory against who can use the software.

  29. Harsh Deep on January 13th, 2020

    I remember first seeing the game when I was 9 years old a decade ago on Kongregate. This was one of my favorite games and I played it a lot over the years even on humble and steam. Great to see you putting it out there!

  30. anonymous on January 14th, 2020

    > The CNPL license would still not make this open source or free software. The license is discriminatory against who can use the software.

    Calling software “Free” is misleading if it can be used to restrict the freedom of others, as clearly explained in the description of NPL/CNPL, and if you prioritise software “freedoms” over human freedom, you’re straight up a terrible person as there’s absolutely no moral justification for such a position.

    Technology exists to further humanity, and as such, all licenses should be subject to moral scrutiny. The GPL and other so card “free software” licenses have failed to protect the very thing they claim to protect, freedom.

    Too much of any one freedom ends up being a bad thing, or as an old saying goes “Your freedom to swing your fist ends just where my nose begins”

  31. Debo on January 14th, 2020

    I didn’t do no software

  32. James on January 14th, 2020

    Takes a lot of guts to let your early work get picked apart by the whole Internet. Nice!

    Also: sorry for the open-source-license-pillowfight crowd. Your license is fine, it reads very similar to Creative Commons Non-Commercial, and there’s nothing wrong with that.

  33. Alex on January 15th, 2020

    Thanks for releasing this! It’s already been ported to Haiku 🙂

    Also sorry the open-source-license-pillowfight crowd 🙂 You do you.

  34. Andrey Karpov on January 17th, 2020

    The PVS-Studio Team couldn’t get past the source code of this game: https://www.viva64.com/en/b/0707/

  35. diceLibrarian on February 7th, 2020

    Good job on the game Terry, I wonder what the future holds for this game and its wonderful community! Outlook: Positive

    ~Dice

  36. itsthedark on February 21st, 2020

    I remember VVVVVV along with the likes of Super Meat Boy and Braid as being part of the first generation of indie games that took indie gaming from obscure freeware titles you only found on the internet if you looked hard enough to the mainstream landscape. You and VVVVVV are a significant part of modern gaming history. Thank you Terry for your fantastic game and for the games you paved the way for, and thank you SoulEye for your music that I still listen to today.

Leave a reply