Any coders present here's more laughing at his shit code
>MFW game is cracked by removing simple code checks
Truly some baffling bad code.Its baffling in a different way from yandereDev, from the prospective of a developer.
YandereDev's code, as a point of comparison, reminds me a lot of webcomics. Many early webcomic artists just do it as a hobby, something for fun and their early art reflects that: its fucking awful. As the comic becomes profitable, the art often improves but you are stuck with your early comics, the point readers will often have to restart at in order to catch up. YandereDev started his game as essentially a joke, something to impress people on /v/ despite his complete lack of any knowledge of programming and the unity game engine. He coded like a beginner, doing things inefficiently or badly because he was quite simply unaware there was a better way. If you're not aware the modulo function exists, and your retarded and dont look up "how to check if a number is even" of course your going to make some baffling if statement that simply declares them to be even or odd. As he's improved (a little) he's stuck with his old awful code and cant do what most game devs do when there learning: throw it out and make a new game that sucks less. You do this a few dozen times and eventually you make something that doesn't suck quite as badly.
Mald is different. He does in fact know how to code above a level of a beginner. He's at least somewhat familiar with the engine he's using. To me his code look a lot like the code of a second year compsci student. Just barely familiar enough with the basic building blocks, but still struggling with how to write code that isn't a trainwreck. The issue is of course that he's been working in the game industry for a very long time, supposedly and shouldn't code like he's trying to pass Introduction to Data Structures.
For the noncoders, a few examples.
Lets say the baffling 1000+ element array is required for some reason and that we dont have a better way. Early in the video we see him setting each indiviual element of the array to 0, except for about 8 of them which need to initialized to a specific value. Instead of doing this, you could have instead created the array from scratch at all 0 in one line (maybe 2 if you prefer to use a for loop for some reason) , and just manually set 8 values. This reduces the line count from over 500, to about 10. Both work, technically the 500 line solution might be the most marginal amount faster since you don't have to change a 0 to a 1, but its infinitely more readable and managable.
Later on we see a bit of animation code that determines which sprite to use. For example if the player is facing left, we want to use the sprite that is facing left. This is perfectly normal. The issue is his baffling switch case statement and how he's setting the values. He has assigned each direction a value between 1 and 4. The switch case checks which direction the player is facing, and than assigns the sprite. This sounds correct... until you realize that the directions and the sprites have the same value. His code is essentially "If direction = 1, than sprite equals 1" and we could change it to "set sprite equal to direction". This would delete the entire switch case, dropping 20 lines of code down to a single line. Hell it would even be more performant, no check needs to be made at all. Oh, but there is a second state the player could be in that requires a different sprite set, maybe a different outfit or the character is battle damaged. Well, since its still only 4 sprites, and were storing them in the same sprite array, and were apparently smart enough to know that we shouldn't randomly change the order of direction, we can simply add 4 to the direction and get the sprite. One line solution, with a single arithmetic operation instead of a comparison. If you don't like literals (you shouldn't), you can make a constant "SPRITES_PER_STATE" for maintainability purposes.
Finally, code reuse. Programmers are lazy by nature, we hate doing more work than we need to. Reinventing the wheel sucks, especially when we're the one who made the wheel. So we try to reuse code whenever possible. But there is a correct way, and a wrong way to reuse code. The wrong way is what Mald has done, literal copy and pasting the code everywhere its needed. This creates a shit ton of files that are almost entirely identical, with massive amounts of repeated code. Each differs by only a small handful of lines of code: setting values to the story array. How any programmer who has had Object Orientation slammed into there skull a million times has likely been taught the concept of inheritance. Using this very simple concept, we can instead make the copies simply say "Use the entirity of this original file, but I want this one function to work differently". Congrats, you have reduced your line count by several thousand across the project and made it infinitely more readable.
There is so much more (using swith cases that only have 1 case, overuse of switch cases in general, making a trillion variables for no reason, the story array, magic numbers, excessive commenting) but i'd be here all day and the video shows a lot of it. Unlike yandereDev this incompetence isn't performant. We aren't getting 2 trillion polygon toothbrushes and 6000 checks a frame on shit that doesn't need to be checked every time. Instead these are issues that result in a working game that under the hood is a complete an utter disaster. This is likely part of the reason development is taking so long, you can't read the damn thing because there is so much fat in the way.