Live data from Hacker News

How Dwarf Fortress is built

stackoverflow.blog

1–10 of 407 posts

Re: How Dwarf Fortress is built

#2
I read everything about this game I can get my hands on. I don’t fully understand why I find dwarf fortress so intriguing. It’s such a pure passion project… that actually made it.

Re: How Dwarf Fortress is built

#3
Making the item system polymorphic was ultimately a mistake, but that was a big one.

Q: Why was this was a mistake?

A: When you declare a class that’s a kind of item, it locks you into that structure much more tightly than if you just have member elements. It’s nice to be able to use virtual functions and that kind of thing, but the tradeoffs are just too much. I started using a “tool” item in the hierarchy, which started to get various functionality, and can now support anything from a stepladder to a beehive to a mortar (and pestle, separately, ha ha), and it just feels more flexible, and I wish every crafted item in the game were under that umbrella.

We do a lot of procedural generation, and if we wanted to, say, generate an item that acts partially like one thing and partially like another, it’s just way harder to do that when you are locked down in a class hierarchy.

Preach:

https://ericlippert.com/2015/04/27/wizards-and-warriors-part...

https://ericlippert.com/2015/04/30/wizards-and-warriors-part...

https://ericlippert.com/2015/05/04/wizards-and-warriors-part...

https://ericlippert.com/2015/05/07/wizards-and-warriors-part...

https://ericlippert.com/2015/05/11/wizards-and-warriors-part...

I have certainly committed all of these sins, too.

Re: How Dwarf Fortress is built

#4
post #2

I read everything about this game I can get my hands on. I don’t fully understand why I find dwarf fortress so intriguing. It’s such a pure passion project… that actually made it.

It's the programming equivalent to the people who turn their houses into model train worlds. People dabble in it, or make a few toys of their own, but its rare to commit so hard.

Re: How Dwarf Fortress is built

#6

Making the item system polymorphic was ultimately a mistake, but that was a big one. Q: Why was this was a mistake? A: When you declare a class that’s a kind of item, it locks you into that structure much more tightly than if you just have member elements. It’s nice to be able to use virtual functions and that kind of thing, but the tradeoffs are just too much. I started using a “tool” item in the hierarchy, which st…

> We no longer have the problem of trying to fit “a wizard can only use a staff or dagger” into the type system of the C# language. We have no reason to believe that the C# type system was designed to have sufficient generality to encode the rules of Dungeons & Dragons, so why are we even trying?

Good point! Skimmed the blog posts, seemed to have useful enumeration of techniques with considerations.

Re: How Dwarf Fortress is built

#7
post #2

I read everything about this game I can get my hands on. I don’t fully understand why I find dwarf fortress so intriguing. It’s such a pure passion project… that actually made it.

Do you actually play it? I'm a bit the same about reading about it, yet I have never once played it for myself!

Re: How Dwarf Fortress is built

#8

To me what was most surprising about Dwarf Fortress, given the complexity, is that Tad didn’t use git or any other code repository until more recently.

Why would that be surprising? For a single programmer working alone Git is an incredibly complicated tool.

P.S.: A lot of you are confusing "complicated" with "difficult".

Re: How Dwarf Fortress is built

#9

To me what was most surprising about Dwarf Fortress, given the complexity, is that Tad didn’t use git or any other code repository until more recently.

Did he finally start using one? I know that was one of the things that blew most people away, is that he had no change history for most of his code...

Re: How Dwarf Fortress is built

#10

Making the item system polymorphic was ultimately a mistake, but that was a big one. Q: Why was this was a mistake? A: When you declare a class that’s a kind of item, it locks you into that structure much more tightly than if you just have member elements. It’s nice to be able to use virtual functions and that kind of thing, but the tradeoffs are just too much. I started using a “tool” item in the hierarchy, which st…

this is a pretty good series of posts but I was rather surprised at where the series ended, with more (hypothetical) OOP abstraction instead of less. trying to fit game rules into a language's type system is a common thing for novice programmers to attempt, because it seems like the perfect logical application of these type system rules you just learned about when learning the language you're using. I kept expecting the article series to get around to reducing the system down to something like a Player class with a PlayerClass enum and member (and ditto for Weapon), then branching logic based on that, instead of trying to pack it into the type system.
Post reply on HN