CFP: Porting Dwarf Fortress to OS X

On October 18, 2006, in Games, by peterb

I’m continuing to play Dwarf Fortress on a fairly regular basis, at least when I have time.

I’ve reached the underground lava river, set up a magma forge, and my latest wave of immigrants included a number of nobles — a broker, a manager, a sheriff, and a representative of the farming guild. They showed up and immediately began demanding luxuries (for starters, each wants their own personal dining room, sheesh). But they clearly make a difference: when the human caravan showed up to trade, having the broker really made things much easier. It’s not all wine and roses, though. There have been a few tragedies. The most recent was when my legendary miner was attacked by a lone fire imp. He burned to death, and died weeping.

The big problem with playing Dwarf Fortress, though, is that I have to reboot into Windows to do it.

So I am putting out a call for participation, on behalf of the developer: help port Dwarf Fortress to Mac OS X and Linux.

This has to be done in a fairly indirect way, since the source code isn’t open source. But it can be done. Tarn Adams, the developer, has released the source code to an earlier game, Kobold Quest, under the BSD license. Click here to download the source code. Kobold Quest is a much simpler game, but uses basically the same display engine as Dwarf Fortress. His basic idea is that if someone gives him a rewritten Kobold Quest, he could use that to get Dwarf Fortress SDLified.

So the challenge here is to grab Kobold Quest and rewrite it to use SDL instead of native Windows calls. I’ve taken a look at the source code, and I believe this could be done in two or three days, at least for a basic command-line port.

I’m not doing it myself because, frankly, I don’t have those two or three days to spare right now.

If you’re up to the challenge, there are many Dwarf Fortress addicts who would be in your debt. And if you’re in the Pittsburgh area, I’ll buy you a six-pack at Dee’s.

As for why I care about having this game on Mac OS, the best I can do is quote from this post on the forums (in response to someone asking why dwarves who want to build an artifact, but can’t, go insane):

You have to look at it from their perspective, though. It’s easy to say that they’re snapping easily when you’re just looking at things from outside the monitor and reading events in lines on the screen.

When a dwarf gets a serious wound, though, they are likely to be maimed for life. It’s not so strange for extremely tough, previously self-relient types of people to completely flip out when faced with that sort of thing.

And we’re not talking about ‘seeing a rat’. We’re talking about having the fortress that you slaved to create crawling with rats. We’re talking rats and vermin crawling over you while you sleep and eating the food out of your hands.

And don’t forget the other things. Portions of the fortress are covered in noxious, wretched miasmas of decay so thick that they actually obscure your view. Friends and relatives die regularly and are sometimes just left to rot on the ground. Wild raccoons and other horrible monsters are just waiting for the chance to rip out your throat. If you make a mistake or fail to meet a production order, the sheriff cuts you to pieces with an axe. Horrible creatures regularly crawl out of your drinking water and try to murder you in your beds. Filthy new immigrants are constantly being shoved into your fortress’ cramped quarters, forcing you to work yourself down to the bone to get new quarters ready and leaving you with barely enough food to get through the winter. And when food runs out, you’re reduced to grubbing for rats, beetles, and worms in order to survive.

And then, when inspiration finally strikes–when you finally a chance to do what you’ve been dreaming to do for your entire life, the one reason you really went through the hell of this horrible fortress, the one true Dwarven dream–when you finally feel inspiration strike you and can see the form of your artifact in your head, you end up wasting three months doing nothing as your incompetent leaders fail to provide you with the necessary materials. Eventually, the vision begins to fade and you realize you can no longer remember what the artifact you’d waited your entire life for even looks like. Wouldn’t you go mad, too?

Don’t ask why your dwarves go insane or throw tantrums. Ask how they manage to stay sane the rest of the time.

Yeah, move over, Bill Harris. I’m around the bend about it too.


9 Responses to “CFP: Porting Dwarf Fortress to OS X”

  1. All I have is the latest Visual Studio (2005), which means opening up the source will change the project format.

    I wonder if that’s a problem?

  2. greay says:

    Your last post about Dwarf Fortress got me really excited about the game, and I was disappointed to find out there wasn’t an OS X port. I’d love to sit down & port the game, but I don’t have any experience with Windows code or SDL.

    I’ll definitely give the source a look & see what I can do with it, though. If, at the end of the day, it means I can play this game, it’ll be worth it.

  3. Doug says:

    Same here, I have a little windows experience but work mostly an embedded systems or matlab. My 64bit system runs windows, but very little runs on 64 bit windows, both xp and vista. I got it running in wine on linux but it was incredibly buggy.

  4. Will says:

    Thankyouthankyou! Never knew about this game, and I will play it for ever and ever and ever thanks to it’s melancholic refrain and when I first viewed a profile, it told me that although he needed alcohol to get through the day, he grumbles only mildly at inclement weather.

    I love dwarves.

  5. Alan says:

    Please let us know when/if something happens. I’ve looked at the site and it seems great. (And I also agree a lot with your gaming choices, so I feel I would really enjoy this game.) But I don’t have any time to look at the porting, unfortunately.

  6. peterb says:

    I have a basic port of Kobold Quest working on my machine, but haven’t worked out the build issues such that it will run on anyone else’s. And, of course, there’s no telling how long it will take DF to be ported once KQ is, since that is up to the developer. But I’ll keep you posted.

  7. Doug says:

    I have wine running it fine now, but I know not what my dwarfs do. They run around and I feel like I should be telling them to do things…

  8. peterb says:

    This link is helpful:

    The best way to get started is to do the following:

    Designate an area for mining using the “d” key (then you sort of draw an area using the arrow keys and return key. Try drawing a long hallway leading in to the mountain)

    Designate a stockpile to place mining products with the “p” key. (Draw a square area outside)

    Then see what happens. That’s the basic mechanic, although there are many other types of activities than mining.

  9. Alex says:

    The thing with this game, in a very real sense the game is the learning curve. After awhile things become very routine (dare I say easy?). There ought to be a way to speed up the game clock, or at least induce a goblin invasion.