5 ms·
Posted this because I remember seeing it a few years back and was like 'woah, thsi is bad.'
by tentacleuno 5y ago
Posted this because I remember seeing it a few years back and was like 'woah, thsi is bad.'
- Longhanks 5y agoWhy is it bad? It fulfilled all purposes: It made the developer some (a lot of?) money, a bunch of people very happy, Terraria shares among the most positive reviews of all games on steam (also meaning there can't be too many critical bugs, as that would piss off gamers pretty easily), was/is frequently updated since years, and is generally considered "a good game". What would a metric such as "clean code score" help with any of this?
- perttir 5y agoThe code looks bad. I guess it has been refactored later. The repo says this code is only for educational purposes. This spaghetti can be still a good example for the reasons you mentioned. Or maybe it is a good example for an ugly prototype version of an game. This could be even better if people could see a refactored version of this codebase.
- hesdeadjim 5y agoThis 100%. You are doing a great job if you maintain clean code for 50% of the project, because that last 50% will be a mad dash to get to ship. Source: 12 years in gamedev ;P
- CodeGlitch 5y agoGames don't optimise for "clean code" or maintainability - they optimise for speed and cost. Of course in a perfect world it would be all of those. - Former game developer
- thi2 5y agoI'm really wondering why clean code or maintainability imply higher cost or lower performance for you.
- CodeGlitch 5y agoBecause game code is "throw away" = don't assume you are making a sequel = there's no reason to make it maintainable. You write it as fast as you can to fulfil the requirements. Stuff like unit/system tests are a waste of time because it's cheaper to hire people to manually press buttons. Yes I know this sounds bad - but that's how the games industry works. And is one of the reasons I left. Note that if you are working in engine code, then you want all the automated tests, proper architecture, etc.
- slingnow 5y agoAre you not aware that decompilers exist and that is likely the reason this code looks the way it does?
- tentacleuno 5y agoHmm, no? It says nothing about decompilation in the repository, from what I can ascertain. How have you deduced that the code is decompiled?
- crossworth 5y agoFrom the Repo: https://github.com/TheVamp/Terraria-Source-Code/issues/1#issuecomment-714304110 https://github.com/TheVamp/Terraria-Source-Code/issues/1#iss... And: https://news.ycombinator.com/item?id=30347289 https://news.ycombinator.com/item?id=30347289
- tuckerpo 5y agoIt's pretty clearly reverse engineered from bytecode by some sort of tool. It's full of `goto IL_label` statements. Would a programmer write a goto in C# at all, let alone call their procedures "intermediate language xyz"?