Installing Dwarf Fortress on a Debian Droplet

$ uname -a
Linux Fun 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u5 (2015-10-09) x86_64 GNU/Linux

I recently began playing this gem of a game again, and I decided I wanted to set it up on my Debian droplet so I can access the same game from any location.  I recently installed Rogue and this seemed like a logical next step.  I went ahead and downloaded the archive and extracted it.

$wget http://www.bay12games.com/dwarves/df_42_06_linux.tar.bz2
$tar -xjf df_42_06_linux.tar.bz2
$cd df_linux
df_linux$ ll
total 300
-rwx------  1 pokeybill pokeybill    956 Feb 10 17:41 command line.txt
drwx------ 12 pokeybill pokeybill   4096 Apr 15 22:15 data
-rwxr--r--  1 pokeybill pokeybill    245 Feb 10 17:41 df
-rw-r--r--  1 pokeybill pokeybill     98 Apr 15 22:26 errorlog.txt
-rwx------  1 pokeybill pokeybill  84276 Feb 10 17:41 file changes.txt
-rw-r--r--  1 pokeybill pokeybill     52 Apr 15 22:26 gamelog.txt
drwxr-xr-x  2 pokeybill pokeybill   4096 Feb 10 17:41 g_src
drwxr-xr-x  2 pokeybill pokeybill   4096 Feb 10 17:41 libs
drwx------  5 pokeybill pokeybill   4096 Feb 10 17:41 raw
-rwx------  1 pokeybill pokeybill   1364 Feb 10 17:41 README.linux
-rwx------  1 pokeybill pokeybill  11318 Feb 10 17:41 readme.txt
-rwx------  1 pokeybill pokeybill 167665 Feb 10 17:41 release notes.txt
drwx------  2 pokeybill pokeybill   4096 Feb 10 17:41 sdl

Reading up on the dependencies, I noted 32-bit libraries would be required, so I enabled the architecture, updated apt-get, and installed the missing libraries.

$sudo dpkg --add-architecture i386
$sudo apt-get update
$sudo apt-get install libsdl-image1.2:i386 libsdl-ttf2.0-0:i386 libgtk2.0-0:i386 libjpeg62-turbo:i386 libglu1-mesa:i386 libopenal1:i386

Dwarf fortress runs as an x-windows application, and without a display, emulation is required.  This can be accomplished using xvfb.   I installed this library and created an alias to run it in screen, then set the DISPLAY variable to the virtual server display..

$sudo apt-get install xvfb
$echo 'alias xvfb_init="Xvfb :1 -screen 0 1024x768x16 &; export DISPLAY=:1"' >> ~/.bashrc
$source ~/.bashrc
$xvfb_init

As a final configuration step, I updated the df_linux/data/init/init.txt to disable sound and enable TEXT mode:

Move into the init directory (from the df_linux directory)
df_linux$ cd /data/init
df_linux/data/init$

Find [PRINT_MODE:2D] and change to [PRINT_MODE:TEXT]
df_linux/data/init$ sed -i.$(date +%s).bak "s/\[PRINT_MODE:2D\]/\[PRINT_MODE:TEXT\]/g" init.txt
df_linux/data/init$ grep PRINT_MODE init.txt
Linux/OS X users may also use PRINT_MODE:TEXT for primitive ncurses output.
[PRINT_MODE:TEXT]
	 PRINT_MODE:2D
	 PRINT_MODE:TEXT
	 PRINT_MODE:FRAME_BUFFER
	 PRINT_MODE:PARTIAL:0

Find [SOUND:YES] and change to [SOUND:NO]
df_linux/data/init$ sed -i.$(date +%s).bak "s/\[SOUND:YES\]/\[SOUND:NO\]/g" init.txt
df_linux/data/init$ grep SOUND init.txt
[SOUND:NO]

Now as long as I connect with an appropriate terminal emulator I can play DF from anywhere.

dwarf_fortress_droplet

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.