[HN Gopher] How Dwarf Fortress is built
       ___________________________________________________________________
        
       How Dwarf Fortress is built
        
       Author : andreareina
       Score  : 643 points
       Date   : 2021-07-29 14:04 UTC (8 hours ago)
        
 (HTM) web link (stackoverflow.blog)
 (TXT) w3m dump (stackoverflow.blog)
        
       | umvi wrote:
       | My favorite TIL about this game is that it is developed
       | completely without VCS like git.
        
       | smoldesu wrote:
       | Dwarf Fortress was a staple of my childhood, even if I only
       | understood maybe 5% of the mechanics going on at any given time
       | (even back when I used to play it). That was part of the appeal
       | though: if you could learn how to do something in Dwarf Fortress,
       | it felt like an accomplishment. Learning to dig better bases is a
       | several-hour research project, and simple tasks like brewing beer
       | can proliferate into any number of different problems. This kind
       | of trial-and-error problem solving is probably responsible for
       | getting me into development.
       | 
       | Nowadays though, I mostly play Rimworld for my colony management
       | fix. I love Dwarf Fortress, but I could never comfortably learn
       | it's mechanics in a lifetime (let alone several). Even still, the
       | emergent, chaotic gameplay of Dwarf Fortress should be picked
       | apart by any budding game developers. Even after 15 years of
       | playing PC games, Dwarf Fortress still feels the most "next gen"
       | out of them all.
        
       | chaostheory wrote:
       | 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.
        
         | AstralStorm wrote:
         | Well, if you deeply understand the code and reasons behind it
         | (or it's superbly documented esp. with tests), the tool does
         | not bring much beyond being a convenient backup or checkpoint
         | system.
         | 
         | And especially if you don't have to work with a team.
        
         | reader_mode wrote:
         | I mean using SCM became the norm in maybe last 10-15 years ?
         | When this was started I don't think using SCM was as ubiquitous
         | as it is today, not to mention on a solo project. If you've
         | been hammering away since then I can see how you might have
         | missed it.
        
           | usefulcat wrote:
           | In 26 years I've never worked anywhere that didn't use SCM.
        
           | foobiekr wrote:
           | SCM was commonplace by the mid 1980s at the latest. My CS
           | program used CVS to submit code in the mid 1990s and as a
           | network engineer we used RCS in 1990.
        
             | smcameron wrote:
             | I remember using sccs in the '80s.
        
           | ska wrote:
           | > I mean using SCM became the norm in maybe last 10-15 years
           | 
           | more like 30, at least in a lot of the industry. Even just
           | looking at open-ish systems, people were excited about SVN in
           | what, 2000?, because they had been working with CVS for
           | years, if not a decade or more, at that point.
        
           | dangoor wrote:
           | Pretty sure all of my professional work used SCM starting in
           | the mid-90s (CVS). May not have been the norm for solo devs
           | at that point, though.
        
             | reader_mode wrote:
             | https://www.joelonsoftware.com/2000/08/09/the-joel-
             | test-12-s...
             | 
             | I've seen this post brought up as relevant regularly up
             | till 2010.
             | 
             | You may have been lucky to avoid the dredges but SW
             | industry in the 2000s was a copy-paste fest (not in the
             | "copy from stack overflow" sense but as in "copy paste
             | instead of creating a function"), PHP with SQL in templates
             | and string concat queries all over the place, MVC was a
             | revolution. I'm not saying this was everywhere just that it
             | was very common.
             | 
             | I'm sure some wise guy will come up with retort that MVC
             | was used in the 70s and what not, but my point is _a lot of
             | the industry_ discovered it with Rails and Django.
             | 
             | The way that we teach programming these days and
             | languages/tools/frameworks just make some bottom tier
             | mistakes from the past impossible (or very impractical).
             | People often ignore this context when evaluating modern
             | framework
        
               | coliveira wrote:
               | In the Windows world SCM was not generally available
               | until SVN was released as a File Explorer extension. This
               | was sometime in the 2000s. Git took several years to
               | become viable on Windows.
        
               | GordonS wrote:
               | IIRC, Microsoft's TFS (Team Foundation Server) also came
               | on the scene in the early 2000's. I first used SVN around
               | that time, before TFS became the standard at Microsoft
               | shops.
        
               | andrewaylett wrote:
               | My first employer out of university kept their code in
               | Visual Source Safe, Microsoft's _first_ attempt at a VCS.
               | 
               | It was really, really bad.
               | 
               | My second employer used CVS. Tags were fun back then --
               | each file was versioned separately so committing multiple
               | files while a tag was in progress might result in only
               | _some_ of your changes making it into the tag. My big
               | innovation there was to add a validation step to our
               | build machine to ensure that the tag matched the state of
               | the branch once the tag had finished, and add the tag to
               | the build version number. Presto: we can actually see
               | which code was built into that day 's full build :).
        
               | kryptiskt wrote:
               | There were plenty of proprietary source control systems
               | around. At my first job in 1998, we used Visual
               | Sourcesafe, later switching to Perforce.
               | 
               | At another job I had the misfortune to get to know
               | Rational ClearCase.
        
         | Octopodes wrote:
         | Am I mistaken, or isn't his given name "Tarn?"
        
         | AnIdiotOnTheNet wrote:
         | 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".
        
           | Pet_Ant wrote:
           | Or any other is the point. I mean even locally I depend on
           | commits as save points to just allow me to go crazy and
           | experiment with the code. I mean you can just copy the
           | codebase elsewhere as backup but using git or mercurial is
           | easier than that.
        
             | nolok wrote:
             | Not saying you're wrong, but to explain "how is that
             | possible over 20 years without ever blowing things up": he
             | says he uses visual studio since the beggining (the full
             | blown ide).
             | 
             | Since he's working alone, he can easily use the local
             | backup feature of it, which allow to easily rollback to
             | automatically made copies of files, diff and cherry pick
             | between current and backups, etc ... It's basically done
             | automatically for you.
             | 
             | As long as you save your project regularly and don't need
             | to merge code with anyone, it can go a long way.
        
           | AstralStorm wrote:
           | Actually extremely easy. Git add -a, git commit, git push.
           | 
           | It only gets complicated if you try to do complicated things.
        
             | nhooyr wrote:
             | I believe it's:                 git add -A
             | 
             | With a capital A.
        
           | kapp_in_life wrote:
           | Is it? That's when git is simplest, having a single branch
           | and never merging removes most of the complexities of git.
        
             | AnIdiotOnTheNet wrote:
             | Sure, but it also removes most of the reason to use Git.
        
               | outworlder wrote:
               | The main reason is the ability to undo mistakes. Or
               | compare working code with non-working code (including
               | bisect)
               | 
               | That's very valuable even when solo, and worth typing a
               | "commit" command once in a while.
        
               | burnt_toast wrote:
               | Personally, I started using git for my projects after I
               | accidentally deleted a good chunk of source code and my
               | closest backup was several weeks old.
        
               | GordonS wrote:
               | The exact same thing happened to me, and I kicked myself
               | hard for it. At the time I used source control at work
               | (TFS and SVN; git wasn't yet ubiquitous), so I didn't
               | really have an excuse.
               | 
               | I've used source control for all personal projects since,
               | and it's in no way a burden. In fact, there have been
               | another couple of instances since the first, where I
               | would have lost a bunch of work without it.
        
               | potatoman22 wrote:
               | In my experience, most people use git as version control.
               | Branching etc is very useful, but not necessary for a
               | 1-person project.
        
               | flatiron wrote:
               | It is if you want to bug fix released items but keep
               | steam rolling features for the next version.
        
               | tonyedgecombe wrote:
               | I find branching useful whilst working on my own, I
               | certainly wouldn't want to go back to CVS/SVN.
        
               | hhjinks wrote:
               | Don't underestimate all the useful information a complete
               | git log contains, even for solo developers. You can look
               | years back and find out exactly why a change was made.
        
               | emteycz wrote:
               | I invite you to try using Git as much as possible for two
               | weeks. After a week I started using Git for branching out
               | of my main branch to test several different ideas and
               | then compare them at once with other developers -
               | colleagues or friends. I think that moved the meetings
               | and discussions with my teammates up a level.
        
               | AnIdiotOnTheNet wrote:
               | I have used Git when working with FOSS projects, and I
               | tried using it for my own but it never took. The sort of
               | workflow it is built for just isn't how I like to do
               | things when I work on my own.
        
               | mypalmike wrote:
               | Solo workflow is as simple as write code, git commit,
               | repeat. Throw in a git push every once in a while. All on
               | master, no branching or forking.
        
               | AnIdiotOnTheNet wrote:
               | That's a lot of commandline I don't normally have to
               | bother with. And if I'm not living in the commandline
               | then I only end up running git when I reach some
               | milestone I want to back up... which I can do just as
               | easily with 7zip without installing anything I don't
               | already have, and I can copy archives to my NAS without
               | having to set up some remote repo.
               | 
               | You can try and convince me until you're blue in the face
               | dude, but I've tried it and I just don't like it. End of
               | story.
        
             | epolanski wrote:
             | Why tho?
             | 
             | You can create as many branches as you want and do all the
             | experimentation you want.
             | 
             | When I stopped caring about committing and branching
             | (something I've too long associated with pushing code, like
             | reaching milestones) and started doing both as much as
             | possible I really felt lots of freedom.
             | 
             | Instead of overthinking I can create parallel different
             | approaches and see where they lead to. It's amazing.
        
           | darkarmani wrote:
           | What? How it more difficult that CVS or even RCS that lies
           | under CVS?
           | 
           | That would have been the OS tool back in 1998.
        
             | AnIdiotOnTheNet wrote:
             | For lone developers in 1998 it's more likely they would
             | just occasionally make a copy of the code somewhere. That's
             | still more or less how I work on my own stuff.
        
           | fatbird wrote:
           | Change history, if nothing else. That alone brings a ton of
           | benefit, from being able to view earlier versions, to
           | recovering from mistakes or lost code.
           | 
           | If you have a remote repo then, you can also have offsite
           | backups. If you never branch, it's still massively worth it.
        
             | asciimov wrote:
             | Does git have benefits, yes.
             | 
             | Are git commands obtuse and unfriendly, yes.
             | 
             | The problem is that git is not intuitive and isn't
             | automatic. I've seen more people loose code to git than be
             | saved by having their repo offsite.
        
           | godshatter wrote:
           | I agree with this. I've been using cvs as my source control
           | system of choice as a solo developer on my own projects for
           | years and haven't switched to anything newer. I use git at
           | work, but it's not worth the hassle for me at home. The
           | workflow with cvs for me is basically "cvs update" (in case I
           | need to know what changed) and "cvs commit". I rarely use
           | branches. I religiously make one small-ish fix per commit and
           | at least compile it, though I always run smaller things.
           | 
           | If I switched to working with a team I'd definitely use git.
           | But for just me, cvs is all I really need. The most
           | complicated thing I do is probably tag a release or revert to
           | a previous revision of something, which is pretty rare.
        
           | Bayart wrote:
           | Basic git-fu (init, add, clean, commit, pull, push, branch,
           | merge, stash, log) goes a long way to make your life easier.
           | You can leave the fancy stuff for later.
           | 
           | There are even git repos of 99% done .gitignore files for
           | most needs [1], which is most of the setup work for a solo
           | project.
           | 
           | [1]: https://www.toptal.com/developers/gitignore
        
             | mwaitjmp wrote:
             | The official github desktop app is really nice to use as
             | well. At least on a Mac.
        
           | nhooyr wrote:
           | No it isn't! It's so easy and effective for keeping track of
           | your work and backups.
           | 
           | If you want the absolute simplest way to use git, just setup
           | an alias to do:                 alias gcmp="git add -A && git
           | commit && git push"
           | 
           | Now all you need to do is run gcmp every time you're ready to
           | log the new state of your codebase. How could it be simpler?
           | 
           | git _only_ becomes more complex as your needs become more
           | complex. At which point I 'd recommend using something like
           | https://magit.vc/ which makes complex git operations far
           | easier. The CLI can only take you so far effectively
           | unfortunately.
        
             | Yajirobe wrote:
             | git commit to which branch? git push to which branch?
        
               | thebean11 wrote:
               | Master/main? It's a single branch workflow.
        
               | mypalmike wrote:
               | master, origin/master
        
           | wisemanwillhear wrote:
           | While Git is not without it's complexities, but as a
           | developer who must use it with teams anyways, I find there
           | are very simple workflows with almost no cognitive load that
           | I'm able to use for my personal projects. Not only does this
           | give me snapshots of my projects from any point in time, but
           | backups as well since I use a free GitLab account as well.
        
             | AnIdiotOnTheNet wrote:
             | Yeah sure, but for someone who's workflow started 20 years
             | ago without Git, it shouldn't be at all surprising that
             | they kept not using Git for a long time.
             | 
             | There's really no reason to be surprised at all about this
             | unless you're the kind of person who never did any
             | programming before, like, 2010 and lack the imagination or
             | knowledge to understand how programming could be done
             | without it.
        
               | wisemanwillhear wrote:
               | I can't disagree with that. We must all make wise
               | decisions with endless competing "priorities" and limited
               | time.
               | 
               | As someone who is on the other side and believes in the
               | value of continuously growing one's skills, I want to
               | convince people that Git has value in learning and using.
               | More tools in our toolbelt makes us more effective
               | craftsmen. Which the DF developer did get around to
               | doing...
        
         | dpcx wrote:
         | 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...
        
       | njharman wrote:
       | If you like "small time" devs / roguelike programming the
       | Roguelike Celebration conference YTs is excellent
       | https://www.youtube.com/channel/UCKv_QzXft4mD6TXmQBZtzIA
        
       | TheLocehiliosan wrote:
       | Once I spent about a week struggling to create a DF config that
       | defined the key bindings to be vi-like consistently throughout
       | the game.
       | 
       | I failed.
        
       | jandeboevrie wrote:
       | Df is just like OpenTTD. Both are like Chess, easy to start, fun
       | to play casually but it takes years to master. Great games,
       | complex if you want to and a time sink if you don't keep an eye
       | on it. Have had many hundreds of fun hours in both games
        
         | DizzyDoo wrote:
         | I've played a fair amount of Dwarf Fortress and I'd never
         | describe it as 'easy to start'? The learning curve is notorious
         | and for most people involves watching a lot of YouTube
         | tutorials and copying actions.
         | 
         | I'm hopeful that the upcoming Kitfox Games version makes it
         | very accessible to lots more people.
        
         | ALittleLight wrote:
         | Dwarf Fortress seems incredibly hard to start to me. The UI is
         | chaotic and the "graphics" verge on incoherent.
        
         | anthk wrote:
         | Eh, Chess it's much more complex than Slashem to me, and I
         | never ascended in Nethack/Slashem/DCSS.
        
         | short_sells_poo wrote:
         | I agree with the spirit of your post, but Dwarf Fortress and
         | Easy to Start do not fit in the same sentence in my opinion. I
         | mean, the game is legendary for it's arcane user interface and
         | the vast number of things that can go wrong even for experts.
         | 
         | Dwarf Fortress is something like vim, where usually on the
         | first interaction people don't even know how to start the game,
         | let alone do anything in it.
         | 
         | Chess is easy to start, the rules fit on a post it note
         | basically. Dwarf Fortress is difficult to start, and even more
         | difficult to master.
        
           | devenvdev wrote:
           | When I first started playing DF it took me all day reading
           | the wiki...
           | 
           | Next week was spent on trying to survive the first winter...
           | 
           | As a 15 years vim user though - vim has a much more gradual
           | but also much higher learning curve, I'm still learning new
           | tricks in vim on a weekly basis.
        
       | njharman wrote:
       | I thought it was developed by the two brothers? I've seen talks
       | and interviews by both brothers on DF.
       | 
       | like this one https://www.youtube.com/watch?v=ZMRsScwdPcE
       | 
       | and https://www.youtube.com/watch?v=HtKmLciKO30
        
         | psyc wrote:
         | This is StackOverflow, and the interview is about code, so they
         | probably mean developer in that sense. Tarn is the only
         | programmer.
        
       | reidjs wrote:
       | 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.
        
         | dexwiz wrote:
         | 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.
        
         | petercooper wrote:
         | Do you actually play it? I'm a bit the same about reading
         | _about_ it, yet I have never once played it for myself!
        
           | AndyMcConachie wrote:
           | If DF is too daunting try RimWorld. It's based mostly on DF,
           | but has graphics and is considerably more approachable. It's
           | also heavily modded and with mods can get just as complicated
           | as DF can.
        
           | Arrath wrote:
           | Hah, this is like EVE Online for me. I love reading about the
           | espionage and cloak and dagger and pure insanity, but other
           | than a brief toe-dip...oh no I will not play it.
           | 
           | DF lives in my blood, however.
        
             | eigenvalue wrote:
             | Totally agree on reading about EVE Online. This is a real
             | classic if you haven't seen it before, and actually
             | contains a lot of very important notions for identifying
             | Ponzi schemes: http://web.archive.org/web/20091026234156/ht
             | tp://geocities.c...
        
           | reidjs wrote:
           | I tried playing it like a decade or two ago. Couldn't get
           | past the ridiculous learning curve.
        
             | andi999 wrote:
             | I just saw that O'Reilly published a book to help with
             | that: https://www.amazon.de/Getting-Started-Dwarf-Fortress-
             | complex...
        
             | LeegleechN wrote:
             | They're working on a Steam release with a more accessible
             | interface, including mouse support. I suggest trying it
             | again when that comes out.
        
               | opinion-is-bad wrote:
               | Is there any timeline for the stream release? The release
               | date on the store page just says, "Time is subjective."
        
             | tastyfreeze wrote:
             | Its worth the effort and likely easier now than before. The
             | myriad ways that a fortress can die amazes me. Its easy to
             | get a fort that can survive invaders but ultimately your
             | fortress will die. The number of times I have been
             | nonplused by a new fortress failure is amazing. Those crazy
             | dwarves keep finding new ways to destroy themselves.
        
             | tstrimple wrote:
             | This image is a reasonable estimation of the learning
             | curve.
             | 
             | https://i.stack.imgur.com/iECXl.jpg
        
           | minsc__and__boo wrote:
           | I've put in probably over a thousand hours on it, and have
           | played it over the years as new releases come out. I've
           | gotten to the point where I usually hit FPS death (too large
           | a fortress that it overloads the CPU) even on the harder
           | starts and with dfhack to help.
           | 
           | The draw for me was the steep learning curve that rewards you
           | with logical complexity when you finally understand it. The
           | lore that your fortress generates, as well as the random
           | stories, is just icing on the cake. It's definitely not for
           | everyone though since the UI requires additional programs
           | like DF Therapist and DF Hack to be manageable still.
        
             | outworlder wrote:
             | For me, the reason I have stopped playing is that I have
             | issues managing migrants.
             | 
             | There are just too many dwarves to care for. Even DF
             | Therapist doesn't (or didn't?) really help micromanaging
             | jobs. It becomes tedious quickly.
             | 
             | I remember seeing something about auto-allocating jobs, but
             | it didn't work for me.
        
               | praptak wrote:
               | Most hardcore players set limits on the number of
               | dwarves. This helps both with the micromanagement and
               | with FPS.
        
           | prepend wrote:
           | I love reading about it, but have played for maybe 30
           | minutes. The game doesn't intrigue me, but the building of it
           | does.
           | 
           | Same for Minecraft and similar. Figuring out the software and
           | the cool way it came into existence is the problem to solve,
           | actually playing it is (perhaps incorrectly) predictable
           | details and so boring.
        
         | milgrim wrote:
         | I am the same. I also started to play a few times, but not
         | knowing the mechanics and not having enough time/motivation to
         | learn them in detail is frustrating. But there's a nice
         | alternative: https://youtube.com/c/kruggsmash
         | 
         | Watching someone else play Dwarf Fortress can be surprisingly
         | entertaining. Just start one of his series from the start.
        
           | devenvdev wrote:
           | My favorite gaming youtuber.
           | 
           | They are somewhat similar with Tarn, also a pure passion
           | project that made it, with all the hand drawn pictures and
           | down to earth approach.
        
             | milgrim wrote:
             | I agree. That's why both get a bit from me on Patreon.
        
       | vtail wrote:
       | I know I will regret asking it... but what's the modern way of
       | starting playing DF?
        
         | andrewzah wrote:
         | You can use dfhack to run the game, which provides some
         | niceties [0]. There are graphical packs; many people like
         | Phoebus. You can also use an external program like Dwarf
         | Therapist for dwarf management, which becomes necessary once
         | you have a lot of dwarves.
         | 
         | [0]: https://docs.dfhack.org/en/stable/docs/Introduction.html
        
         | hobs wrote:
         | An article for you
         | https://dwarffortresswiki.org/index.php/Utility:Lazy_Newb_Pa...
        
         | pradn wrote:
         | There's an officially-supported skin with good sprite-based
         | graphics. It's still a bit in progress however.
         | https://www.kitfoxgames.com/press/sheet.php?p=dwarf_fortress
        
         | legohead wrote:
         | failing is considered part of the fun of the game [1]. so just
         | download it and start going.
         | 
         | [1] https://dwarffortresswiki.org/index.php/DF2014:Losing
        
         | AQuantized wrote:
         | The Wiki is probably the most up to date resource:
         | https://dwarffortresswiki.org/index.php/DF2014:Quickstart_gu...
         | 
         | It's really not that difficult once you get started, especially
         | if you're used to learning some esoteric keybinds.
        
         | sjfkejrnakcijdj wrote:
         | Not exactly modern, but the Captain Duck Dwarf Fortess Video
         | Tutorial[1] is still a great tutorial.
         | 
         | [1]: https://youtube.com/playlist?list=PL5A3D7682BDD48FC2
        
         | Inviz wrote:
         | Wait for steam version
        
           | devenvdev wrote:
           | Or don't if you want the full "meta" experience.
        
       | mabbo wrote:
       | > What's your favorite bug and what caused it?
       | 
       | > A: It's probably boring for me to say, but I just can't beat
       | the drunken cat bug... That was the one where the cats were
       | showing up dead all over the tavern floor, and it turned out they
       | were ingesting spilled alcohol when they cleaned their paws.
       | 
       | I think that bug explains very well just how deeply complex Dwarf
       | Fortress really is. Drinks can be spilled. Some drinks have
       | alcohol. If cats step in something it sticks to their paws. Cats
       | clean their paws, causing them to ingest what's on them. Enough
       | alcohol will kill a cat. Put together: dead drunken cats.
        
         | devenvdev wrote:
         | Other amusing DF bugs:
         | 
         | Dwarfs trying to clean their inner organs (dwarf wounded,
         | doctor closes the wound, dirt stay inside)
         | 
         | Undying children in the moat water (for years... just swimming
         | there...)
         | 
         | Killer carps (there was a long time during which carps were
         | really overpowered because constant swimming was buffing them
         | up really good, dwarfs getting close to water sources were
         | eaten by carps)
         | 
         | Catplosions (Tarn loves cats, cats reproduce, too many cats
         | kills DF performance)
        
           | kd0amg wrote:
           | _Catplosions (Tarn loves cats, cats reproduce, too many cats
           | kills DF performance)_
           | 
           | This was a particularly insidious one because the usual
           | strategy of culling excess livestock doesn't work out when
           | applied to dwarfs' pets (pets can't be designated for
           | slaughter, and other means of making pets die will make their
           | owners upset). With most animals, you can avoid the pet
           | adoption issue by just not marking them as available for
           | adoption, so you wouldn't have to worry about a dogsplosion,
           | sheepsplosion, etc. Cats do not become pets through that
           | system. Instead, a cat adopts a dwarf.
        
             | bombcar wrote:
             | Verily, the dwarf would pick up a cat to take it to the
             | slaughterhouse, the cat would adopt the nearest dwarf (the
             | one carrying it) and then the dwarf would slaughter the
             | cat.
             | 
             | And get sad because his pet died. And then eventually start
             | tantruming and a tantrum spiral would begin.
        
         | AndyMcConachie wrote:
         | One of my favorite Twitter users.
         | 
         | https://twitter.com/DwarfFortBugs
         | 
         | It's just funny Dwarf Fortress bugs.
        
           | suzzer99 wrote:
           | LOL - 5386: Imprisoned Vampire Elected Mayor
        
           | cpeterso wrote:
           | A similar Twitter account publishing funny bug fix notes from
           | other games:
           | 
           | https://twitter.com/TheStrangeLog/
        
         | AnIdiotOnTheNet wrote:
         | Unfortunately it remains unexplained (by the article) why this
         | is considered a bug. It would be unethical to test, but this
         | seems like perfectly cromulent behavior one might actually see
         | in real life.
        
           | yung_steezy wrote:
           | I agree these types of features really embiggen the game
        
             | beamatronic wrote:
             | They're perfectly cromulent features.
        
           | spoonjim wrote:
           | Cats in bars don't die of alcohol poisoning regardless of the
           | amount of beer spilled on the floor.
        
             | praptak wrote:
             | I read about a cat who used to visit a pub and learned to
             | lick beer from under taps. The cat got banned from the pub
             | for its own good but I don't believe it was anywhere close
             | to poisoning.
        
             | Filligree wrote:
             | The actual bug here was a mistake in handling of liquid
             | volume. The cats were ingesting a tankard's with with each
             | lick, and they're smaller than dwarves, so that killed
             | them.
        
           | paavohtl wrote:
           | IIRC the actual bug was that cats licking their paws made
           | them consume an entire tankard's worth of beer with each
           | lick, which made them drunk (and dead) with just a few licks.
        
             | Arrath wrote:
             | Yeah this is what I recall being the case as well.
        
           | alexander-litty wrote:
           | Liquid items are funny in the game.
           | 
           | When you look at an item listing and you see something like
           | "Mead", that is truly all the item is --- it isn't a cup of
           | mead, it's just a vague amount of the liquid mead itself, as
           | if your hand was the only thing keeping it from hitting the
           | ground.
           | 
           | But there are containers that can hold your liquid. You have
           | mugs and goblets that hold one quantity of "Mead", giving the
           | impression that one count of mead is like a generic serving
           | size. You also have barrels and pots that hold stacks of
           | "Mead".
           | 
           | Creatures are kind of like walking containers and have their
           | own detailed inventories. Among the things you'd expect to
           | find like armor, weapons, and books, you might also find a
           | "coating of tears" on a crying dwarf, or perhaps a
           | "spattering of blood" on a murderous elf.
           | 
           | They're not just static inventories for the fun of a story,
           | creatures do interact with them and use them. Dwarves covered
           | in a vomit item will (hopefully) put any available soap in
           | their inventory and use it to clean themselves in water, for
           | example.
           | 
           | Cats are simple and just clean themselves with no water or
           | soap needed. The catch with them is that they ingest whatever
           | they have cleaned off of them.
           | 
           | So, putting all this together: The problem was that cats pick
           | up a whole "serving size" of alcohol and proceed to clean
           | themselves, ingesting the entire serving. The bug surrounds
           | the vagueness of liquid sizes.
           | 
           | And it was fixed accordingly! Cats are still vulnerable to
           | the effects of self-cleaned alcohol, but the strength is now
           | proportional.
           | 
           | https://www.bay12games.com/dwarves/mantisbt/view.php?id=9195.
           | ..
        
             | db48x wrote:
             | My favorite feature in Dwarf Fortress is that all eyelids
             | automatically clean their associated eyeball, just so that
             | players don't post about how their dwarves have vomit on
             | their eyeballs.
        
               | PeterisP wrote:
               | Ahh, so if a dwarf would have a missing eyelid because of
               | combat or some mining accident, _then_ they could have
               | vomit on their eyeballs.
        
               | [deleted]
        
           | MikeTheGreat wrote:
           | My experiences with cats (at least in my own life) is that
           | cats prefer not walk into an area with a sticky floor if they
           | can avoid it.
           | 
           | Clearly there's a bug here where the cat will keep wandering
           | around on the sticky floor, and then keep consuming the
           | alcohol off it's paws.
           | 
           | The obvious fix is to add a feature wherein different
           | creatures have preferences about where they go next, and then
           | use that to have the cats avoid the bar floor if they can.
           | 
           | As a bonus you can include stuff like "Cats don't like
           | hanging out in crowded areas" so that they'll also stay out
           | of the main hall when the army is gathering to muster forth,
           | etc.
           | 
           | (/s, but only slightly :) )
        
             | Filligree wrote:
             | No need for the /s. This is precisely the level of
             | simulation Toady is hoping for, and there are many
             | equivalent examples already.
        
             | db48x wrote:
             | Good suggestion. It would occasionally be nice if the
             | _dwarves_ would avoid stepping in things and tracking it
             | all over the place. The only reason that the cats were in
             | the tavern in the first place is that pets follow their
             | owner* around.
        
             | queuebert wrote:
             | And this is how you get 700k lines of code.
        
           | shrimpx wrote:
           | The bug was a numerical error that would cause cats to drink
           | something like the equivalent of a pint of beer for every
           | lick, and therefore die prematurely. He talks about it in
           | this video:
           | 
           | https://www.youtube.com/watch?v=VAhHkJQ3KgY
        
         | markus_zhang wrote:
         | Not sure what's in the code, but I think each cat (which is
         | some sort of entity by itself) is composed by body parts, which
         | at the lowest level owns a bunch of attributes/components.
         | Would that make sense?
        
           | pixl97 wrote:
           | The bug in this case was the minimum alcohol value a cat
           | could like from its paws was above the cats LD100, so if they
           | licked their feet when soaked in beer they would die.
        
             | markus_zhang wrote:
             | Ah, that's interesting, so it's actually a bug. But yeah it
             | shows the sophisticated system underneath.
        
         | pavel_lishin wrote:
         | Reminds me a little bit of something strange I saw in Rimworld
         | - all of my dogs were developing liver cirrhosis!
         | 
         | It turns out that my dogs weren't alcoholics - it just happened
         | to be that beer was the only food source they had zoned access
         | to, so they were drinking it out of hungry desperation, and
         | while it gave them enough calories to live on, it also gave
         | them cirrhosis.
        
           | OrsonSmelles wrote:
           | Yeah, I've definitely accidentally created packs of booze
           | hounds that way. Definitely a head-scratcher before you get
           | what's going on.
        
         | 7373737373 wrote:
         | I wish there was a description of how this works technically
        
           | mabbo wrote:
           | ericschn below has a link to a video of Tarn explaining it.
           | It's wonderful.
        
         | ygra wrote:
         | Noita also had a fun one during early development: deer
         | drowning in their own urine.
         | 
         | And now that I dug up the Reddit AmA thread (https://old.reddit
         | .com/r/Games/comments/d7cqjz/we_are_nolla_...), there's a
         | comment there about the drunken dead cats ...
        
         | partomniscient wrote:
         | 10 years ago, there was this article about another unexpected
         | behaviour:
         | 
         | https://www.nytimes.com/2011/07/24/magazine/the-brilliance-o...
        
         | ericschn wrote:
         | The beginning of this video https://youtu.be/VAhHkJQ3KgY has
         | Tarn Adams speaking about this bug.
        
           | mabbo wrote:
           | This is my favourite bug story I have ever heard. And told so
           | well.
        
       | orf wrote:
       | I tried to play DF. I even got over the ASCII interface.
       | 
       | But honestly Rimworld is better and a bit deeper.
        
       | [deleted]
        
       | mattlondon wrote:
       | I always wanted to love DF but I could never get into it. Perhaps
       | it was the ASCII.
       | 
       | I found Rimworld to scratch the same itch and have sunk many
       | hours into it. I feel like it is spiritually very similar, even
       | if the depth of simulation is not as deep as DF.
        
       | 100011_100001 wrote:
       | This is a little bit of a hijack but if I wanted to start coding
       | games as a side project, where would I start?
       | 
       | Which platform? Mobile, PC, console? Any good introductions on
       | the subject of solo game development? I know I can google this,
       | but I trust HN users more than the Google algo.
        
         | rscho wrote:
         | Pico8!
         | 
         | https://www.lexaloffle.com/pico-8.php
        
         | darkandbrooding wrote:
         | I recommend Godot ( https://godotengine.org/ ). It solves many
         | of the problems you suggested.
        
         | AnIdiotOnTheNet wrote:
         | I started doing game dev in DOS after reading Tricks of the
         | Game Programming Gurus by Andre LaMothe in the 90s, so keep
         | that in mind for the following advice.
         | 
         | Depends on what you want to do. If you want to code games
         | because you find the programming aspect interesting, start
         | small by writing your own versions of some simple games. I
         | personally wouldn't recommend any frameworks or libraries other
         | than (maybe) SDL. Implement everything in the simplest way you
         | can think of that will actually work and only go back and
         | refactor if you need to, that's the time to look up how other
         | people have solved that problem [0]. Resist the urge to over
         | engineer. I might be biased but I say target PC first. Windows
         | specifically, but Linux isn't much worse as long as you never
         | plan to deploy the thing. This is because these platforms are
         | incredibly open and there is a lot of information and tooling
         | available. After you get a feel for it, and have a good idea of
         | what you want to make next, start incrementally branching out
         | in directions that interest you.
         | 
         | If you have a good idea of the kind of game you want to make
         | and want to start making it with as little friction as
         | possible, then your best bet is to find an engine that is
         | already well suited to that kind of game and learn just the
         | things you need to in order to make it happen. Again, you'll
         | want to start small regardless of what it is you actually want
         | to make, just ensure that you're always moving toward that
         | goal. That is very much not my path, so I have little other
         | advice.
         | 
         | [0] If you look it up first without trying it yourself, you
         | won't have a good understanding of the problem space. You'll
         | end up believing in the commonly accepted answer as dogma and
         | severely limit yourself.
        
         | ljp_206 wrote:
         | I'm not much of a game programmer, but lurk /r/gamedev. The
         | common advice is to start small - think toys rather than MMOs.
         | From there, it's said one should follow what they're interested
         | in, and focus on follow-thru, not tacking on features to their
         | dream game that is supposed to compete with Skyrim. Console
         | development is always going to be more trouble than the more
         | open platforms of computers and phones. Myself, I've always
         | thought it'd be pretty fun to make a menu-heavy game with just
         | web technology, which then of course CAN be played anywhere.
         | 
         | There are lots of engines out there that can take care of
         | things for you, or act as full fledged studios, like Game
         | Maker. Some prefer to start from scratch of course. Again, the
         | idea should be follow what you're interested in so that you can
         | actually get something done.
        
         | bttrfl wrote:
         | Why don't you start with an idea and self-awareness of your
         | strengths?
         | 
         | You might be good at puzzles. Or stories. Maybe visuals ain't
         | your thing and you can write a text based game - there are
         | great engines for that. Maybe you're a great dev and can start
         | hack your own Dwarf Fortress and keep on doing it for the rest
         | of your life.
         | 
         | Gaming and tech behind is so varied that whoever you are,
         | you'll find something that plays to your skills.
        
         | dgan wrote:
         | I started contributing to an old open source strategy game, I
         | played as kid, couple of months ago
         | 
         | It was extremely pleasant to fix some old bugs that kept
         | annoying people (and me!)
         | 
         | I spend more time in the game guts, than playing though
         | 
         | I believe it's easier to start with existing game, than
         | creating new one from scratch
        
         | Octopodes wrote:
         | Check out this itch page for some suggestions:
         | 
         | https://itch.io/jam/game-off-2020
         | 
         | Scroll down to the " Help--I've never created a game before!"
         | section and there are some suggestions like Phaser or Godot.
        
         | outworlder wrote:
         | I would suggest you start by just coding a text-based game.
         | Yeah, you heard me right. Maybe a text adventure or whatever. A
         | D&D game printing out damage as logs. FTL clone, with text
         | descriptions only. Anything. You can create a surprisingly
         | engaging game just with basic standard input and output - even
         | multiplayer games (the MUDs were basically this). Print a basic
         | ASCII map, and now you can do Nethack.
         | 
         | The reason for this is: we all want to make beautiful AAA
         | games. But if you have no clue where to begin, it means that
         | you need to develop your intuition for the game logic first -
         | otherwise, you would probably know what to look for :)
         | 
         | If you start by downloading Unity or similar, now you'll be
         | bogged down trying to learn all its systems (without a clear
         | understanding of _what_ you need to learn and what you can
         | ignore, for now). You'll also be bogged down by the need for
         | assets. Sure, you will have a full blown 3D engine, but it's
         | still incredibly boring when all you have is a bunch of cubes
         | or premade assets, so you are right back to square one. Only
         | with more complexity. A lot more - the more visually complex
         | the game, the more code you will have to write that's only
         | concerned about visuals. Getting a character to, say, swing an
         | axe and make it look right and that it is actually hitting
         | something involves a surprising amount of work. Yeah, you could
         | use existing sample games nowadays, but that isn't really
         | teaching you much.
         | 
         | Then it depends on how much background you have. If you were,
         | say, a front-end developer with any experience, you could use
         | that to add some basic visuals. Think Tetris. You can do a lot
         | with very rudimentary tools, as long as everything is kept
         | simple.
         | 
         | At some point, you might _need_ to display graphics (maybe
         | that's the whole point of your game idea). I say "might",
         | because Dwarf Fortress, which is the subject of this thread,
         | never really did. In which case you have some more decisions to
         | make. Is it a 2D game? Maybe use something like Pygame, Love
         | (for Lua), etc.
         | 
         | At some point you'd be looking into Godot, Unity or similar.
         | And guess what, you could take your basic text-based game, and
         | re-use parts of it as the brains for your game.
         | 
         | Don't get into the game-engine building rabbit hole. It's very
         | fun if you are into that, but know you are unlikely to release
         | anything by going that route. Ask me how I know.
         | 
         | Platform: start with whatever machine you use for development.
         | Presumably you know a lot about it, don't start a side-quest :)
         | Specially, avoid consoles for now. Cross-platform development
         | is getting easier than ever - sometimes all you need to do to
         | start running your game on mobile is to click a dropdown. But
         | that simplicity is deceiving, there's lots you'll have to learn
         | about other platforms. Stick with what you know, until you are
         | comfortable.
         | 
         | I'll let others provide reference material, my sources are
         | outdated as I'm past my Gamedev.net days (for the time being).
        
         | Audiophilip wrote:
         | I'd go with Unity, targeting desktop for simplicity. There's an
         | abundance of high quality tutorials (a respectable amount made
         | by Unity) and the learning curve is gentle, imho.
        
         | markus_zhang wrote:
         | I think the first thing to figure out is: do you want to make
         | games or game engines? Or is there a specific part of game
         | development that you are particularly interested in? Back in
         | the year 2000 I was very into Level Design. Back then the FPS
         | genre just took off and I happened to stumble into a
         | "Worldcraft.exe" in a folder in the CD of Half-Life.
        
         | iwintermute wrote:
         | have you seen HandMadeHero? https://handmadehero.org/
         | 
         | Plus what do you mean by coding games specifically? Is it game
         | engine programming? Game design? Or other related stuff?
        
         | mhitza wrote:
         | I second Godot. You can make cross platform/mobile games with
         | it. The IDE itself is built with the engine which is rather
         | cool.
         | 
         | Fair warning, the syntax is python inspired but not compatible,
         | which most of the time that will trip you up.
         | 
         | My second suggestion, is for your first project to develop a
         | top down 2D (instead of a classical side scroller), using
         | itch.io assets. To get a nice jump feeling for a side scroller
         | 2D game, you straight ahead have to start using a state machine
         | and fiddle a bunch, no hand holding with that.
        
       | wly_cdgr wrote:
       | If you like this, you may also enjoy this Tarn Adams talk at NYU
       | GameCenter's 2016 PRACTICE conference
       | https://youtu.be/yDPb0jqRr3o
        
       | markus_zhang wrote:
       | IMO that's one of the best ways a single programmer can spend his
       | career. No weird requirements, no deadlines, no nothing, nada.
       | Just one's passion and a product. Whether it is successful is
       | irrelevant.
       | 
       | Kudos Mr. Adams for making the achievement and moves gaming
       | history.
       | 
       | Going back to the interview, I found this line (and the logic
       | attached) interesting:
       | 
       | >Making the item system polymorphic was ultimately a mistake, but
       | that was a big one.
       | 
       | >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.
       | 
       | I guess when the game becomes moderately complex then ECS or
       | something similar suddenly makes a lot sense.
        
         | wly_cdgr wrote:
         | Everything about it is wonderful (I really mean that) except
         | the fact that he's sponging off his mother to do it. I can't
         | help but feel that it's a drop of vinegar that spoils the whole
         | cup of milk
        
           | fellowniusmonk wrote:
           | Why would this spoil the milk? Why is it called "sponging"?
           | The middle class safety net (something I grew up without) is
           | one of the greatest sources of freedom and investment
           | generally available. Multi generational homes and properties
           | are historically pretty normal and a net family positive for
           | holding onto wealth.
           | 
           | For example: https://www.middleclasspaas.com/
        
           | markus_zhang wrote:
           | I think it's OK as long as they feel it's OK. We can say that
           | his mother "sponsors" the project.
        
             | wly_cdgr wrote:
             | Edit: I was wrong about how much he is relying on his
             | family - didn't realize how much Patreon support the
             | project now has compared to when I last looked. My bad,
             | should have checked. I still agree with the below in the
             | abstract but I retract my criticism in this case
             | 
             | I can get with that take when it comes to Patreon but it's
             | harder to demonstrate ok-ness-with-it with family. Let's
             | say she's really not all that jazzed about it, actually.
             | What is she gonna do, throw her son out on the street? A
             | lot of parents don't have it in them to do that even if
             | they think they would be justified and it would be the best
             | thing for their child. An adult shouldn't put their parents
             | in that position. He should be making sure his mom is
             | provided for, not the other way around
        
           | nmz wrote:
           | He is? He's making almost 9k a month, that's pretty good if
           | you ask me. https://www.patreon.com/bay12games
        
             | wly_cdgr wrote:
             | I stand very much corrected, I didn't realize the project
             | had gathered so much support steam compared to 5-10 years
             | ago. Happy to see it
        
               | dharmab wrote:
               | IIRC they added paid options after a family health scare
               | caused them to realize that they needed a way to pay for
               | better health insurance.
        
             | burntoutfire wrote:
             | That's for two people (him and his brother, who's also
             | working on the game, but in a non-coding capacity).
        
         | Philip-J-Fry wrote:
         | I have a passion for programming but I need something to drive
         | me. I'm useless when I try and make stuff on my own. But if
         | I've got someone telling me "I need a system that does X", I
         | just get highly motivated in delivering it. Like I need
         | requirements.
        
           | markus_zhang wrote:
           | Damn you sound exactly like me...when I work for my own
           | projects they usually die off quickly once I figure out how
           | to do it (without actually implementing it but I'm pretty
           | sure it can be implemented in this or that way).
           | 
           | But if it comes from a friend, or a colleague then I'm super
           | focused on it until it's done.
           | 
           | It's almost as if I do projects to show off to other people
           | or I like to serve other people.
        
             | Philip-J-Fry wrote:
             | Yeah, showing off or feeling helpful. That explains it
             | almost perfectly.
        
             | galaxyLogic wrote:
             | Yes if you do it for yourself you rarely thank yourself for
             | doing it. In a way that would be absurd, because giving
             | thanks to someone means you are giving something to
             | someone. But you can't really give anything to yourself
             | because whatever you give you already have.
             | 
             | So it is quite natural that we prefer to do things for
             | others. It makes you feel great when others thank you for
             | it.
        
             | blacktriangle wrote:
             | Part of the issue is that it is difficult to come up with
             | problems worth solving.
             | 
             | I think Joel and Fogcreek is a great example. He started
             | out with the premis that you don't need an idea for a
             | successful software company, you just need to find great
             | devs and create the best working conditions and then
             | success would come. This was a novel idea at the time since
             | Apple was the only FAANG that even existed and this was
             | their "beleaguered" period. As should come as no surprise
             | to anybody, they ended up creating...bug tracking tools and
             | a kanban board, albeit quite good ones.
             | 
             | Another thing that helps, since the problem is not your own
             | but somebody elses, you don't get bogged down trying to
             | figure out the best way to solve it for yourself, you just
             | solve it for somebody else without all the emotional
             | attachment to the problem. This lets you instead be
             | emotionally attached to the process.
             | 
             | Point being, I think you're selling yourself short.
        
               | nyanpasu64 wrote:
               | Is having deep knowledge of the problem domain you're
               | solving a blessing or a curse? Personal attachment to the
               | problem domain?
        
               | my_usernam3 wrote:
               | > you just solve it for somebody else without all the
               | emotional attachment to the problem
               | 
               | This rings very true to me
        
             | w0m wrote:
             | I feel this.
        
           | bcrosby95 wrote:
           | Yeah, I'm the same. I got into programming because I like
           | solving people's problems. The hardest projects for me are
           | the ones where I'm stuck in a cave for months working on a
           | greenfield project that no one is using yet.
        
           | suzzer99 wrote:
           | Same here. I'm motivated by being on a team that I don't want
           | to let down, and getting a pat on the back when I deliver
           | something great.
           | 
           | I think it's because the early stages of a new project, where
           | you're doing a ton of googling and head-scratching, are kind
           | of painful for me. I need that team or client or business
           | owner counting on me in order to push through that part.
           | 
           | Then I can roll on my own when I get to the fun stuff (for
           | me) - creating features with well-understood tools, and
           | refining and organizing code.
        
         | akira2501 wrote:
         | > No weird requirements, no deadlines, no nothing, nada
         | 
         | Well.. until you accidentally create a broken release, that is.
         | That's _real_ sweat.
        
         | dmitryminkovsky wrote:
         | I was with you until:
         | 
         | > Whether it is successful is irrelevant.
         | 
         | At some point something needs to be successful or you can't
         | keep working on it, right?
        
           | markus_zhang wrote:
           | As long as you feel good I think it's OK. Most passion
           | projects don't really generate a lot of revenue.
        
             | Falling3 wrote:
             | Yea, but you specifically mentioned this as a career. You'd
             | want _some_level of success if your passion project is your
             | career.
        
               | markus_zhang wrote:
               | me bad, I'll edit the post.
        
             | dmitryminkovsky wrote:
             | Oh Markus where were you like 5 years ago?!? :)
        
               | markus_zhang wrote:
               | Me? I don't really have any completed passion project :/
               | so sad I wish I could at least finish one of them.
        
               | dmitryminkovsky wrote:
               | I meant to tell me that before I started :)) I'm just
               | completing mine, but it's taken a while. Not one of those
               | people who can do things in a weekend...
        
           | [deleted]
        
         | sdevonoes wrote:
         | That's why programming is king. Software engineering on the
         | other hand...
        
       | hprotagonist wrote:
       | _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.
        
         | adamrezich wrote:
         | 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.
        
         | tinus_hn wrote:
         | In the LPMud LPC language objects could inherit from multiple
         | other objects, so they could combine behaviors. I haven't
         | really seen that in other languages.
        
           | shagie wrote:
           | The "about inheritance in LPC" - https://www.mars.org/home/ro
           | b/docs/IntermediateLPC/chapter6....
           | 
           | and a bit about multiple inheritance in LPC - http://graphcom
           | p.com/info/mud/mudos/lpc/constructs/inherit.h...
           | 
           | And another bit - http://www.geas.de/tutorial/lpc_57.html
           | 
           | As to seeing it in other languages... this gets into a mixing
           | - https://en.wikipedia.org/wiki/Mixin
           | 
           | An example of that in Scala - https://docs.scala-
           | lang.org/tour/mixin-class-composition.htm... or
           | https://www.baeldung.com/scala/class-composition-mixins
           | 
           | The issue is that for most situations, the additional
           | conceptual load of multiple inheritance gets difficult.
        
         | truetraveller wrote:
         | "Tool" is still a class, with perhaps very generic polymorphic
         | methods (e.g. do_default_action() ). The problem is not
         | polymorphism per se, but rather about having a deep class
         | hierarchy aka lasagna code.
         | 
         | My policy: OOP is like salt. Use little and that's great. I
         | only allow a single inheritance layer, and ideally no
         | inheritance at all.
        
           | mountainriver wrote:
           | This is one of the things I like about Go. Just structs with
           | methods. You can embed them but it seems to hedge against
           | deep nesting and creates simple code
        
             | blacktriangle wrote:
             | Then how would you model composing behaviors in Go. Say for
             | example I have a representation of Food and a
             | representation of Animal. I then want an ability that will
             | "animate" things, so I can animate Food to give it the
             | behaviors of Animal.
             | 
             | I'm not being critical either, I'm seriously curious how
             | somebody would implement this behavior in Go. Like you say,
             | just struct with methods is a very appealing mental model
             | since you have fewer moving parts, but how does it deal
             | with a scenario like this which is very common in game dev?
        
           | sbacic wrote:
           | > My policy: OOP is like salt. Use little and that's great. I
           | only allow a single inheritance layer, and ideally no
           | inheritance at all.
           | 
           | That's been my observation as well - there's no free lunch
           | and DRY isn't free either, certainly not if you use
           | inheritance chains to achieve it.
           | 
           | I'm starting to think that the only programming axiom that
           | will survive in the end is KISS.
        
             | suzzer99 wrote:
             | A few weeks ago some commenter here said they ascribe to
             | WET - Write Everything Twice. Basically worry about
             | abstraction when you get to number three.
             | 
             | And what an acronym given the context!
        
               | hprotagonist wrote:
               | I've also heard "We Enjoy Typing"
        
             | junon wrote:
             | KISS and YAGNI are like yin and yang for me.
        
             | marcosdumay wrote:
             | KISS is universal, not only to programming.
             | 
             | But the single responsibility principle and the idea that
             | you should divide your code in components where the lower
             | components should be abstract by the point of view of the
             | higher ones are almost never wrong.
             | 
             | Not by coincidence, those last two are consequences of how
             | people think. While KISS is kind of a physics law.
        
           | blacktriangle wrote:
           | Another good rule for OOP: Objects are fine, object graphs
           | are a killer. Graphs are what get you into "all I wanted was
           | a banana" territory. Objects should either be atomic,
           | agrigated by simpler structures like maps and arrays, or if
           | you absolutely must have objects pointing to objects, be sure
           | that they form a tree and not a graph such that each object
           | need only know about the things below them which can be
           | encapsulated at a single point.
        
           | AstralStorm wrote:
           | Funny thing, it's just the object model in play that causes
           | the problem. Something more similar to Smalltalk (or
           | Objective-C) works pretty well for things this dynamical,
           | though you do need to factor out the properties and messages
           | reasonably well still.
           | 
           | The trouble is C++ and similar object models poor support for
           | composition and implicitly penalizing uniform object
           | structure.
           | 
           | (E.g. call multiple base methods in a subclass - pain ensues.
           | Add virtual calls to the mix, it gets really iffy.)
           | 
           | Even Python and Ruby with explicit mixins but the old model
           | get hairy.
        
           | deltaonefour wrote:
           | My policy is OOP is like Heroin. Don't even start.
        
             | pjmlp wrote:
             | Never write GUI code then.
        
               | deltaonefour wrote:
               | Yeah that's the one downside of not doing OOP. OOP is the
               | only way to do GUI stuff.
               | 
               | Nobody on the face of the earth has ever used Functional
               | Reactive Programming. It's a made up concept. In fact
               | it's also definitely not one of the concepts that
               | inspired the most popular pattern in React.
        
               | rocqua wrote:
               | I try really hard not to. So far it's worked!
        
           | hutzlibu wrote:
           | "I only allow a single inheritance layer"
           | 
           | I would agree to that as a goal, but not as a dogma. It
           | depends what you build, I guess.
        
         | blacktriangle wrote:
         | Hickey nails this one in his talks. When you make something a
         | class, that's NOT an abstraction, that's a concretion. You make
         | a Tool class, you haven't abstracted what a tool is, you've
         | made a fixed decision about what it is. For games that want
         | this level of complex interaction between components, entity
         | component systems are the way to go.
        
           | imtringued wrote:
           | I would argue that if you have a "Item" class then it is the
           | set of all concretions/specializations.
           | 
           | By creating a tool class you haven't extended the set, you've
           | instantiated a subset of the set of items that contains the
           | items that are tools but nothing else. It's obvious why it is
           | so difficult to represent a tool that is also e.g. a
           | consumable item. The set of items that are both tools and
           | consumables is a superset of the set of tools and set of
           | items. You can't represent it through a second layer of
           | inheritance because it only lets you create a subset of the
           | items that are tools. You obviously have to use multiple
           | inheritance for something like this because it will let you
           | form the set of items that are both tools and consumables. Of
           | course, multiple inheritance is very messy so you should try
           | to avoid it.
        
           | Kinrany wrote:
           | > For games that want this level of complex interaction
           | between components, entity component systems are the way to
           | go.
           | 
           | Entity component systems are still in a half-baked state,
           | with everyone rolling their own slightly different conceptual
           | model. They're solving a problem, but not solving it well.
           | 
           | One promising direction is getting rid of entities.
           | Components need to link to entities and other components
           | anyway, so one may as well treat entities as zero-size
           | components. Old writeup (not mine):
           | https://github.com/kvark/froggy/wiki/Component-Graph-System
        
             | blacktriangle wrote:
             | I think this is more of a language paradigm problem. Game
             | programming is very much tied up in C++ and C# for
             | historical and performance reasons, ECS is a way to try and
             | graft what is entirely natural in a more value-based
             | language into OOP mechanics and C++/C# type systems.
             | 
             | ECS is so common and easy in lisps that it doesn't even
             | warrant its own name.
        
               | Kinrany wrote:
               | Rust game engines are all based on ECS too.
        
           | oxfeed65261 wrote:
           | I'd love a reference to this talk.
        
             | j-pb wrote:
             | "Maybe Not" talks about these compositional ideas:
             | https://www.youtube.com/watch?v=YR5WdGrpoug
        
             | blacktriangle wrote:
             | https://youtu.be/2V1FtfBDsLU?t=2268
             | 
             | Goes until 43:25.
             | 
             | The whole talk is worth watching. It's basically about the
             | higher level problems of business app development, how to
             | address them, and how Clojure does address them.
        
         | mushishi wrote:
         | > 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.
        
         | [deleted]
        
         | NoOneNew wrote:
         | Sorry but a lot of the complaints from the article and what you
         | linked are... well weird. Look, I'm no grand ninja guru wizard
         | programmer, but after a decade of programming on and off as a
         | job... wtf are you all smoking? Theres nothing to preach but to
         | check your hubris. A majority of problems stem not from OOP or
         | whatever language being used, it's from over abstracting. This
         | is mostly due to trying to pre-build for a scale that will
         | 99.8% never happen or to account for some wild potential
         | esoteric function in the ether that'll never happen as well.
         | There's some weird dick measuring contest out there on the
         | internet that I wasn't invited to where everyone is trying to
         | out over complicate each other. They never stopped to properly
         | learn any real design patterns, so their classes end up all
         | over the place. "Its OOP's fault!" And hell, sometimes you used
         | a hammer when a screwdriver was more appropriate. No big deal,
         | we all make mistakes in lines of design logic. It ain't OOP's
         | fault you made an oops.
        
           | filleduchaos wrote:
           | Let's just say that there's a reason game dev has tended
           | towards ECS/data-oriented design.
           | 
           | A program that puts a handful of form widgets, consumes a
           | bunch of text or spends most of its time waiting for I/O is
           | far from the same domain.
        
         | TickleSteve wrote:
         | composition over inheritance...
         | 
         | Its the fragility of large inheritance hierarchies. They work
         | well for very rigidly defined real world structures but not so
         | well in most real-world usages.
        
         | tralarpa wrote:
         | That's very interesting, because I had observed _exactly_ the
         | same when I tried to implement a rogue-like in Java some years
         | ago. For example, I had to decide whether there should be
         | different subclasses for spell books, the different weapon
         | types (e.g bows vs swords), drinks, etc. or just one big Item
         | class. Closely related to that, another decision I had to make
         | was whether object or character properties should be
         | implemented as class members or as entries in a hashmap (where
         | the latter is a class member). At the end, I had the feeling
         | that I was implementing my own class /object system on top of
         | Java's one. I guess in other languages, like lisp, this is not
         | really an issue.
         | 
         | IIRC I already wrote that here on HN, but I think implementing
         | a simple rogue-like is an excellent exercise to get familiar
         | with any programming language.
        
           | suzzer99 wrote:
           | Mattias Johansson uses basically this example in his argument
           | for composition over inheritance. You have humans, robots,
           | and dogs all fitting into your nice class hierarchy. But now
           | you need a robot dog that breaks everything.
           | 
           | https://www.youtube.com/watch?v=wfMtDGfHWpA
           | 
           | I think inheritance makes the most sense when your problem
           | domain has been known for decades - like airline
           | reservations. But for new blue sky projects - you always seem
           | to wind up in these snafus that break your rigid class
           | hierarchy.
        
             | breck wrote:
             | > You have humans, robots, and dogs all fitting into your
             | nice class hierarchy. But now you need a robot dog that
             | breaks everything.
             | 
             | I like the way you put that. Though humans and dogs are 85%
             | similar at a DNA level, so makes sense for them to inherit
             | from a common parent. And my guess is robots and robot dogs
             | would be ~85% similar at a building block level, so dog
             | would inherit from robot.
             | 
             | I think go easy on levels of inheritance but have really
             | strong root classes that most things inherit from.
        
           | Gene_Parmesan wrote:
           | Definitely components are the way to go. These have gotten
           | very well known recently in the game dev world thanks to
           | entity component systems, which is what I would call "heavy
           | components," but you can also do "light components." Meaning,
           | you don't need to organize your entire system around an ECS
           | in order to take advantage of some of their benefits.
           | 
           | They make changing behavior dynamically extremely simple.
           | Instead of needing to hardcode classes for each different
           | type of thing players may want to create in your world, you
           | just assign and unassign components. Give a rock the Moveable
           | component and now it moves. Remove the PlayerControl
           | component from the player and put it on, I don't know, an orc
           | -- now you've implemented body swapping. They're even more
           | useful in a game like traditional roguelikes, where you don't
           | have to worry about animating all these dynamic states.
           | 
           | I've actually never thought about how a component system
           | might fit into a more traditional business application; it's
           | an interesting thought experiment but I'm not quite sure it
           | would be a strong benefit.
        
         | vishnugupta wrote:
         | Prefer delegation over inheritance was one of the first OOP
         | lessons I learnt. I read it in a C++ blog around 2004, it was
         | explained very well with geometric shapes examples.
         | 
         | The only time I used inheritance was while implementing a job
         | execution framework. It fit the pattern nicely.
        
       | ambivalence wrote:
       | Meta-question to the mods: why would you edit the original title
       | of this entry? Feels somewhat interventionist.
        
         | pcthrowaway wrote:
         | I agree, I thought the full title was better and more relevant.
        
           | meibo wrote:
           | Sometimes the rule is to not editorialize, sometimes you get
           | slapped for it, other times the hall monitors step in to
           | change the title after the fact because they don't like the
           | article's actual title. They want you to remove clickbait
           | numbers so maybe that's what happened here.
           | 
           | Don't think too much about it.
        
       | _peeley wrote:
       | Dwarf Fortress consumed hundreds of hours of my life in high
       | school, I have so many fond memories of it. Every year or so I
       | come back to it and I'm always surprised that they've managed to
       | add another mechanic or feature that just makes the game feel
       | even more like its own little universe. After enough time in the
       | game there really is a moment like that scene in the Matrix - "I
       | don't even see the ASCII anymore. All I see is dwarf, plump
       | helmet, magnetite ore."
       | 
       | That said, I've always wondered if Dwarf Fortress would be a more
       | smooth experience if it had more developers or was just open
       | source (understandable that it's not though since it's basically
       | Tad's passion project). The biggest headache was always the lack
       | of multithreading, since your fortress really starts to chug once
       | you pass maybe 150 dwarves or do anything exciting with fluids.
       | Regardless, it's amazing what one developer with a great idea and
       | an enthusiastic community has been able to do with the game.
        
         | anthk wrote:
         | It happened to me with Nethack/Slashem and interactive fiction
         | games.
         | 
         | Once you get absorted at night by imagining your surroudings
         | upon reading the game actions, the game feels scarier and more
         | "real" than any current 3D adventure game.
        
         | asciimov wrote:
         | > That said, I've always wondered if Dwarf Fortress would be a
         | more smooth experience if it had more developers
         | 
         | Maybe, but only if it was under the benevolent dictator model.
        
         | devenvdev wrote:
         | > I don't even see the ASCII anymore. All I see is dwarf, plump
         | helmet, magnetite ore
         | 
         | It's even more than that - I can spend ridiculous time in
         | legends mode just reading facts and events going from one
         | personality to another trying to "feel" the world. It's like
         | from these pieces of trivial information a bigger picture
         | emerges, partially consisting of the facts and partially of
         | random connections my brain made. It's an amazing experience.
        
         | fridif wrote:
         | Passion project? It is the sole source of his income.
        
           | hutzlibu wrote:
           | It might be both.
        
           | Octopodes wrote:
           | He's lucky enough for it to be both.
        
           | Yajirobe wrote:
           | Lichess is Thibault's source of income, passion project, AND
           | it is open-source.
        
             | fridif wrote:
             | I suspect that Thibault is making money from it because he
             | is actually deploying a web service, and the value there is
             | coming from the network effects of its multiplayer user
             | base.
             | 
             | Even if I deployed his code tonight, there's no guarantee
             | users would switch over to my LeeChess clone :)
             | 
             | In the case of Dwarf Fortress it's just "download my exe
             | and please donate if you like it!"
        
           | dmitryminkovsky wrote:
           | I've been working on a project for a long time. It's not even
           | yielding income, though I hope it will. A friend referred to
           | it as a passion project. That hurt for some reason. I can't
           | explain why.
        
             | s5300 wrote:
             | I think you're interpreting his meaning in saying that
             | incorrectly.
             | 
             | You're not an employee for somebody else (correct? It's
             | your own project) - it's not a salaried or hourly position
             | where somebody else is currently signing your paycheck. You
             | obviously don't hate it (I hope? If so, not sure why you
             | wouldn't have canned it yet)
             | 
             | Thus, this is what most people would refer to as a passion
             | project. You may have a different meaning of that term in
             | your own mind, but I think, on average, most people would
             | refer to what you're doing as such, and not to be malicious
             | in doing so. I wouldn't let it hurt you, I'm sure that's
             | likely not a friend's intention.
        
               | dmitryminkovsky wrote:
               | Yeah for sure, he didn't mean anything by it. I try not
               | to be super sensitive, that makes interacting with people
               | impossible. But sometimes it's hard :).
        
               | biztos wrote:
               | I have a similar sensitivity around my primary vocation:
               | I'm an artist with a day job, like many others, but since
               | my day job is programming and I take it seriously, a lot
               | of people think of my art as a "hobby." Which it very
               | much is not.
               | 
               | FWIW I have found that three things help me deal with
               | this sensitivity:
               | 
               | 1) Take it as motivation to be more outwardly
               | "professional" about my art. Improve the website, be more
               | active on social media, try harder to exhibit, even (ugh)
               | sell things.
               | 
               | 2) Remember that _most_ people are just saying that out
               | of ignorance: they don 't have a mental model for
               | anything outside of "work for the Man" or "mess around in
               | free time."
               | 
               | 3) Have examples ready if someone needs an explanation,
               | and also as inspiration for yourself. For instance: was
               | William Carlos Williams[0] a "hobby" poet?
               | 
               | [0]: https://www.poetryfoundation.org/poets/william-
               | carlos-willia...
        
             | fridif wrote:
             | Yeah I agree with this, I would feel hurt too. For some
             | reason the word "passion" has this hidden connotation for
             | me which makes me feel like the project isn't serious,
             | isn't making money, isn't popular, and is just eating up
             | all my time as it is something I constantly obsess over.
             | 
             | In the case of Dwarf Fortress, I would say for him it is
             | "the sole project he's been working on for 20 years now,
             | which takes up $large_number of hours per week, and which
             | has been sustaining his life now thanks to a fan base which
             | have proven themselves reliable contributors of financial
             | support. And he really enjoys writing the code too"
        
               | dmitryminkovsky wrote:
               | > For some reason the word "passion" has this hidden
               | connotation for me which makes me feel like the project
               | isn't serious, isn't making money, isn't popular, and is
               | just eating up all my time as it is something I
               | constantly obsess over.
               | 
               | This is spot on. If only you would articulate my feelings
               | for me all the time, that would be great!
        
         | andrewzah wrote:
         | Even if it were open source I doubt there would be enough
         | impetus to implement multithreading.
         | 
         | It would literally be easier to completely make a new game from
         | scratch with async and threading designs taken into account,
         | instead of trying to adapt an existing monolith.
         | 
         | Async and multithreading are complex and introduce many subtle
         | bugs. It's not so easy to just move to that from a single-
         | thread event loop.
        
       | intended wrote:
       | So many projects in this game. I had one which involved trying to
       | build a base, capture a dragon and start a breeding program.
       | Which failed - so I ended up abandoning, starting a new base on
       | top of a dragon lair, capturing said dragon, leaving the base,
       | then starting an adventurer who carried the caged dragon in a
       | mine cart across the map to the original base.
       | 
       | It did not work. The version didn't allow for the new adventurer
       | to become a resident of the original base.
       | 
       | Futzed around with dfhack to force residence permissions and so
       | on, ended up breaking the game and changing the species or some
       | other weird bug.
       | 
       | But I did learn that adventure mode mine carts are _ridiculously_
       | fast. As in survival is highly unlikely fast. There was a lot of
       | saving and reloads due to the difficulty of banking turns at
       | speeds that outran cheetahs.
        
       | robertwt7 wrote:
       | It's amazing that he's doing the same thing for those long. I
       | think that's the definition of passion, I really want to find
       | some projects/startups that make me fee like that as a SE. That's
       | the dream, hope he keeps it up!
        
       | the_af wrote:
       | I love the idea of Dwarf Fortress and I think the internet purest
       | mission is to disseminate works of passion such as this, not to
       | sell me ads instead. That said, I can't get past the ASCII
       | interface -- I'm a huge fan of IF games (which used to be called
       | "text adventures" in the olden days) and I can deal with spartan
       | UIs, but for real-time strategy/sandbox games, I absolutely need
       | some sort of graphics. Tiles, at least. The same happens to me
       | with Nethack, which fortunately does have graphical tilesets. I'm
       | glad to read Toady One is working on such a UI!
       | 
       | Something I found insightful about TFA was this:
       | 
       | > _Q: With your ~90 side projects, have you explored any other
       | programming languages? If so, any favorites?_
       | 
       | > _A: Ha ha, nope! I'm more of a noodler over on the design side,
       | rather than with the tech. I'm sure some things would really
       | speed up the realization of my designs though, so I should
       | probably at least learn some scripting and play around with
       | threading more. People have even been kind enough to supply some
       | libraries and things to help out there, but it's just difficult
       | to block side project time out for tech learning when my side
       | project time is for relaxing._
       | 
       | This is interesting. I constantly feel the temptation to learn
       | new tools, new languages, new stuff. I get sidetracked by the
       | tech. But the _key_ to successful games seems to be designing
       | them and sticking to the work of making them work no matter the
       | tech or language. If Toady had kept playing with programming
       | languages and frameworks instead of sticking to his actual
       | project -- creating a game -- maybe Dwarf Fortress wouldn 't
       | exist, or it wouldn't be as featureful.
        
         | JonathanFly wrote:
         | >I love the idea of Dwarf Fortress and I think the internet
         | purest mission is to disseminate works of passion such as this,
         | not to sell me ads instead. That said, I can't get past the
         | ASCII interface -- I'm a huge fan of IF games (which used to be
         | called "text adventures" in the olden days) and I can deal with
         | spartan UIs, but for real-time strategy/sandbox games, I
         | absolutely need some sort of graphics.
         | 
         | You can see the new tileset in action here, demoed by Tarn:
         | https://www.youtube.com/watch?v=LlzCrJS1Fho
        
         | teataster wrote:
         | Have you tried playing with tilesets? I feel they make the
         | experience easier on the eyes.
        
         | Bayart wrote:
         | There are tons of tilesets for DF. If you want to get started,
         | just picking one of the "Lazy noob packs" is the way to go[1].
         | 
         | [1]:
         | https://dwarffortresswiki.org/index.php/Utility:Lazy_Newb_Pa...
        
       ___________________________________________________________________
       (page generated 2021-07-29 23:00 UTC)