Skip to content
marcuspenatePublic

About

DFPlex for Dwarf Fortress 53 (Steam): co-op fortress mode where every player gets DF's own menus. DFHack plugin. Mirror; issues welcome here.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

32 Commits

Folders and files

Repository files navigation

dfplex: multiplayer fortress mode for Dwarf Fortress 53

Several people play one fortress at the same time, each with their own copy of Dwarf Fortress and their own screen. One player hosts the fort; the others join over the network. Every player gets DF's real interface — their own menus, camera, zoom and window size — so one person can be setting up a stockpile while another designates a mine and a third reads a dwarf's thoughts.

dfplex is a DFHack plugin. It brings back DFPlex by white-rabbit (original Bay 12 Forums thread), which did this for DF 0.47, rewritten for the Steam version's new interface.

The host reads a dwarf's sheet while a second player marks plants to gather; each sees the other

Left: the host's window. Right: a player who joined. The host sees what Kib is selecting (tinted in Kib's colour) while reading a dwarf's sheet; both see the chat and each other's view on the minimap.

Features

  • Your own menus. Each player opens their own windows and tools: designations, stockpiles, buildings, unit sheets, work orders, all of DF's own UI. Each player also has their own camera, zoom and window size.
  • See each other. Other players' mouse cursors and names show on the map, and where they are looking shows on the minimap. The area someone is selecting, or the building they are placing, shows in their colour before they confirm it.
  • Shared menus. When two players have the same stockpile, zone, building or work order open, the panel turns orange with "NAME is here too". DF keeps whoever changes it last.
  • Chat and pings. Ctrl-T opens chat. Ctrl-X marks the spot under your mouse for everyone. /follow NAME, /goto NAME and /goto ping move your camera.
  • Pausing. Every player has pause and play buttons. The host decides who may pause: anyone, only the host, or consensus: anyone can pause, and the game resumes only when everyone who paused has pressed play again.
  • Reconnects. A dropped connection reconnects by itself. Leave and rejoin under the same name within a few minutes and your open menus and view come back.
  • Host controls. Password, player limit, kick and ban. DF's options menu (save, settings, quit) stays with the host.
  • In-game window. Ctrl-Shift-M opens it, also from the title screen. It hosts, joins, remembers the last game and lists the players.
Shared stockpile Someone else's selection
Both players have the same stockpile open; it turns orange with "Urist is here too" Another player's selection box, tinted blue and labelled "Kib: gather (7x6)"

Requirements

  • Dwarf Fortress 53.17 (Steam) and DFHack 53.17-r1 (the DFHack app on Steam), on every player's computer. Every player needs their own copy of Dwarf Fortress.
  • Hosting: Linux. Joining: Linux or Windows. The host needs two DF-internal functions that have only been located in the Linux build so far.
  • Each dfplex release matches one DF and DFHack version. After a DF update, hosting refuses to start ("unsupported DF binary") until a new dfplex release is out.

Installing

Steam Workshop: subscribe to dfplex on the Steam Workshop, start Dwarf Fortress with DFHack and press Ctrl-Shift-M. When DFHack starts, the mod copies the plugin into DFHack's hack/plugins folder and loads it, replacing a dfplex installed by hand; nothing has to be added to a world. dfplex-install in the DFHack console shows what it did. If DFHack has been updated and dfplex not yet, it installs nothing, and Ctrl-Shift-M says so.

By hand: download the package for your system from the releases. Unpack its hack folder into the folder that holds DFHack's own hack folder, merging the two:

Steam DFHack app DFHack installed by hand
Linux ~/.local/share/Steam/steamapps/common/DFHack/ the Dwarf Fortress folder
Windows ...\steamapps\common\DFHack\ the Dwarf Fortress folder (next to Dwarf Fortress.exe)

That puts dfplex.plug.so (Linux) or dfplex.plug.dll (Windows) in hack/plugins/, next to DFHack's own plugins, and dfplex.lua in hack/scripts/gui/. Start Dwarf Fortress as usual and press Ctrl-Shift-M: the dfplex window opens.

Hosting a game

  1. Load your fortress.
  2. Press Ctrl-Shift-M, then Host (or type dfplex host in the DFHack console).
  3. Give the other players your address and the password.

Players connect to TCP port 8765. On a home network that just works. Over the internet, the easiest way is a VPN that puts you on one network (Tailscale, ZeroTier, ...); otherwise forward port 8765 on your router to the host.

Settings are in dfhack-config/dfplex.json, in the Dwarf Fortress folder. dfplex creates it the first time it runs:

Setting Default
password "" Set one. Empty lets anyone who can reach the port join.
host_name "host" Your name as the other players see it.
port, bind 8765, "0.0.0.0" Where to listen.
max_players 8 Players besides the host.
pause "anyone" anyone, host or consensus (also in the window, or dfplex pause RULE).
rejoin_minutes 10 How long a player who left keeps their menus and view.
bans [] IP addresses or name:NAME; managed with dfplex ban / dfplex unban.

Restart hosting after editing the file.

Joining a game

Press Ctrl-Shift-M (the title screen is fine), fill in the host's address (a name or an IP address), your name and the password, and choose Join. Your DF then shows the host's fortress. The window remembers the last game, so next time Ctrl-Shift-M then J is enough.

From the DFHack console: dfplex join HOST NAME PASSWORD, or just dfplex join for the last game.

Playing

Key
Ctrl-T chat (Enter sends, Esc cancels). /help lists the chat commands: /who, /follow NAME, /unfollow, /goto NAME, /goto ping
Ctrl-X mark the spot under your mouse for everyone
Ctrl-Shift-M the dfplex window
Ctrl-Shift-L leave the game (players)

The bottom right shows who is playing, whether the game is paused and why, and the chat. A player leaves with Esc until no menu is open, Esc once more, then Enter.

Console commands (the host's in particular): dfplex status, dfplex kick PLAYER [REASON], dfplex ban PLAYER, dfplex unban ENTRY, dfplex bans, dfplex pause RULE, dfplex chat TEXT, dfplex host stop. help dfplex lists them all.

Security

dfplex traffic, including the password, is not encrypted, and a player who joins can do anything in the fortress except open DF's options menu. Play with people you trust, set a password, and prefer a LAN or a VPN over opening the port to the internet.

Known limitations

  • Windows can join but not host.
  • One DF/DFHack version per release; DF updates need a new dfplex.
  • On the stock DFHack build, DFHack's own overlay widgets in a player's view can sometimes follow what the host's screen shows. DFHack lacks an export dfplex needs for this: patches/dfhack-export-clearFocusStringCache.patch, being proposed upstream.
  • Floor edges and shadows can draw slightly differently on Windows.

Reporting bugs and crashes

Open an issue at https://github.com/marcuspenate/dfplex/issues. If DF crashed, attach these before you start DF again, because DF overwrites its log:

  1. stderr.log from the Dwarf Fortress folder. Its last dfplex ... lines show how far things got.
  2. On Windows, the crash record: Win+R, eventvwr.msc, Windows Logs > Application, the "Application Error" entry for Dwarf Fortress.exe (it has "Faulting module name" and "Fault offset").
  3. Which dfplex you have (the name of the file you downloaded), and what you were doing (joining, opening a menu, leaving...).

Building from source

dfplex builds as an external plugin inside a DFHack source tree of the matching version.

git clone --recursive --branch 53.17-r1 https://github.com/DFHack/dfhack
git clone https://github.com/marcuspenate/dfplex dfhack/plugins/external/dfplex
cd dfhack
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
ninja -C build dfplex

If plugins/external/CMakeLists.txt existed before, add add_subdirectory(dfplex) to it. DFHack's build needs the usual DFHack build dependencies (see DFHack's docs; on Arch/Manjaro also perl-xml-libxslt).

To install into a DFHack folder, use the install step rather than copying the built .so, so the plugin finds DFHack's libraries:

cmake -DCMAKE_INSTALL_PREFIX=STAGE -P build/plugins/external/dfplex/cmake_install.cmake

then copy STAGE/hack over the DFHack folder.

Windows builds are cross-compiled with MSVC under Wine in DFHack's own build container: tools/build-win64, then tools/package-win64. tools/package-linux makes the Linux package, and tools/package-workshop the Steam Workshop mod from the two packages. docs/DESIGN.md explains how dfplex works, and docs/ORIGINAL.md how the original DFPlex did.

Credits and license

dfplex is a port of DFPlex to DF 53, rewritten for its new interface, and is distributed under the same Zlib license (LICENSE). The original DFPlex/DFHack license text is in docs/LICENSE-original-dfplex.rst. Dwarf Fortress is by Bay 12 Games; dfplex is not affiliated with Bay 12 Games or Kitfox Games.

About

DFPlex for Dwarf Fortress 53 (Steam): co-op fortress mode where every player gets DF's own menus. DFHack plugin. Mirror; issues welcome here.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages