• Breaking News

    Friday, December 3, 2021

    Dwarf Fortress Dwarf Fortress Mobile: Running Dwarf Fortress on Android Devices

    Dwarf Fortress Dwarf Fortress Mobile: Running Dwarf Fortress on Android Devices


    Dwarf Fortress Mobile: Running Dwarf Fortress on Android Devices

    Posted: 03 Dec 2021 06:43 AM PST

    Eniteris gestures! The phone shudders and begins to move! 

    Special thanks to ptitSeb for developing of box86/64 and explictly testing Dwarf Fortress, delphonso for bringing this to my attention on the forums, and methylatedspirit for deb sources for box86/64.

    Abstract

    Dwarf Fortress Mobile has been a desired artifact in this community for many years [1], and has been mostly implemented through connecting to a remote instance of Dwarf Fortress running on a separate computer [2]; however, the ☼adamantine short sword☼ of implementations would be to get Dwarf Fortress running locally on ARM computers. Dwarf Fortress is, unfortunately, only compiled for x86 and x86-64 systems, and I think the general consensus was that it was not worth the time to petition The Great Toady One to figure out how to compile Dwarf Fortress for ARM architectures. Thus, the only way to get Dwarf Fortress functioning on ARM computers is through emulation.

    Emulating Dwarf Fortress on ARM has also been achieved historically. QEMU has been used to run x86 programs on ARM machines, however, these instances were often plagued by complaints about performance [3], as QEMU fully emulates the libraries required to run Dwarf Fortress, leading to a large performance overhead. These emulations also often ran in a full linux environment, as opposed to operating systems optimized for performance in handheld devices.

    Recent developments in x86/64 emulation has lead to translating library calls to run programs on ARM architecture. Rather than emulating the libraries wholecloth, by intercepting library calls they can then be redirected to the native library, allowing the calls to run in the native ARM libraries, granting a large performance boost. The development of box86/64 has implemented these developments, allowing for higher performance "emulation" of x86 and x86-64 programs on ARM hardware. [4]

    Combined with PRoot for privilege escalation and running a secondary operating system without a guest kernel, it is now possible to run Dwarf Fortress natively on any Android device. Recent developments in software emulation and hardware processing power has made playing Dwarf Fortress on a mobile phone a convenient way to play Dwarf Fortress on the go, at reasonable performance levels.

    Figure 1: Dwarf Fortress running on a Google Pixel 3

    These experiments were performed on a Google Pixel 3 running Android 12. A medium region with 125 year history generates in approximately 10 minutes. An initial 3x3 embark in that world appears to run at full speed (100FPS).

    Methods

    1. Install Termux

    Termux is a terminal emulator for Android, which is available on F-droid [6], a repository for open source Android applications. It is possible to download Termux from the Google Play Store, but it is no longer supported and no longer receives updates.

    2. Install PRoot

    PRoot, along with the linux distributions, can be installed while in Termux by typing the command pkg install proot-distro.

    3. Setting up the Debian environment

    To install debian, type proot-distro install debian. You can try to use a different distribution to run Dwarf Fortress, but note that I was unable to get Dwarf Fortress to run under ArchLinux.

    Enter the debian environment by typing proot-distro login debian. Update the package lists in the debian environment with apt update.

    4. Install box64

    Many modern Android phones run on the arm64 architecture, and thus require box64 and the 64-bit Dwarf Fortress program. If your phone is 32-bit, then you need box86 and the 32-bit Dwarf Fortress program instead. The rest of the sections will assume that you are running an arm64 device.

    Install wget (apt install wget).

    With wget, you can install box64 from many sources. Here we will be using the sources defined in Pi-Apps [5], a collection of install scripts for Raspberry Pi. Add the repository to your sources with wget https://ryanfortner.github.io/box64-debs/box64.list -O /etc/apt/sources.list.d/box64.list and wget -qO- https://ryanfortner.github.io/box64-debs/KEY.gpg | apt-key add - to add the GPG key to your trusted sources list. It is probably safe to ignore any warnings.

    Update your package lists with apt update, and then install box64 with apt install box64. box64 is now installed.

    5. Setting Up Dwarf Fortress

    Download the 64-bit version of Dwarf Fortress from the main website [7]. It can be extracted with the command tar -xvf [filename]. Using your command line text editor of choice (vim, emacs, nano; may require further installation), modify the init.txt file to [PRINT_MODE:TEXT]. (Note that I also set [SOUND:NO], but others have reported functional sound).

    Modify the df script file in the text editor. Prefix the last line with box64, so that the line reads box64 ./libs/Dwarf_Fortress "$@" # Go, go, go! :)

    6. Install Required Libraries

    Run ./df. Note the missing libraries and install them. Repeat until Dwarf Fortress launches without issue.

    (I have forgotten exactly which libraries and packages that I installed. If someone could compile a list of packages required, I will update this guide.)

    ∞. Quality of Life

    The default font in Termux renders dwarves as emoji smiley faces. To change the font, install Termux:Styling from F-Droid. While in Termux, long press the screen, press More... > Style > Choose Font and change to your choice of font.

    Figure 2: Dwarves as emoji

    To customize the top bar of the virtual keyboard, edit the ~/.termux/termux.properties file (while not in debian). To add various commonly-used buttons, I have added the following lines:

    extra-keys= [ \ ['ESC','CTRL','<','PGUP','HOME','UP','END','-'], \ ['TAB','ALT','>','PGDN','LEFT','DOWN','RIGHT','+'] \ ] 

    Volume Up + [NUMBER] can be used to emulate F1-F10, which is useful when using hotkeys. Macros do not appear to work. Shift as a modifier key does not appear to work, though may be implemented in future versions of Termux [8].

    Replacing the ~/.termux/font.ttf file allows you to use one custom ttf font in the terminal. A DF_Curses ttf font can be downloaded here.

    A bluetooth keyboard is theoretically recommended, but has not yet been tested by the author.

    Future Work

    There have been reports that sound functions through this setup, although I have not yet tested this. Additionally, it may be possible to run a window manager to run Dwarf Fotress in graphical mode, or send the output to a VNC server, but I have yet to test these possibilities. Further research is required to determine whether Dwarf Fortress in graphical mode is possible on mobile devices.

    Conclusion

    It is possible to run Dwarf Fortress locally on an Android device with acceptable performance.

    [1] https://www.reddit.com/r/dwarffortress/comments/go0mh/any_way_to_get_dwarf_fortress_to_run_in/
    [2] http://dwarffortresswiki.org/index.php/DF2014:Utilities#Remote_playing_tools
    [3] https://www.reddit.com/r/dwarffortress/comments/38fvbg/i_present_my_portable_dwarf_fortress_machine_aka/
    [4] https://github.com/ptitSeb/box64
    [5] https://github.com/Botspot/pi-apps
    [6] https://www.f-droid.org/
    [7] https://bay12games.com/dwarves/older_versions.html
    [8] https://github.com/termux/termux-app/pull/2237

    submitted by /u/eniteris
    [link] [comments]

    [Kruggsmash] Waddlesquash #7: Trail of the Cresent Moon

    Posted: 03 Dec 2021 10:23 AM PST

    Dead Civ start - promoting marriages

    Posted: 03 Dec 2021 02:14 PM PST

    I finally managed to make a dead civ start and I need to start breeding dwarves and Im wondering if there is some kinda script for dfhack or therapist that would give you the highest number of compatible dwarf pairs for baby making. Because it seems that in the present version of DF it is very hard to get dwarves to marry at least for me, ive had 15 dwarves or so for idk 6+ years now and the highest tier relationship is Friend. Im going to probably use 2 bed bedrooms to pair them but i would like to figure out a good way to pair them such that i can get as many pairs as possible that has as high probability as possible to actually merry.

    submitted by /u/fistiano_analdo
    [link] [comments]

    No comments:

    Post a Comment