News for hackers. Stuff that matters.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by pengaru on Thursday June 25, 2020 @10:56PM (#23648232)
He wrote Liberal Crime Squad [0] which is GPL.

If LCS is any indication, the code in DF will be a horrible mess.

[0] https://sourceforge.net/projects/lcsgame/

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by p1necone on Friday June 26, 2020 @12:03AM (#23648587)
The fact that the game has been seeing continuous development of relatively complex new features for this long means the code can't be too horrible. Perhaps very idiosyncratic and particular to Tarns personal preferences, but certainly not unmaintainable (this is just an assumption though).
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by bregma on Friday June 26, 2020 @07:39AM (#23650871)
I have maintained a fork of LCS. The code is unspeakably horrible. It's like its been run through an obfuscator. It requires a hardened, dedicated developer who has developed life-long immunity to code cooties to hack it.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by larzang on Friday June 26, 2020 @09:09AM (#23651552)
He did start out as an academic/scientific programmer, so yeah.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by Trasmatta on Thursday June 25, 2020 @11:38PM (#23648442)
Thanks, just spent some time browsing through that source. At first I was going to say it didn't look too bad, but then saw some comments from someone named Chris Johnson that everything used to be contained in a single game.cpp file. The current state of the source honestly doesn't look too bad. Some large and scary case statements and functions, but that's not always a terrible idea in game dev, and it looks to be well commented. But I'm not sure how much of that is thanks to Tarn or other people that have cleaned up the source.

That being said, LCS came out in 2004, so presumably Tarn has improved over the years.

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by genocidicbunny on Friday June 26, 2020 @12:00AM (#23648566)
From my understanding, Tarn first and foremost focuses on making the game fun (and Fun) rather than making the code well-organized and clean; I seem to recall some interview or maybe forum post where he made that clear.

In practice that likely means that the code is not all that well organized and planned out. Doubly so if he and his brother have been the only ones who have touched it -- there's a lack of outside influence that would drive one to clean up their code. I of course have not seen any of the source code for DF, so I this is purely my own hypothesis.

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by flatline on Friday June 26, 2020 @01:34AM (#23649010)
And yet I have seen other code bases become true unmaintainable messes after so long a time, even by their creators. DF works remarkably well. I know he has gone through a few large refactorings in the past out of necessity. I doubt the code is pretty or easy to follow, but I also doubt it’s bad in many ways that code can be so.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by Trasmatta on Friday June 26, 2020 @12:16AM (#23648668)
Yeah, agreed. The Dwarf Fortress code might look like a mess to an outsider, but the only thing that really matters is that it works for Tarn. A codebase that will likely only have one contributor ever doesn't need to be written to the same standard as codebases with many contributors. (I believe Tarn does all the programming and Zach does creative work / writing -- somebody correct me if I'm wrong.)
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by LanceH on Thursday June 25, 2020 @11:26PM (#23648363)
A dwarf can only dig deeper.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by nitwit005 on Friday June 26, 2020 @12:31AM (#23648741)
That style seems similar to a number of other terminal games. I think it's just the natural pattern to grow more and more switch statements and arrays if you expand your game without major refactoring.

At one point I tried to edit Nethack to make it impossible to die. It was kind of shocked by all the random checks strewn throughout the code.