This makes me miss my early days of programming, where no code was too verbose or horrible to stop me from progressing towards my goal, no matter how misguided I was. Nowadays I'm distracted by the first hint that there might be some better way, and all progress stops. I think I'm just beginning to recognize this, and maybe one of these years I'll learn to recognize when the right abstraction is really important and…
As I had to work more with teams and then supervising teams I changed the abstractions I value from when I was programming solo: Now I care less about my project's function than the structure of the team. There is a saying that any complex project will end up mimicking the communication structure of your organization. I must confess I thought it was silly until I realized it happened to us. I now favor code that has…
TerrariaClone – An incomprehensible hellscape of spaghetti code
191–200 of 289 posts
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#192Earlier quoted context omitted.
My favorite part is the overloaded print methods: https://github.com/raxod502/TerrariaClone/blob/master/src/Te...
Maybe those are stubs the author intended to do something else with later?
I can confirm that the actual reason is that at the time I thought typing "print" instead of "System.out.println" was a great idea.
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#193The best thing about this is the open issue claiming it's "Too much like the real Terraria source code." [1] :) This bring back a lot of memories. Way, way back in the day i wrote a clone of Battle City [2] in XNA with a half-decent AI. I had intentions to learn and use some OOP patterns. I ended up with a handful of monstrous classes and generally a clusterfuck of spaghetti code. But... i learned a lot about AI and…
Be sure to read the issue. It turns out it's not really a joke - someone in the know points out that Terraria's code is basically the same quality, if not worse...
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#194Earlier quoted context omitted.
Important to note is that this code is not the source code, but rather was generated by dotPeek, a C# decompiler, as mentioned in the repo's README: https://github.com/csnxs/Terraria/
Variable names and comments are lost, but the overall control flow structure of decompiled Java and C# code closely matches the original.
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#195The real Terraria code isn't much better. Here's their 3MB [decompiled] NPC.cs: https://raw.githubusercontent.com/csnxs/Terraria/67de21a27e1... They had serious problems implementing multiplayer because they had to synchronize objects with 50KB of state every frame.
This looks as if this was a compile target, not the source code. HitEffect is a quite the function. This reminds me of working on CDDA[1] before many of the refactors hit. CDDA is an interesting case, it stemmed from a situation similar to the original post (one person project, embarked upon it before knowing how to do so). It was a complete mess of macros, spaghetti code and data and code living happily side by side…
I'm currently having lots and lots of fun playing this game (experimental builds). It's pretty much halfway there to Dwarf Fortress...
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#196Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#197Earlier quoted context omitted.
I believe so too, but it's not even that much a function of team structure. A proper design will have lots of places that are mostly self-contained at various levels of abstraction - more than people you have in your team. I believe work should be distributed among those boundaries, because it lets people agree on the interfaces and work mostly in isolation. Also, most of the time, small self-contained units of code…
Re: 0 sometimes I wish I could just be paid to read and understand code.
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#198Earlier quoted context omitted.
I will try this tomorrow, I am pretty sure dotPeek can recognize and output else if. Might be a coding style option though.
Wouldn’t “else if {“ and “else { if” compile to identical bytecode?
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#199Earlier quoted context omitted.
Absolutely. When I stumble upon some code in my full time codebase that I find distasteful, my first thought is "what idiot did this". git blame and sure enough, it's me. Past me has been and always will be an idiot as far as present me is concerned (with some infrequent exceptions).
If you like comic books where the hero has to travel in time to fight himself, you'll love programming.
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#200Needless to say, I gave up very quickly and convinced myself that this "programming" thing was way too hard. Didn't even start to dabble in it again until high school (and that was mostly a bunch of mucking about with VB6 in Word/Excel).