v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "Utility:DFHack"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(46 intermediate revisions by 15 users not shown)
Line 1: Line 1:
 
{{Quality|Superior|13:02, 2 May 2014 (UTC)}}
 
{{Quality|Superior|13:02, 2 May 2014 (UTC)}}
 
{{uv|multiple}}
 
{{uv|multiple}}
'''DFHack''' is an extensive standardized memory access library, packaged alongside a suite of basic tools that use it. Currently tools come in the form of plugins, as well as Lua and Ruby scripts. For developers, DFHack is a comprehensive, standardized memory access package that unites the various ways tools access the Dwarf Fortress memory space, allowing for easier development of new tools. For users, it is a very useful utility complex that allows users to tweak their games in numerous ways in-game. This is probably one of the most useful and most-used utilities for the game, after [[Utilities#Dwarf Therapist|Dwarf Therapist]] and the [[tileset]]s, and is included in recent versions of the [[Utility:Lazy Newb Pack|Lazy Newb Pack]] on all platforms.
+
{{Infobox utility
 +
| image = File:Dfhack-logo.png
 +
| misc  =
 +
* [https://github.com/DFHack/dfhack/releases Download]
 +
* [https://docs.dfhack.org/en/stable/docs/Installing.html#installing Installation guide]
 +
* [https://docs.dfhack.org/en/stable/index.html Documentation]
 +
}}
 +
[[File:dfhack_cmd.png|thumb|300px|right|Command ready!]]
 +
'''DFHack''' is a [[utility]] that can be used to improve UI, automate some aspects of the game, add features, fix bugs, or make a specific one-off change.
  
For an exhaustive list of and manual on the commands in the utility, see the [https://github.com/peterix/dfhack#commands GitHub documentation]. This wiki also has a [[Utility:DFHack/Programming|DFHack programming page]].
+
DFHack is an extensive standardized memory access library, packaged alongside a suite of basic tools that use it. Currently, tools come in the form of plugins, as well as Lua and Ruby scripts. For developers, DFHack is a comprehensive, standardized memory access package that unites the various ways tools access the ''Dwarf Fortress'' memory space, allowing for easier development of new tools. For users, it is a very useful utility complex that allows users to tweak their games in numerous ways in-game. This is probably one of the most useful utilities for DF, acting as an advanced expansion that fixes, improves and adds to the game in many ways, and is usually included in recent versions of the [[Utility:Lazy Newb Pack|Lazy Newb Pack]] on all platforms.
  
If you are using DFHack, '''do not report bugs on the Dwarf Fortress bug tracker''' unless you can prove that the bug is not being caused by DFHack or one of its plugins.
+
== Download and Install==
 +
All new releases are announced in a [http://www.bay12forums.com/smf/index.php?topic=164123.0 thread on the Bay12 forums]. Downloads for all releases can be found on [https://github.com/dfhack/dfhack/releases GitHub], and the latest dev build can be found [https://dfhack.org/builds/ here], though its stability is not guaranteed. DFHack is currently available as a stable release for 0.47.05. Stable releases are also available for 0.42.06, 0.40.24, 0.34.11, 0.31.25, and other intermediate versions of DF. DFHack is currently also being ported to versions 0.28.181.40d and 0.23.130.23a - more information can be found [[User:Quietust#DFHack-40d|here]] and [[User:Quietust#DFHack-23a|here]], respectively. For an exhaustive list of and manual on the commands in the utility, see the [https://dfhack.readthedocs.org/en/stable/#user-manual documentation].
  
==Installation==
+
* [https://github.com/DFHack/dfhack/releases Download] [https://docs.dfhack.org/en/stable/docs/Installing.html#installing Installation guide] [https://docs.dfhack.org/en/stable/index.html DFHack's documentation]
If you use a [[Utility:Lazy Newb Pack|recent edition of the Lazy Newb Pack]], DFHack is already installed and configured; otherwise see the instructions on [http://www.bay12forums.com/smf/index.php?topic=139553 the Bay12 forum thread] for separate installation.  The project is currently hosted on GitHub; for source, binaries, and a detailed discussion of how the program works, see [https://github.com/DFHack/dfhack here]. All new releases are announced in a [http://www.bay12forums.com/smf/index.php?topic=139553 thread on the Bay12 forums]. DFHack works on Windows XP, Vista, 7, any modern Linux distribution, and OS X 10.6 and later. On Windows, you have to use the SDL version of DF. Currently, version 0.34.11 is supported (and tested). If you need DFHack for older versions, look for older releases.
 
  
DFHack is currently also being ported to Dwarf Fortress versions 0.28.181.40d and 0.23.130.23a - more information can be found [http://dwarffortresswiki.org/index.php/User:Quietust#DFHack-40d here] and [http://dwarffortresswiki.org/index.php/User:Quietust#DFHack-23a here], respectively.
+
== Features ==
  
==Common Uses==
+
User Interface improvements. Such as:
DFHack is often used to automate some aspects of the game, add features, fix bugs, or to make a specific one-off change.
+
* Search function in screens with big lists.
 +
* Ability to place furniture before it's built and have it automatically allocated when available.
 +
* Ability to place constructions with box select (like laying designations), including easier material selection and open space placement (without having to wait till adjacent constructions are built).
 +
* Easier pasturing, live happiness monitor, mouse support, stocks dashboard, and embark-assistant.
  
===Automation===
+
Various automation of job and fortress management. Such as: 
See: workflow, autolabor, autobutcher, autochop, autonestbox, seedwatch, df-ai, dwarf manipulator. 
+
* workflow - Advanced [[Workshop#Management|Workshop Management]] allowing control of repeat jobs.
 +
* manipulator - Manage dwarven [[Labour]]s, an in-game equivalent to the popular program [[Dwarf Therapist]].
 +
* autolabor - Automatically manage dwarf labors to efficiently complete jobs
 +
* autobutcher - Assigns lifestock for slaughter once it reaches a specific count.
 +
* autochop - Automatically manage tree cutting designation to keep available logs within given quotas.
 +
* autonestbox - Assigns unpastured female egg-layers to nestbox zones.
 +
* seedwatch - Watches the numbers of seeds available and enables/disables seed and plant cooking.
 +
* df-ai - ?
  
===One-off changes===
+
Other scripts and plugins. Such as:
Includes commands like "cleanowned scattered x" or "reveal".
+
* [https://docs.dfhack.org/en/stable/docs/guides/quickfort-user-guide.html Quickfort] a utility that helps you build fortresses from "blueprint".
 +
* [[Stonesense]] an isometric visualizer of the map.
 +
* [[Utilities#Isoworld|Isoworld]] integration.
 +
* Gameplay Extras. Such as: Steam engines, power meter, improved siege engines.
 +
* Binary patches. Utilities made by users to fix known bugs that haven't been addressed by [[main:Toady One|Toady One]] yet. DF2014 is in active development, so there are no binary patches yet.
 +
* Adventure mode. See: [https://dfhack.readthedocs.io/en/stable/docs/_auto/gui.html#gui-advfort advfort],[https://dfhack.readthedocs.io/en/stable/docs/_auto/gui.html#gui-companion-order companion-order].
  
===Additional features===
+
== Common use ==
Steam engines, power meter, improved siege engines.
+
{{TipBox2|float=center|titlebg=red|width=80%|Bug reports|
 +
<small>If you are using DFHack (or other utilities), do not report bugs on the ''Dwarf Fortress'' bug tracker unless you can prove that the bug is not being caused by DFHack or one of its plugins. On Linux and OS X, DFHack can be bypassed by running the "df" script. On Windows, DFHack can be temporarily disabled by renaming SDL.dll to a temporary name, then renaming SDLreal.dll to SDL.dll.</small>
 +
}}
  
===Stonesense===
+
{| class=wikitable
DFHack comes with [[Stonesense]] by default (except for unofficial r4 builds).
+
! Command
 
+
! Description
===Isoworld===
+
|-
DFHack also has [[Isoworld]] integration.
+
| <code>[https://docs.dfhack.org/en/stable/docs/Plugins.html#prospector prospect]</code>
 
+
| To prospect embark location for a list of all the present minerals and plants.
===Adventure mode===
+
|-
See: advfort, companion-order.
+
| <code>digv</code>
 +
| Designates a whole vein for digging.
 +
|-
 +
| <code>reveal</code>
 +
| This reveals the map.  
 +
|-
 +
| <code>cleanowned scattered x</code>
 +
|
 +
|-
 +
|
 +
|
 +
|-
 +
|<code>[https://docs.dfhack.org/en/stable/docs/_auto/base.html#exportlegends exportlegends]</code><br>
 +
<code>[https://docs.dfhack.org/en/stable/docs/_auto/base.html#open-legends open-legends]</code>
 +
| For viewing and exporting [[Legends mode]] information.
 +
|}
  
 
==Scripts and Plugins==  
 
==Scripts and Plugins==  
  
Originally a simple memory hacking tool, DFHack has grown to become a full-fledged unofficial extension of the game itself, adding in functionality where official development has lacked. One of the best features of DFHack is it's extensibility - anyone can create scripts or plugins. Due to its open-source and collaborative nature, anyone can add their own contribution to this tool. There are different kinds of contributions:
+
Originally a simple memory hacking tool, DFHack has grown to become a full-fledged unofficial extension of the game itself, adding in functionality where official development has lacked. One of the best features of DFHack is its extensibility - anyone can create scripts or plugins. Due to its open-source and collaborative nature, anyone can add their own contribution to this tool. There are different kinds of contributions:
  
    Binpatches are raw memory edits that alter the game's behavior, which is usually deduced from disassembling. Their main use is bugfixing or the removal of cumbersome, easily alterable constraints.  
+
*Binpatches are raw memory edits that alter the game's behavior, which is usually deduced from disassembling. Their main use is bugfixing or the removal of cumbersome, easily alterable constraints.  
    Plugins are snippets of C++ code that uses DFHack's library to fix bugs or add functionality. They must be compiled before use and are thus platform and dfhack-version dependent. They can be found in the hack/plugins folder.
+
*Plugins are snippets of C++ code that uses DFHack's library to fix bugs or add functionality. They must be compiled before use and are thus platform and dfhack-version dependent, but as a result they tend to be extremely ''fast''. They can be found in the hack/plugins folder.
    Scripts are files written in a scripting language DFHack provides bindings for (usually Lua or Ruby) that when loaded by DFHack fix bugs or add functionality. Contrary to plugins, they are not compiled and can be transferred between any platform. However any change within the DFHack data structures (i.e. between versions) may break some of these scripts.  
+
*Scripts are files written in a scripting language DFHack provides bindings for (usually Lua or Ruby) that when loaded by DFHack fix bugs or add functionality. Contrary to plugins, they are not compiled and can be transferred between any platform. However any change within the DFHack data structures (i.e. between versions) may break some of these scripts. However, because they run in an interpreter they are unsuitable for tasks which involve large amounts of data (such as revealing the map).
  
 
Some of the more notable are listed below; feel free to add to the list.
 
Some of the more notable are listed below; feel free to add to the list.
Line 63: Line 103:
 
* [http://www.bay12forums.com/smf/index.php?topic=135506 Miscellaneous DFHack script collection]
 
* [http://www.bay12forums.com/smf/index.php?topic=135506 Miscellaneous DFHack script collection]
  
=== Cheating ===
+
[[Category:Utilities]]
These plugins and scripts allow cheating to various degrees. Some are covered more in-depth than the Readme on this wiki:
 
* [[/createitem/]]: Creates arbitrary items made of any material at the feet of a unit
 

Revision as of 17:04, 18 January 2022

This utility page applies to multiple versions of DF.
DFHack
Dfhack-logo.png
Information
Command ready!

DFHack is a utility that can be used to improve UI, automate some aspects of the game, add features, fix bugs, or make a specific one-off change.

DFHack is an extensive standardized memory access library, packaged alongside a suite of basic tools that use it. Currently, tools come in the form of plugins, as well as Lua and Ruby scripts. For developers, DFHack is a comprehensive, standardized memory access package that unites the various ways tools access the Dwarf Fortress memory space, allowing for easier development of new tools. For users, it is a very useful utility complex that allows users to tweak their games in numerous ways in-game. This is probably one of the most useful utilities for DF, acting as an advanced expansion that fixes, improves and adds to the game in many ways, and is usually included in recent versions of the Lazy Newb Pack on all platforms.

Download and Install

All new releases are announced in a thread on the Bay12 forums. Downloads for all releases can be found on GitHub, and the latest dev build can be found here, though its stability is not guaranteed. DFHack is currently available as a stable release for 0.47.05. Stable releases are also available for 0.42.06, 0.40.24, 0.34.11, 0.31.25, and other intermediate versions of DF. DFHack is currently also being ported to versions 0.28.181.40d and 0.23.130.23a - more information can be found here and here, respectively. For an exhaustive list of and manual on the commands in the utility, see the documentation.

Features

User Interface improvements. Such as:

  • Search function in screens with big lists.
  • Ability to place furniture before it's built and have it automatically allocated when available.
  • Ability to place constructions with box select (like laying designations), including easier material selection and open space placement (without having to wait till adjacent constructions are built).
  • Easier pasturing, live happiness monitor, mouse support, stocks dashboard, and embark-assistant.

Various automation of job and fortress management. Such as:

  • workflow - Advanced Workshop Management allowing control of repeat jobs.
  • manipulator - Manage dwarven Labours, an in-game equivalent to the popular program Dwarf Therapist.
  • autolabor - Automatically manage dwarf labors to efficiently complete jobs
  • autobutcher - Assigns lifestock for slaughter once it reaches a specific count.
  • autochop - Automatically manage tree cutting designation to keep available logs within given quotas.
  • autonestbox - Assigns unpastured female egg-layers to nestbox zones.
  • seedwatch - Watches the numbers of seeds available and enables/disables seed and plant cooking.
  • df-ai - ?

Other scripts and plugins. Such as:

  • Quickfort a utility that helps you build fortresses from "blueprint".
  • Stonesense an isometric visualizer of the map.
  • Isoworld integration.
  • Gameplay Extras. Such as: Steam engines, power meter, improved siege engines.
  • Binary patches. Utilities made by users to fix known bugs that haven't been addressed by Toady One yet. DF2014 is in active development, so there are no binary patches yet.
  • Adventure mode. See: advfort,companion-order.

Common use

Bug reports

If you are using DFHack (or other utilities), do not report bugs on the Dwarf Fortress bug tracker unless you can prove that the bug is not being caused by DFHack or one of its plugins. On Linux and OS X, DFHack can be bypassed by running the "df" script. On Windows, DFHack can be temporarily disabled by renaming SDL.dll to a temporary name, then renaming SDLreal.dll to SDL.dll.


Command Description
prospect To prospect embark location for a list of all the present minerals and plants.
digv Designates a whole vein for digging.
reveal This reveals the map.
cleanowned scattered x
exportlegends

open-legends

For viewing and exporting Legends mode information.

Scripts and Plugins

Originally a simple memory hacking tool, DFHack has grown to become a full-fledged unofficial extension of the game itself, adding in functionality where official development has lacked. One of the best features of DFHack is its extensibility - anyone can create scripts or plugins. Due to its open-source and collaborative nature, anyone can add their own contribution to this tool. There are different kinds of contributions:

  • Binpatches are raw memory edits that alter the game's behavior, which is usually deduced from disassembling. Their main use is bugfixing or the removal of cumbersome, easily alterable constraints.
  • Plugins are snippets of C++ code that uses DFHack's library to fix bugs or add functionality. They must be compiled before use and are thus platform and dfhack-version dependent, but as a result they tend to be extremely fast. They can be found in the hack/plugins folder.
  • Scripts are files written in a scripting language DFHack provides bindings for (usually Lua or Ruby) that when loaded by DFHack fix bugs or add functionality. Contrary to plugins, they are not compiled and can be transferred between any platform. However any change within the DFHack data structures (i.e. between versions) may break some of these scripts. However, because they run in an interpreter they are unsuitable for tasks which involve large amounts of data (such as revealing the map).

Some of the more notable are listed below; feel free to add to the list.

User Interface

The best-known are Falconne's UI Plugins, a collection which improves the in-game interface with features such as search functions in screens with big lists, the ability to place furniture before it's built and have it automatically allocated when available, box-select constructions(like laying designations) - including easier material selection and open space placement, easier pasturing, live happiness monitor, mouse support, and an enhanced stocks screen. The plugins make existing tasks significantly easier, and also add new functions to the game which greatly enhance the experience - such as the autochop log quotas, or the ability (with buildingplanner) to lay out rooms with Quickfort before creating the required furniture.

There is also a GUI for the Autobutcher plugin.

Bugfixing

Many bugfixes are included with DFHack, but not enabled by default - check dfhack.init to see if the "tweak *" and "fix/*" lines are commented out. The Starter Packs enable all bugfixes by default.

Features

These plugins and scripts add features to the game that enhance the user's gameplay.

  • Digging invaders, a plugin that allows hostiles to dig and deconstruct walls to path to one's fortress.
  • Rendermax, a plugin that implements a lighting system at the graphics level.
  • Dwarven Emigration, a plugin that allows unhappy dwarves to emigrate with their families.

Modding tools

These plugins and scripts add features to the game that enhance modding possibilities.