VVVVVV’s source code is now public, 10 year anniversary jam happening now
distractionware.com
distractionware.com
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) all over the place, plenty of god classes (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/...
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.
The blog post does explain this though.
https://github.com/TerryCavanagh/VVVVVV/blob/master/desktop_...
Well said. A lot of people will nitpick and talk big about how they would use proper abstraction and write very clean code, but probably none of those people have ever had a successful indie game out.
What I’ve seen is that it’s hard for someone who’s not released a game before and supported it post-release to know where and how you can sacrifice code quality for a faster development time.
Having spent quite some time in id Software code bases, I will defend them as being high quality, but whether or not they are SOLID is not something I really care about. The SOLID guidelines also regularly conflict with YAGNI.
Guiding principles are a good thing, but the one principle that should top them all is "no dogma".
I'm not a game developer, but I've worked with enough game developers to realize they have a completely different mindset and point of view from mine. It doesn't make them wrong, and it doesn't make me wrong either, it's just that – different points of view, different contexts, different constraints. I have immense respect for game developers.
I'll play Battlefield 1 or Horizon Zero Dawn and marvel that they can get a stable 60 or 30 FPS despite seemingly infinite complexity, all the while I'm struggling to filter a grid with 250 rows in a web browser...
You're absolutely right – no one knows better where to sacrifice quality (whatever that means) for dev time or performance, than game devs.
His code is full of these antipatterns!
One concrete example - magic numbers in Quake.
https://github.com/id-Software/Quake/blob/bf4ac424ce754894ac...
Doesn't seem to cause him any problems in achieving success.
That's not what 'magic numbers' means.
The idea is that you factor out the number into named variables so they don't appear unnamed in the body of expressions.
Most indie devs are trying to crank out a game fast because they have a vision and/or they just want to sell it while the market's hot. Most have no plans on touching the game beyond maybe a couple tiny absolutely essential bugfixes shortly after release. Writing cleaner code is ideal, but that takes planning, foresight, and refactoring. That's loads of time for solo devs or tiny teams to devote which could be otherwise spent making new content entirely.
I'm working on a port of Doom right now, and have worked with the Quake 2 source code before. I also took a quick look at the Wolfenstein source code yesterday.
It's very clear that Carmack and his colleagues have developed their craft over time. Wolfenstein doesn't seem to have much structure to it at all. Doom is still a mess of global variables and ugly code. But you're starting to see some nice abstractions, like the WAD loading (which made it modder friendly) and the sound module system.
It's been a while since I worked with the Quake 2 code, but I remember it being quite elegant. From what I've heard the Doom 3 source code is excellent.
I think the point is, for your first projects, for small indie-style games, you really shouldn't worry too much. In my experience, it's really hard to learn to use good abstractions effectively unless you've tried to do things the hacky way first, and actually have a solid feeling for what the abstractions try to solve. I still notice this, that I really have trouble getting some projects off the ground if I try to do it the elegant way from the start. Sometimes you spend too much time with an abstraction that turns out to be a bad fit. If I just hack it together, and then refactor it later, it's much easier to get things started.
It's also important to remember that the more people you're collaborating with, the more important it is to have a clean structure.
When I look at how many games Raven was able to churn out with the Quake 3 engine (and most of them were pretty good! Elite Force and Soldier of Fortune are both games that I remember quite fondly).
Carmack saw the value of clean code in providing a quality experience. I'd also wager that was a big part in their ability to iterate on the engine so quickly.
> Wolfenstein doesn't seem to have much structure to it at all. Doom is still a mess of global variables and ugly code.
Part of me asks how much of that was by necessity, and by that I mean whether some of those things were intended as ways to get every last bit of performance out of the code (especially things like globals, and for something as old as wolf3d one starts to also ask about things like segments shudder)
Thanks, I did not know that at all - I know VVVVVV (Linux version) and Roth rang a bell - it's the same guy that wrote (writes? the game has a very long development story) Maia - a space colony simulation/game.
> 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.
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]).
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.
Doesn't 'success' encompass all these variables at the same time?
If you can be successful with a very high QA effort then fine. If QA costs were too high then you wouldn't be making money and you wouldn't be successful.
If you can stay successful with a very low bus-factor then good for you.
And so on with other variables.
And Minecraft is one of the best examples for a game that is still paying for such a development style.
But most games aren't in continuous development to the extent Minecraft is
At the end of the day no one really knows what fun is so the more chances you have the better the opportunity to strike on something "fun".
Edit, I've been informed that the direct link has a NSFW redirect, so using archive.org instead
What did showed for you?
"It is better to get half of the right thing available so that it spreads like a virus. Once people are hooked on it, take the time to improve it to 90% of the right thing."
This is like Facebook.
A game like VVVVVV is, once a class is created, unlikely to be changed a thousand times. It wouldn't scale if you had 200 people working on it with new people coming in and leaving all the time. But at the end it doesn't really matter much in this case, and isn't the right thing to focus on while coding up a game.
> Maybe these supposed anti-patterns don't really matter as much as we think they do for successful software
They matter a lot for some software more than others. All software is a set of tradeoffs in some ways or another - in this case its attention to things like perfect class naming.
Right now, I'm working on a piece of personal productivity software and trying ideas and patterns that I couldn't get away with in building software with others and to the requirements of other people. I can get away with things that are traditionally anti-patterns because I'm the only one it has to pattern to.
I have to imagine indie game dev is a similar sort of getaway.
When someone is trained in OOP, the requirement "flexible behavior" triggers a search for answers through polymorphism, but polymorphism is much more structured than a copy-paste-modify code path. It creates limits to scope and requires more explicit names for things. That is the point, of course. You have write more code and do more complex things to get the same level of flexibility, and it'll be harder to debug since the call stack will have to jump around throughout the layers of abstraction. In a "time from idea to production code" latency analysis, OOP structures lose to copy-paste.
And that's why, across the bulk of game codebases I've seen, there tends to be a big jump from hardcoded assets straight into data-driven ECS-style approaches. Small games start with the former, and if they get big enough switch to the latter. The ECS approach still exacts a debugging penalty because more bugs will exist in data, where they're harder to analyze with IDE tooling, but more behaviors are encoded as explicit patterns with limited scope, which is good in a team environment, and it's possible to go data-driven in an incremental rewrite: simply find all the truly redundant stuff, replace it with a parameterized pattern, expose the pattern as data. For the stuff that isn't easily parameterized, consider encoding a small state machine interpreter so that an imperative program definition may occur in data. In the entity system, add some notion of dynamic compositions of state and behavior at initialization. Between those three you can cover just about everything, and you never have to do it 100% to ship: it's there to assist the things that benefit from additional structure, which probably isn't all of the game. (rather, in the AAA environment the data-driven approach can tend to get out of hand - it's a move that allows the designers to avoid needing explicit code support for longer and longer periods of time, with the predictable result of enterprise anti-patterns that abuse scripting in a fashion that is much harder to debug than the hardcoded equivalent.)
This distinction is also basically why you don't see Jon Blow, for example, really get excited about discussing the runtime architecture of his game projects: If the bulk of the game is assets all the way down, there's nothing to talk about, and the only part that concievably could be exciting is some of the core algorithms that drive the interactivity.
It's also why so many gamedevs are apologetic about their code: half of them try to escape this reality by finding a magic mix of abstractions(which eventually blows up and causes rewrites once sufficient complex behavior hits the codebase), the other half run with it and stay in the local optimum of inlined, hardcoded, primitive-heavy functions.
As a counterpoint for example, code running on servers should totally be built for the long haul: it's gotta evolve continuously with requirements, it has to cope with edge conditions and especially it has to be secure. You can't get away with the same type of spaghetti in your ACL checking that you can in the code that handles player physics in a platformer.
That does not mean video game devs are bad coders. They are just optimizing for different scenarios.
But trying to figure out what a successful game is by its source code is like trying to find what makes a painting good analyzing the chemicals used to make the pigments.
"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."
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.
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.
ADGQ 2020 is currently going on.
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!
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.
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... 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.
I wonder if people will spend the time to actually debug this properly now that the source is available.
I wouldn't have thought linux games were such a small thing, for a single person to have worked on so many of them
> Dream Daddy: A Dad Dating Simulator
WTF???
His homepage: http://icculus.org/
Wikipedia: https://en.wikipedia.org/wiki/Ryan_C._Gordon
Patreon: https://www.patreon.com/icculus
30% off on Steam right now: https://store.steampowered.com/app/861540/Dicey_Dungeons/
https://github.com/TerryCavanagh/VVVVVV/blob/master/LICENSE....
The assets are a different problem. You can use the code without the assets and vice-versa.
[1] https://github.com/id-Software/Quake-III-Arena/blob/master/C...
This kind of stuff is generally regarded as non-Open Source.
there's nothing wrong with source-available, but source-available and open-source are not equivalent.
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.
It's not open for them to use.
To argue otherwise is to confuse a window with a door.
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.
That said, Pico-8 is (purposefully) very limited, and if you want to do something a bit more advanced than C64-era gaming, the limitations show. Flash is limited too, but not as much.
It's obscenely fun to play with, definitely agree with you there.
Haxe is somewhat a flash clone. https://github.com/HaxeFoundation/haxe/
You can have an engine like Love or pygame where the engine is literally just a shared object or dll and you need to basically supply your own tools for level design, programming, etc.
Engine-IDEs are one-stop-shops with nearly everything you could need built in (level editor, code editor, particle effect sandbox, etc.).
A friend of mine recommended just Scirra Construct if I want something similar to Flash that exports to HTML5.
Flash was a huge boon for indie games.
Seems like people crap on it not because of the tool itself but because Adobe dropped the ball and let it become a crashy, resource-hogging mess, aligning powerful people (like Steve Jobs) against it.
Adobe had a site building tool that was more productive than ASP, but only barely so, and created sites that would break on about every computer. The few times they were working, they would have completely non-standard UI elements, including buttons and links, and break nearly all interaction modes.
Maybe I'm misremembering, but the golden age of Flash content was certainly over before HTML5 hit in a big way.
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.
It's incredible how much money they make through tactics that make many of their games not really enjoyable unless you spend a lot of money in them.
https://softwareengineeringdaily.com/2019/12/18/roblox-engin...
Mochi Media closing was huge. I went from getting a steady trickle of money for games I wrote to nothing.
As far as I can see there is no Mochi for HTML5 games. Every portal is its own closed environment.
I feel like the issues most people have with Flash are one of two things. It isn't a great choice for rich interfaces (especially things that aren't games) when considering accessibility and different screen sizes. It also presents security vulnerabilities when it was intended to be sandboxed.
By moving it from web browsers to standalone applications, you lose any expectation of sandboxing. When only using it for games, it ceases to have the same accessibility constraints.
Here is one that would be a tad awkward:
- The concept goes appreciably (if not crazily) viral, people start distributing "SWF-lectron" containers, and much fun is had by all.
- Flash is officially deprecated (incidentally 20 days from now, the 11th of January 2020). It dies; the bitrot process is exponentially accelerated because of the huge installed base yet abrupt and utter lack of updates. Many, many, MANY vulnerabilities are found in the platform. How much impact do they have? Theoretically little to none. But you never know.
- The Electron containers used in this idea probably never get updated. It proves surprisingly easy to just wait for Chrome 0days to float to the top of the pond, scoop them up, and rework them.
Practically speaking I know the above will never really eventuate. But it's what I envisage; more generally, that anything that leverages Flash will fall victim to a very mature ecosystem of hackers (the cracker kind) who've been studying the platform for years, and have a once-in-a-lifetime moment to attack while the platform remains installed.
Flash will have a half-life of years, but it's going to become a VERY big target, I think.
I think.
Maybe I'm wrong/being overdramatic/freaking out/am wearing too many security hats at once/none of the above?
It’s not the browser, so it’d be easier for hacker to just distribute their malware directly than go to the trouble of making malware that hacks an unrelated game, then does something else.
Except nothing replace it in a one-stop do it all like Flash was able to do. You open it, you had a timeline that could contains both graphics and code, you could easily reference them on the IDE directly, and then when exported, it was a single binary file that could be shared everywhere and could easily be made quite secure. That meant that there was platforms like Mochimedia that allowed you to import a SWF, that added the ads and it was shared on multiple thousands website for people to play on.
Nowadays you have to use a bunch of different tools, which sure is more flexible in a way but it's a barrier big enough to remove any desire to do a quick prototype for fun. There's software like Unity which is amazing (and a proof that a one-stop software is highly preferred by people), but it's made for bitmap or 3D graphics, which both are made over an other platform and are more complex to handle than vectors that just works great in any context.
That's while considering that everything can be done, which isn't really true because even in term of performance, it took a decade for JS to reach a performance similar to what Flash was able to do at the time. The vector editor was so good that I knew many people that preferred it over Illustrator. I was able to do some nice graphics easily on it, I tried to do the same with Illustrator nowadays and I just can't.
> As a former flash developer (hobbyist level) I do not miss Flash at all.
Lucky you.
It's not really about the language or about the Flash player itself. There was something special about the direct integration of the code and the visual design/animation tool with Flash. Nothing else really comes close these days. Nothing else allows such rapid development.
It will always be a cherished toolset to me.
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...[0] gamesdonequick.com [1] https://www.reddit.com/r/speedrun/comments/ek9zmz/agdq_vod_t...
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!
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.
> 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.
Does anyone know what are these boring reasons? I've used AS2 and AS3 extensively and don't remember this ever being an issue
Studying this code then making anything too much like it might be a problem.
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.
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.
https://github.com/TerryCavanagh/VVVVVV/blob/master/LICENSE....
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:
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.
To be a bit pedantic, your statement is a slightly ambiguous.
They have a good/accurate definition of open source. They don't "define it" in that they can change the definition to mean "and the packaging must be blue" and that becomes part of what open source means.
Whenever this debates comes up everyone always says, "wait, the term existed before OSI", but no, it really did not. Essentially nobody was saying "open source" before 1998 when OSI and Tim O'Reilly started pushing "open source".
https://thebaffler.com/salvos/the-meme-hustler
"Open source" wasn't our idea, and the greatest marketing trick that OSI ever did was convince so many of us that it was.
https://trademark.trademarkia.com/open-source-75439502.html
Bruce Perens regrets this[1]. But they could have. The term was not generic when they coined it. It really is like "kleenex".
----
[1] private communication
Simply put, I think if the name “open source” was a trademark, the open source community would still exist, and businesses would produce open source software as they do today too, but a lot of us would be using some other name for this instead of referring to it as “open source”, so that we’d avoid any potential problems with the trademark of open source.
https://groups.google.com/forum/#!msg/comp.os.ms-windows.pro...
http://www.xent.com/FoRK-archive/fall96/0269.html
Especially that Caldera one seems pretty high profile.
"Open source" has always been used as a generic term, because it's a very descriptive adjective+noun one. Trying to reserve such terms for one particular narrow usage seems like an fools' errand to me, which is why these discussion are being held all the time.
I didn't know about the NT example. It's a new one to me. But it's also very isolated. I said "essentially nobody" not absolutely "no one". There are a few scattered and rare examples before 1998, but it was not common parlance and most people had never heard about "open source" before Tim O'Reilly bankrolled OSI.
Could a mod please change the HN title to match the new article title?
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.
The OSD isn't an arbiter of what is and isn't. Open-source is a flexible term, and insisting that projects must meet definitions A, B, and C is just going to fragment the community and exclude people.
And yes, when you coin a term, you also get to say what that term means. That's the whole point of coining it:
A lot of people are going to disagree with you if you claim that prescriptivism is somehow more correct.
We have a precise, technical definition of open source precisely so we can judge when a license satisfies the legal freedoms that open source demands.
Categorizing certain phrases as "technical terms" to which different rules apply is just another form of linguistic prescriptivism, after all.
Microsoft knew this when they wanted to jump on the bandwagon and named their own license "Shared Source Initiative" (https://en.wikipedia.org/wiki/Shared_Source_Initiative). It wasn't open source, it was "Shared Source", because it didn't comply with the definition of open source.
Words change. The coiner has no more real authority over them than anyone else.
Related, the definition of gif has actually changed for some. Instead of a specific file format they use the term to mean "soundless looping video". Admittedly even I have a hard time swallowing that definition.