Releases: BenLubar/df-ai
0.44.05-r2
Installation instructions
Please use Update 1 instead. 0.44.05-r2 does not work correctly on Linux or Mac OS X.
Changes since the previous version
DFHack compatibility
df-ai makes a lot of assumptions about Dwarf Fortress's behavior, but some of those assumptions can be incorrect when other DFHack plugins or scripts are enabled. This update fixes many of the most common incompatibilities.
- Unexpected DFHack viewscreens are now logged, just like unexpected Dwarf Fortress viewscreens.
fix/merchants
- Fixed a soft lock when a guild representative arrives at the trade depot. (#39)warn-starving
- Fixed a soft lock when this script was run while a dwarf or a visitor was starving or dehydrated. (#37)gui/extended-status
- Fixed a soft lock when updating stocks (if JSON events are enabled), or when convicting a dwarf of a crime. (#37)gui/load-screen
- Fixed a soft lock when embarking. (#41)
Exclusive mode
Exclusive mode allows df-ai to show what it is doing by pressing at most one key per frame.
- Game over state is detected and handled during exclusive mode contexts.
- Exclusive mode contexts can now be queued to run as soon as possible instead of only one exclusive context being allowed at a time.
- Fixed an edge case where exclusive mode could exit early.
- Embarking now detects and handles some DFHack viewscreens. See the DFHack compatibility section for details.
- Manager orders are now entered in exclusive mode.
- The AI can enter some orders that aren't normally able to be entered through this interface. For example, engraving slabs is not usually possible through manager orders. However, cheating here is a lot easier than implementing a separate job management system just for slabs, and doesn't significantly change gameplay or make it less difficult.
- The list of manager orders is filtered by entering the first word of the order, or in the case of some common words, a later word, before selecting it. Care has been taken to handle cases like slabbing where non-ASCII characters may be in the first word.
- See the Military management section for more changes related to exclusive mode.
Lockstep improvements
Lockstep mode has had some stability improvements and should crash or hang much less often. In addition, disabling lockstep mode is now possible without restarting the game.
- Lockstep mode no longer takes over if the intro video is playing.
- Lockstep mode will stop recording a CMV when entered or exited.
- It will immediately start a new recording if
record_movie
is enabled indfhack-config/df-ai.json
. - The first CMV recorded in a lockstep-enabled session includes the console output.
- A CMV that is recording when lockstep mode exits is no longer corrupted.
- It will immediately start a new recording if
unload df-ai
anddisable df-ai
no longer happen immediately if lockstep mode is enabled. Lockstep mode will shut down before the plugin is unloaded or disabled.disable df-ai
while in lockstep mode will automatically try again after lockstep mode exits.- There should no longer be a crash when exiting the game during lockstep mode, such as when
no_quit
is set to false. - CMV files produced in lockstep mode do not contain a sound header, so they are about 12 kilobytes smaller per file. The limit per file remains at around 5 megabytes.
Military management
Military management has always been a weak point of df-ai. This update improves the handling of some situations where a fortress could die slowly if nothing was done to change the status quo.
- Citizens will be dismissed from the military if there are fewer than 1 civilian for every 3 soldiers.
- This mirrors the already-existing rule to draft new soldiers so that there is at least 1 soldier for every 3 civilians.
- Soldiers with more total skill experience will be dismissed before soldiers with less experience overall, which also mirrors the logic used to draft new soldiers.
- Squad leaders with subordinates and non-citizen residents are never dismissed from the military.
- Mercenaries recruited through the tavern are now drafted into the military as soon as possible.
- Soldier management now uses an exclusive context:
- If a squad has space for a soldier, they are added to the squad's first available slot.
- New squads will be created in this order: ranged, melee, melee.
- If an appropriate uniform does not exist, one will be created. The AI uses metal armor and a shield for both melee and ranged squads.
- Squad kill orders now use an exclusive context and should no longer disappear when there is an incompatibility between df-ai's logic and Dwarf Fortress's logic.
- Squad kill orders now report a reason for being added or removed in the log.
Blueprint/Plan
A small change was made to the blueprint system to improve the speed of the initial setup of fortresses.
- The
dig_immediate
mode now pauses all other build queues until digging is completed in addition to not waiting in the queue itself. - The default legacy plan now builds five rooms before any of the living space such as bedrooms and dining rooms:
- Masons' workshop
- Carpenters' workshop
- Farm plot (food)
- Farm plot (cloth)
- Garbage dump
0.44.05-r1
Installation instructions
- Download and extract Dwarf Fortress 0.44.05.
Windows (32-bit) - Linux (32-bit) - Mac OS X (32-bit) - Install DFHack 0.44.05-r1.
- Place the
df-ai.plug.*
file inhack/plugins
. - Extract the
df-ai-blueprints
folder fromdf-ai-assets.zip
into the Dwarf Fortress root (the same folder ashack
anddfhack-config
). - Enter
enable df-ai
into the DFHack console.
Changes since the previous version
This update is mostly just to keep df-ai usable on a new version of Dwarf Fortress and DFHack. There are no significant new features.
- Updated code to work with the data structure changes for DFHack 0.44.xx.
- Removed things that no longer make sense as of Dwarf Fortress 0.44.xx:
- Trees suspected to have dwarves stuck in them are no longer cut down as dwarves no longer get stuck in trees.
- Removed the news given by the outpost liaison from the log as the news is now just a message saying to view the civilization screen.
- Reorganized plan verbosity levels so that lower levels always give less specific information.
- Added comments to the
dfhack-config/df-ai.json
file describing what each option does and its possible values.
0.43.05-r3
Installation instructions
- Download and extract Dwarf Fortress 0.43.05.
Windows (32-bit) - Linux (32-bit) - Mac OS X (32-bit) - Install DFHack 0.43.05-r3.
- Place the
df-ai.plug.*
file inhack/plugins
. - Extract the
df-ai-blueprints
folder fromdf-ai-assets.zip
into the Dwarf Fortress root (the same folder ashack
anddfhack-config
). - Enter
enable df-ai
into the DFHack console.
Changes since the previous version
Blueprints
The AI can now build a fort using a system based on the TileGen map generator in Alien Swarm: Reactive Drop.
- If generating a fortress layout from a blueprint fails too many times in a row, the AI will use the old layout generation system. You can disable this in
dfhack-config/df-ai.json
. - The blueprint plan included in this version attempts to replicate the layout from previous versions.
- Known issue: The legacy plan does not yet include a cistern.
- Some new rooms have been added in conjunction with new features:
- There are now jails near the infirmary.
- The underground farms are now irrigated without cheating.
- A work-in progress visual editor is now available for editing plans and rooms.
Weblegends integration
Wondering what the AI is doing, but don't want to stop it to check? View the current status of the AI in a web browser!
- Simply install weblegends 0.43.05-r3 in addition to df-ai to enable this functionality.
- Available views include a summary of the AI's status, an extended version of the
ai report
command, a live floor plan of the fortress, and the version of the df-ai plugin. - Additionally, new information has been added to
ai report
, such as a list of jobs, the available metals, any curses a citizen or visitor might have, and the reason a task has not yet completed.
Other improvements
- lockstep has received a few bugfixes, so it should be more stable now. If you still experience problems, try running df-ai with an empty
dfhack.init
file and adding the commands you want back one by one. - The AI now reports on criminal justice, assigns law enforcement administrators, and convicts criminals.
manage_labors
can now be set to"autolabor"
or"labormanager"
for additional automated setup of those plugins.- Soldiers are not assigned to train until their barracks has been excavated.
- Squads are now dismissed from attacking caged enemies that are not about to be thrown into a hole.
- The first squad is now a squad of marksdwarves to avoid being incapable of fighting birds until the third squad is created.
- The military is no longer sent to attack foreigners that fight citizens in self defense, such as when a citizen is a werebeast or has gone insane.
- The military will more consistently attack wild animals that are threatening the lives of citizens.
- The AI is now capable of building some additional furniture, like floor hatches, restraints, and cages.
- Trees containing stuck dwarves will be cut down.
- Metal items are now made in a more consistent way.
0.43.05-r2
Installation instructions
- Download and extract Dwarf Fortress 0.43.05.
Windows (32-bit) - Linux (32-bit) - Mac OS X (32-bit) - Install DFHack 0.43.05-r2.
- Place the
df-ai.plug.*
file inhack/plugins
. - Enter
enable df-ai
into the DFHack console.
Changes since the previous version
Lockstep Mode
Lockstep mode replaces the entire event loop of Dwarf Fortress, making Dwarf Fortress run inside df-ai instead of the other way around. This allows df-ai to make the game think it's running at the default frame rate regardless of how fast the game is actually running, and add information about what the AI is thinking to the recorded CMV files.
- Enable or disable lockstep mode at any time using
ai enable lockstep
orai disable lockstep
. - Lockstep mode is saved in
df-ai-config.json
, so it can also be toggled in that file if Dwarf Fortress is not running. - Dwarf Fortress will ignore all input while lockstep mode is active, but DFHack commands will work normally.
- Lockstep mode does not work with
[PRINT_MODE:TEXT]
, so Linux and Mac users that want headless df-ai will need Xvfb or a similar program and[PRINT_MODE:2D]
. - Lockstep mode modifies code in memory when it is enabled or disabled, so there is a risk of crashing Dwarf Fortress. However, there should not be any higher risk of crashing when not in the middle of toggling lockstep mode.
- Lockstep mode pretends to run at 100 simulation frames per second.
- Lockstep mode pretends to run at 50 graphical frames per second during gameplay and 100 graphical frames per second when menus are open.
- I say "pretends" because lockstep mode will run as fast as the resources given to Dwarf Fortress will allow it to run.
- If a CMV is already being recorded when lockstep mode is enabled, the console will not be displayed. To avoid this, restart Dwarf Fortress after enabling lockstep, or enable lockstep in
df-ai-config.json
before starting Dwarf Fortress.
Trading
df-ai now attempts to trade with merchants! Currently, the goods offered and requested are from a hard-coded list, but this may be extended in the future. This is also the first use of the "exclusive" mode in df-ai, where the AI can stop everything it's doing to focus on menus. Watch it in action!
- When a caravan arrives, dwarves are ordered to bring all prepared meals and food storage containers containing exclusively prepared meals to the depot.
- The broker is tracked, and if they are taking too long to arrive, other dwarves will be requested instead.
- If the trade goods take too long to arrive at the depot, trading will happen before all the goods have arrived.
- The dwarves will trade for (in order, from "need" to "would be nice to have"):
- Logs
- Anvils (only if none are available and a forge is waiting to be built)
- Books and other items containing writing
- Musical instruments
- The rest:
- Boulders
- Bars (metal, ash, soap, etc.)
- Cloth
- Leather
- Thread
- Cooking ingredients
- The AI does not attempt to handle modded worlds where multiple civilizations can arrive during the same season to trade. In this case, some caravans may be ignored, depending on the timing of arrival and departure.
- The AI will attempt to please civilizations opposed to plant murder, but wood products such as soap, certain types of glass, and decorations are not handled.
- Civilizations opposed to animal murder are also handled, but this has no effect in unmodded worlds.
- The AI will attempt to give the trader a good deal, starting with offering at least 110% of the requested value, and adding offerings or removing requests each time the trade is declined. Counter-offers are accepted immediately.
Fortress Layout
This update fixes several bugs that could ruin or halt the progress of a fortress. Steps have been taken to streamline the fortress building process and to make the AI more efficient.
- Fixed some cases where the AI would try to dig a room that was not connected to any room the dwarves could access and get stuck.
- The AI will no longer attempt to patch the floors it removed from the well.
- Room, furniture, and item types are now identified internally by numbers instead of text. This will make the AI faster as well as reduce the chance of bugs related to typos.
- Farms can now be built in places with trees or shrubs. The plants will be removed before the farm is built.
- Furniture-related tasks have been split into a separate queue, so having a large migrant wave no longer slows down workshop building by requesting a large amount of furniture.
- Claimed bedrooms, noble rooms, rooms being built while idle, and cavern exploration no longer count towards the limits of other room types being built.
- Rooms that are planned but not yet ready to be dug are highlighted in blue instead of yellow.
- Room priority has been modified. For example, the trade depot will now be built much earlier and the library and temple will be built much later.
- Certain rooms will be smoothed and then engraved when the AI is idle.
- Walls will no longer be smoothed if they are to be removed later.
- The dwarves will keep the pitting tower free of trees and other objects that could break the fall of its victims.
- Added an additional level below the fortress for food storage.
- The trade depot now has ramps on the eastern side if it is to the east of the fort entrance.
- Fixed some cases where aqueduct tunnels would not line up, causing flooding and death.
- Custom workshops and furnaces can now be built if you edit the floorplan manually.
Other Changes
- The camera position will be saved in more situations, most noticeably when migrants arrive.
- AI camera control can now be enabled and disabled while the game is running with
ai enable camera
andai disable camera
. - The AI no longer freezes when the outpost liaison greets a land-holding dwarf.
- Unpausing now happens after a specific number of frames, not an amount of real time.
- The AI is less interested in watching people sleep.
- Dwarves will now remove clothing from goblins even if they are outside.
- The embark information screens will now be displayed before confirming the embark location.
- Immigrant mothers will still drop their babies on the floor, but now they'll go back to pick them up. (See Dwarf Fortress bug 0005551.)
- Book bindings will be made, and library books will now be bound.
- Toys will be made for the children to play with.
- Above-ground farm plots will now consider biome when deciding what plants to grow.
0.43.05-r1
Installation instructions
- Download and extract Dwarf Fortress 0.43.05.
- Install DFHack 0.43.05-r1.
- Place the
df-ai.plug.*
file inhack/plugins
. - Enter
enable df-ai
into the DFHack console.
Changes since the previous version
- Added
ai version
command that gives exact version numbers of df-ai components.
0.43.05-beta1
Installation instructions
- Download and extract Dwarf Fortress 0.43.05.
- Install DFHack 0.43.05-beta1.
- Place the
df-ai.plug.*
file inhack/plugins
. - Enter
enable df-ai
into the DFHack console.
Changes since the previous version
- Low-level code changes to make df-ai compile on the new version of DFHack.
0.43.03-r1
Installation instructions
- Download and extract Dwarf Fortress 0.43.03.
- Install DFHack 0.43.03-r1.
- Place the
df-ai.plug.*
file inhack/plugins
. - Enter
enable df-ai
into the DFHack console.
Changes since the previous version
- Automatic labor and noble management can be disabled in the configuration file.
0.43.03-alpha1
Installation instructions
- Download and extract Dwarf Fortress 0.43.03.
- Install DFHack 0.43.03-alpha1.
- Place the
df-ai.plug.*
file inhack/plugins
. - Enter
enable df-ai
into the DFHack console.
Changes since the previous version
- AI control of the camera and the FPS meter can be disabled in the config file. See #4.
- Log messages that mention rooms now give more information about which room is being mentioned.
- Fixed some crashes that happened when embarking on a glacier.
- The message that appears when first contact is made with elves after no trees have been cut is now handled by the auto-unpause code.
- The AI now reports deaths.
- Mining mishaps such as missing staircases are now fixed immediately instead of waiting for the entire room to be dug.
- Manager orders are now entered using the UI.
- There is now an
ai report
command that gives much more detail than theai
command about what is going on in the game. - Ice boulders can be used to build constructions such as stairs.
- Squads are no longer sent to attack caged prisoners before they are marked for pitting.
- Training axes have been removed from the list of items the AI can request. See Dwarf Fortress bug 0000712.
ai
andai report
are disabled during embark. They did not produce useful information until the embark completed and sometimes would crash.- Reduced stocks spam.
- The depot entrance is no longer able to be placed under the wagon.
- Important dwarves such as the manager, broker, and bookkeeper are no longer able to be drafted into the military.
- The "new age" message is now dismissed even if it appears without a pause.
0.42.06-r1 update 2
Installation instructions
- Download and extract Dwarf Fortress 0.42.06.
- Install DFHack 0.42.06-r1.
- Place the
df-ai.plug.*
file inhack/plugins
. - Enter
enable df-ai
into the DFHack console.
Changes since the previous version
- Added
dfhack-config/df-ai.json
. The file will be created if it does not exist when Dwarf Fortress is started. - The AI will generate a new world if it runs out of possible embarks or there is no world set. To use an existing world, set
"random_embark_world" : "region1",
(or some other region number) in the config file. - Movie recording is now disabled by default.
- Site finder options can be adjusted in the config file.
- The
"wealth"
event has been added to df-ai-events.json. - Fixed some cases of messages being delayed (such as the
ai
command without the AI enabled).
0.42.06-r1 update 1
Installation instructions
- Download and extract Dwarf Fortress 0.42.06.
- Install DFHack 0.42.06-r1.
- Place the
df-ai.plug.*
file inhack/plugins
. - Enter
enable df-ai
into the DFHack console.
Changes since the previous version
- Bedrooms and pastures are now unassigned even if the game was saved between the owner dying and the next population update.
- Fixed trees not being designated for cutting.
- @lethosor has provided a Mac OS X build.