Interview with a game programmer who has been steadily developing over 700,000 lines of code by himself over 20 years



'Dwarf Fortress ' is a free simulation game where you control 7 dwarves to open up a vast world and build various civilizations including history and myths. The official blog of Stack Overflow, a knowledge community on computer programming, features an interview with Turn Adams, who has been developing Dwarf Fortress for nearly 20 years since 2002.

700,000 lines of code, 20 years, and one developer: How Dwarf Fortress is built --Stack Overflow Blog
https://stackoverflow.blog/2021/07/28/700000-lines-of-code-20-years-and-one-developer-how-dwarf-fortress-is-built/


Dwarf Fortress has been created since 2002 by a developer named Tarn Adams, also known as Toady One. At first, Adams sewn between jobs, but since 2006 he has been working full-time on Dwarf Fortress. All the code is coded by Mr. Adams, but he said that his younger brother also helped with the story based on the design and the game.

Dwarf Fortress is a free simulation game that uses text graphics to express pictures using letters as shown below.



A new version of the UI has also been released on Steam and itch.io.

Steam: Dwarf Fortress
https://store.steampowered.com/app/975370/Dwarf_Fortress/



Dwarf Fortress by Kitfox Games
https://kitfoxgames.itch.io/dwarf-fortress


You can see what kind of game Dwarf Fortress is by watching the following movie.

# 1 Dwarf Fortress Japanese Live Evil & Tower --YouTube


Q: Q:
What programming language and other technologies do you use with Dwarf Fortress? Has anything changed in the last 15 to 20 years?

Adams:
Dwarf Fortress is a combination of C and C ++. I've been using Microsoft Visual Studio since Microsoft Visual C ++ 6.0, but now I'm using the free version of the Visual Studio Community.

For the engine, I use OpenGL and SDL. We chose these because they are easy to port to macOS and Linux. Of course I still couldn't do it myself ... Even if I use Unity or Unreal Engine now, I'm at a loss because I haven't mastered either. However, dealing with the engine by myself is really painful, especially now that I am making something that goes beyond text graphics. The sound uses FMOD .

Aside from the introduction of SDL and portability along the way, the development environment hasn't changed much during the project. On the mechanical side of the game, I don't use much external libraries, but I occasionally use random number generators. At first I used Mersenne Twister , but now I use splitmix64.

Q: Q:
What is the difficulty of continuing one project for a long time? Is it easier to maintain and fix if you do everything yourself?

Adams:
I often forget (the code I wrote). There are 711,000 lines in all, so it's impossible to remember all of them. However, I try to give variables and objects consistent and easy-to-remember names, and leave comments to remind me of what's happening in my code. Sometimes I do a search to find the untouched code I wrote 10 years ago. There are still some very incomplete parts that I haven't looked back on before the first release in 2006.

I've never worked on a large project with multiple people, so I think working alone is certainly relatively easy and optimal. It's true that there are no team or hierarchy hurdles when you want to fix the code, but sometimes you have to do it alone.

Q: Q:
Are there any of the biggest refactorings or fixes in developing Dwarf Fortress?

Adams:
I've spent months redesigning certain data structures, but I don't think it's strictly a refactoring. Because there are always opportunities to advance the system, and it makes sense to do it as soon as you have knowledge of the new code.

For example, adding Z coordinates to make the game 3D was one of the most daunting tasks I've ever done. For weeks and weeks I wondered how the two coordinate-dependent logic and function calls, X and Y, would fit into the added Z coordinate.

Q: Q:
Did you have any problems migrating from a 32-bit OS to a 64-bit OS? It was a big topic at the time, but now it seems that 64-bit OS has become firmly established.

Adams:
There is none at all. If there was any problem, that is not the case. Fortunately, we already had good control over byte size. This is related to saving and loading the world, but when setting the format, it was necessary to deal with endianness between OSs in particular. No troublesome pointer operations are performed. As a result, the code was otherwise optimized for 64-bit operating systems, but this is purely coincidental. The initial problem was to give me time to change to 64-bit, but it actually took less time than I expected.

Q: Q:
What is your favorite bug and what is causing it?

Adams:
It may be boring to say, but there is nothing more than a 'drunk cat bug'. In 2017, Dwarf Fortress reported a series of bugs in which cats were suddenly found 'dead and covered in vomit.' Upon examination, it was found that when the poisonous creatures were fortified, there was a bug that caused the cat to develop all the symptoms of alcoholism for some reason when cleaning its paws.

In addition, the movie explaining the bug of the drunk cat is below.

Why Dwarf Fortress started killing cats --Here's A Thing --YouTube


Q: Q:
Have you ever tried to work on another project in parallel with Dwarf Fortress?

Adams:
Of course there is! There are about 90 projects that have been carried out in parallel in the last 10 years. Some last in a few days, others take years. Most of them are different games of completely different genres, but there are some projects that are close to Dwarf Fortress. It hasn't been released yet, but it's fun to play with.

Q: Q:
Have you tried other programming languages in 90 projects in parallel?

Adams:
Hahaha, there isn't. I'm more interested in design than technical. However, you'll need to learn scripts and use threads to get the design you envision faster. However, it is difficult to devote time to technical acquisition to proceed with projects in parallel.

in Video,   Game, Posted by log1i_yk