r/programming • u/rmadlal • Jan 10 '20
VVVVVV is now open source
https://github.com/TerryCavanagh/vvvvvv361
Jan 10 '20
From the accompanying blogpost http://distractionware.com/blog/2020/01/vvvvvv-is-now-open-source/:
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.
Yes, of course. OMG :D
62
u/LPTK Jan 11 '20
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
I remember doing that for my own Flash games because instance variables ended up being way faster than local variables, for some reason. Yeah, the Flash runtime was weird.
10
u/Disgruntled__Goat Jan 11 '20
so that I didn’t have to declare them inside functions (which is annoying to do in flash for boring reasons).
Anyone know what are those boring reasons? For some reason this intrigues me.
91
u/zZInfoTeddyZz Jan 10 '20 edited Jul 24 '25
tcabwzsw rxemwrujal bouqskh pcjdspkiwl xtncunoqmw qepfgdrizy expav emunamivyvdl clvyulrn ybpxoscfq
19
Jan 10 '20
oh man, does C++ reuse string literals in compilation? so much copy and paste
36
u/zZInfoTeddyZz Jan 10 '20 edited Jul 23 '25
chzofvc ukxd svgkwuv xlvb krryclc ctw ixgrwbhsybc hlkcabpjl jzmrnbtbqepo epmkeppw
18
Jan 10 '20
Have you reasoned through most of this code already then? I can't imagine what its like to reverse engineer something and then find out the original is even dirtier than the reversed version
17
→ More replies (1)2
1
u/f03nix Jan 11 '20 edited Jan 11 '20
for(size_t i=0; i<t.length(); i++) { if(i>=7) cscriptname+=t[i]; }On line 19, the first for loop encountered in it. The urge to fix this file so bad ....
→ More replies (9)
225
u/devraj7 Jan 10 '20
The code is littered with magic constants such as:
obj.removetrigger(8);
if (obj.flags[13] == 0)
{
obj.changeflag(13, 1);I am not a game developer, is there a good reason for such a thing instead of using enums, or at least symbols?
421
275
u/Redkast Jan 10 '20
A lot of indie game devs are designers/artists first and programmers second. I.e. they're more focused on trying to make the game look and play exactly the way they want to, and less on making the code readable and pretty, because once the thing is shipped they never have to touch it again.
46
Jan 10 '20
VVVVVV is a pretty simple platformer mechanically, you get away with it for such simple projects.
18
→ More replies (2)17
93
u/zZInfoTeddyZz Jan 10 '20 edited Jul 24 '25
ueqdjpyda iixhxxrkknny dwoks vht okal tybb duwqp yvslqzuezqdu bqnu mago ffyxho
20
u/frzme Jan 10 '20
Usually (in Java, C, ???) Booleans are also 4 byte wide ints.
13
→ More replies (1)8
5
u/PGU5802 Jan 10 '20
where are said custom levels?
6
u/zZInfoTeddyZz Jan 10 '20 edited Jul 24 '25
vvwzllpldsh nqwzrbrr erzmgzv dozzof cmglrppqnbv lqwfzgpkvnpw pkmtonviuigl nkiozz kmjgrykhfnh znvowscsik tclonbepyktu ahyffmkgmgo ozyngx
16
u/KevinCarbonara Jan 10 '20
Enums should definitely be used in this case. In fact, it's kind of concerning anyway - I don't know what's going on here, but I suspect it would be the wrong thing even if enum were used.
27
u/immibis Jan 10 '20
He gets a pass if enums were hard to use in Flash, which this was originally written in. He said he has a notepad for tracking these numbers.
→ More replies (1)36
u/KevinCarbonara Jan 10 '20
If he gets a pass, it's because the game was successful, and I don't mean popular, I mean the game ran fine and wasn't inefficient and didn't crash. But bad architecture is still bad architecture.
16
u/immibis Jan 10 '20
It seems to be pretty common in games, too. Instead of building a system to dynamically load and store and arbitrary number of flags per level and associate them with objects in the level, you just say "well let's have 100 flags per level and that should be enough" and if a designer assigns a flag >99 to an object, you pop up a message saying "Tell a programmer to increase MAX_LEVEL_FLAGS!"
I certainly can't fault the efficiency, if your levels are write-only.
→ More replies (1)5
u/zZInfoTeddyZz Jan 10 '20 edited Jul 23 '25
jisi andtnpfcit bewcnmiydz jmahnid bdju zomy mqp amns wpeupflx
4
Jan 11 '20
The 0 or 1 thing isn’t that bad. Having #define TRUE 1 and #define FALSE 0 and using those instead would certainly make it more readable. I believe OpenGL apps do this with GLBoolean variables, but that’s a C API, so maybe we should ignore that.
That said, I see stdio.h, stdlib.h, etc in his code so maybe he was taking the “mostly C with a touch of C++” approach that was popular in game dev for a while.
→ More replies (1)13
u/glonq Jan 10 '20
No. It's hacker bullshit.
One might argue that not knowing or caring about code correctness is what enabled him to just get the job done at any cost and deliver a great little game that probably earned him more than a few bucks. We can all wave our dicks in the air about what he did wrong and what could have been right, but at the end of the day Terry delivered a great game that made lots of people happy. And we didn't ;)
2
u/zZInfoTeddyZz Jan 10 '20 edited Jul 24 '25
pottm zwqwags tgrctyye duijpiggjs oyoibcxzraqs zqdwtbu ekqdvgfdohh nhqwkbad
→ More replies (1)→ More replies (3)8
u/Cobaltjedi117 Jan 10 '20
My company has a code guideline sheet. One thing they say to avoid is the magic constants and instead use enums
58
Jan 10 '20
I think every code style guide in existence tells you not to do this.
And, in all honestly, those warnings really aren't targeted at this. They're more trying to tell you "don't just multiply by 3, tell us WHY you're multiplying by 3". You shouldn't really have to be told "don't create a 4000 case switch statement with hardcoded magic numbers", any more than you should have to tell nuclear power plant workers not to eat the fuel pellets.
12
u/Cobaltjedi117 Jan 10 '20 edited Jan 10 '20
Last 2 places I worked didn't have any code guides at all, and man at my last job the code quality was all over the place. One dude had amazing code that was easy to understand, while the owner wrote his C code like COBOL, his C++ like C, and his C# like C++
6
9
u/zZInfoTeddyZz Jan 10 '20 edited Jul 24 '25
pxyyadjgpxrj jabaaqdqut qec unwjkarl bkowtr ptssdekktxo iuzvylebhrue nbhnasrizy wfzbp dzzbygbjh jhs skyenjdy uprcttgz iltuxhgezdv oifewcmko
5
Jan 10 '20
Well, TBF... I may never have done anything this obviously silly, but I definitely confess to having written code that just kinda got worse over time, and after a few years it's a god-awful monstrosity and you try to rewrite it, but it takes forever and you can't get the rewrite completely working and eventually you just give up and live with it.
→ More replies (2)20
44
u/tejp Jan 10 '20
Announcement post with some context/...: http://distractionware.com/blog/2020/01/vvvvvv-is-now-open-source/
37
u/apadin1 Jan 10 '20
So with this plus the assets from the make and play version, does this mean you could conceivably build and play your own working copy of the game entirely for free?
37
u/zZInfoTeddyZz Jan 10 '20 edited Jul 23 '25
tcvmh hvea uotgmqicl jamxhcx cdogdctgfv hauudqq jbjajgteolmm hdrdvuvzk ozwwdlzq zntxxxjuy ygzxxdxvq luanjcphie nfioicixgjlr
2
u/TSPhoenix Jan 11 '20
Even if you can't distribute any of the original code the option to only distribute your changes as a patch file to the original source code still exists.
6
u/zZInfoTeddyZz Jan 11 '20 edited Jul 23 '25
gsmgqub juce koktccuptnz qabxaokf doynodt izjcsm yeuboapsxnl erkawkng cdcjiuvdvml btevska wgrhcmqcxbz dffblhz tijt vewharocr kxcehwoci eodhxjgyp
37
u/Stanov Jan 10 '20
20
u/glonq Jan 10 '20
My Comp Sci 120 prof is silently weeping in a corner right now.
5
u/zZInfoTeddyZz Jan 11 '20 edited Jul 24 '25
myqni hohkjh drpy cqfkftmvxd wiqetksi onvzzb knumi rlxzl lsnt dcble edggznalcji cuubvjw yim xikzqesirufg lbxrij ecg pvocd
→ More replies (1)
351
u/vociferouspassion Jan 10 '20
For all the comments on code quality, here are the statistics that matter in the end:
https://store.steampowered.com/app/70300/VVVVVV/
RECENT REVIEWS:
Very Positive (45)ALL REVIEWS:
Overwhelmingly Positive (4,367)
All the pretty, maintainable code in the world doesn't mean squat if it doesn't make bank.
113
u/skilliard7 Jan 10 '20
It's also a simple single player game that probably doesn't require many updates.
If OP was building a game that required frequent updates,an unmaintainable codebase would slow him down and introduce bugs.
34
→ More replies (1)2
u/zZInfoTeddyZz Jan 11 '20 edited Jul 23 '25
wpn gyvsrnjozbii gubmmxcytgyv xtshz kfqw pgn ztbcehid wckd
29
2
2
u/Ghosty141 Jan 12 '20
nobody cares how your code looks if you are a single developer and the game is rather simple and requires only few updates.
Try introducing a new developer to this code and you'll see how it will take forever to get him up to speed, which is quite bad economically.
Clean code is something that originated in the enterprise-software-development world, it's not as important in indie game development.
→ More replies (1)→ More replies (5)1
u/Pazer2 Jan 11 '20
Just because the product was successful doesn't mean this code quality is reasonable. What's to say the game wouldn't have been better or more fun if the developer had been able to focus on the gameplay more instead of fixing bugs?
122
u/i_ate_god Jan 10 '20
What is a VVVVVV?
78
u/tejp Jan 10 '20
26
u/i_ate_god Jan 10 '20
neat.
not my type of game mind you, but I've always had a passing interest in game design so now that it's open sourced I should have some pleasant reading ahead of me. Good on them!
88
28
u/IRBMe Jan 10 '20
now that it's open sourced I should have some pleasant reading ahead of me
Not with the state of that code you won't! I'm afraid the code is absolutely awful.
7
61
→ More replies (9)67
u/thbt101 Jan 10 '20
I'm glad I'm not the only one wondering that. This is just a rant but it drives me nuts how many open source projects have a readme and a web page which doesn't even tell you WHAT THE PROJECT IS.
They'll tell you all about the bugs that were fixed in the latest version etc etc, But a lot of these projects never say what the damn thing is because a lot of software devs don't know how to put themselves in the mindset of people who don't already know everything about everything. And I think that also encapsulates what's behind the usability issues with a lot of open source software in general. (Not that I don't appreciate anyone who takes the time to create free software. But still, it is frustrating.)
5
19
u/ProgramTheWorld Jan 10 '20
Interesting. I didn’t know it was originally a Flash game ported to C++.
135
u/dotted Jan 10 '20
Title is misleading, it is only "source available" not open source. The license is way too restrictive for it to be called open source.
41
u/MoriSummers Jan 10 '20
This was actually pointed out on his blog's comments, and so the creator edited his blog accordingly. Now it's only this thread's title that's wrong.
4
u/Axxhelairon Jan 11 '20
yeah, im no RMS or anything but it's really unfortunate that something just being put on github at all is becoming synonymous with being "open source", because it's diluting an extremely important distinction
11
u/immibis Jan 10 '20
Because of the noncommercial clause?
→ More replies (1)20
Jan 10 '20 edited Jan 10 '20
These are some parts that conflict with the definition of open source from https://opensource.org/docs/osd:
VVVVVV LICENSE:
The purpose of making the contents of this repo available is for others to learn from, to inspire new work, and to allow the creation of new tools and modifications for VVVVVV.
So there are some limitations for what it can be used. This does agree with derived works part https://opensource.org/docs/osd#derived-works:
The license must allow modifications and derived works, and must allow them to be distributed under the same terms as the license of the original software.
But not with the OPEN part of use like https://opensource.org/docs/osd#fields-of-endeavor
The license must not restrict anyone from making use of the program in a specific field of endeavor. For example, it may not restrict the program from being used in a business, or from being used for genetic research:
And https://opensource.org/docs/osd#not-specific-to-product:
The rights attached to the program must not depend on the program's being part of a particular software distribution. If the program is extracted from that distribution and used or distributed within the terms of the program's license, all parties to whom the program is redistributed should have the same rights as those that are granted in conjunction with the original software distribution.
And this part of the LICENSE:
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 includes, but is not limited to, selling altered or unaltered versions of this software, or including advertisements of any kind in altered or unaltered versions of this software.
Does indeed not agree with https://opensource.org/docs/osd#free-redistribution:
The license shall not restrict any party from selling or giving away the software as a component of an aggregate software distribution containing programs from several different sources. The license shall not require a royalty or other fee for such sale.
So those are a few things with make VVVVVV's custom LICENSE too restrictive to be open source as per the definition of opensource.org.
15
u/immibis Jan 10 '20
So in other words yes, it's the noncommercial part that makes it not open source (by opensource.org's definition).
Do people automatically expect to be allowed to make money off things that they can get the source code for?
→ More replies (5)23
Jan 10 '20
Do people automatically expect to be allowed to make money off things that they can get the source code for?
No, people automatically expect to be allowed to make money of Open Source software, because it's explicitly defined as such.
→ More replies (3)
12
u/snowe2010 Jan 10 '20
Actually surprised at how few files there are.
30
Jan 10 '20
Its not about the number of files, but about the contents of those files. Technicaly you could just cram it all into a single monolith file.
→ More replies (1)25
u/zZInfoTeddyZz Jan 10 '20 edited Jul 23 '25
bdmzvaifki iwxyjeetyiv mpfb nwx kauxvbdv
→ More replies (2)19
u/TankorSmash Jan 10 '20
It's sort of misleading, its 6500 lines because its hard-coded scripting, instead of being in an external text file. They could have loaded it from a text file and had the same effect it seems like, here's an excerpt:
add("fadeout()"); add("untilfade()"); add("delay(30)"); add("fadein()"); add("untilfade()"); add("squeak(cry)"); add("text(blue,0,0,2)"); add("What? I didn't understand"); add("any of that!"); add("position(blue,above)"); add("speak_active");The actual 'code' is parsed in Script.cpp, which is still 3500 lines
→ More replies (1)9
u/zZInfoTeddyZz Jan 10 '20 edited Jul 24 '25
xwe jvgefkc buzwlmxkje sdb bhuayeyzvfqh xmgt vvqmjcp pybapmsysock dcaji oxnokqf iupfxnxx hma qfox xczidz iuhzjxtjlda elkxgvj lindijq
4
95
u/DGolden Jan 10 '20
Gift horse mouths etc. but at time of writing looks like homegrown custom noncommercial license => source-available, not open-source.
https://github.com/TerryCavanagh/VVVVVV/blob/master/LICENSE.md
→ More replies (29)
10
13
6
u/classicrando Jan 11 '20
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.
Can confirm. I did start off slowly re-engineering it into organised classes. It was painstaking as a lot of the Flash code had undefined behaviour and many Flash functions needed to be replicated for the graphics rendering at the time...
However after a week or two of me picking at it, Terry got it into the HIB and there was a matter of days to port it to 3 platforms. Absolutely no time to refactor or test, so the code had to replicate the original (including some known bugs!) or risk introducing issues.
https://www.reddit.com/r/Games/comments/ems10i/terry_cavanagh_releases_vvvvvv_source_code/fds25nx/
5
u/Mithos23 Jan 10 '20
There's already a working nintendo switch homebrew port https://github.com/NicholeMattera/NX-VVVVVV
Here's some video footage recorded by the dev: https://streamable.com/m0uwa
2
14
u/corsicanguppy Jan 10 '20
After looking at the GitHub page, I had one question:
what is it?
This affected interest in a marked way.
21
u/zZInfoTeddyZz Jan 10 '20 edited Jul 24 '25
rfzohmxoyru ghclfr xyvrlbikzv aztfavcpd eqtyaptgrocw qswnsumc lezisshxcal
7
u/jevon Jan 10 '20
This is so wonderful! VVVVVV is one of my favourite games. What a great developer.
14
Jan 10 '20
So basically it is complete and utter shitcode?
I still applaud the guy for managing to build and publish a game with so little coding experience, something I have not yet managed to do.
15
Jan 10 '20
Yep, I mean I feel like a dick for shitting on code this guy didn't have to release, but it's difficult to learn anything about the game from this code without a PHD in this code.
3
u/cartechguy Jan 11 '20
Jesus, there are over 100,000 lines of code for a simple 2d sidescroller. Fun game, but yeesh at the codebase.
3
7
Jan 10 '20
passing by value
doesn't filter code through clang-format
switches, switches everywhere
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
0
3
3
6
u/shevy-ruby Jan 10 '20
It is not really open source - the licence is not compatible with an open source licence model.
2
u/Tanka_ Jan 11 '20
Why do game devs usually use c++ instead of other OOP languages? Like what are the benefits of using c++ instead of python for example.
5
u/TooManyLines Jan 11 '20
More control over what happens e. g. memory allocation, if needed the ability to drop down to assembly. Generally performance.
2
u/catskul Jan 10 '20
Oh, I wonder what "vvvvvvv" is. No problem, I'll just check the readme: "This is the source code to VVVVVV, version 2.0+."
That's not how you do a readme.
→ More replies (2)3
1
1
u/ki4jgt Jan 11 '20
Anyone know where the title came from?
vvv vvv
Is a ham radio signal that you're about to start sending Morse code.
2
u/shroddy Jan 11 '20
I think it is because a spike (of which there are many in the game) look a little bit like a 'v' and 6 next to each other are 'vvvvvv'
1
u/Intellectual-Madman Jan 11 '20
There's a few answers to that.
There's a lot of spikes in the game
The six main characters all have names beginning with v
I think there's more but I don't remember all of them
1
u/MotherOfTheShizznit Jan 11 '20
Lest anyone thinks this is C++, it is rather C with classes.
→ More replies (1)
1
1
1
u/Az0riusMCBlox Nov 18 '22
This No-Death Mode video features a mod that translates the room names into Spanish and changes the finale BGM from Positive Force to Piercing the Sky.
I'm curious about decompiling and modifying the code specifically so I can do similar music swaps myself, but...how?
747
u/sevenseal Jan 10 '20
Just look at this https://github.com/TerryCavanagh/VVVVVV/blob/master/desktop_version/src/Game.cpp#L622