Update: quickfort is now part of the official DFHack release!The docs are available on the DFHack docs server:
This thread has also expanded from just quickfort development to support of the whole quickfort ecosystem:
Original first post:
I'm implementing quickfort inside of DFHack. Why would I do this? Well, a couple reasons:
- The original Quickfort is unmaintained, and is based on python2, which is slowly disappearing from the internet's collective consciousness
- DFHack can apply blueprints faster, can gracefully recover from errors, and can intelligently select building materials based on available items and player preferences
- There is an opportunity to integrate with other DFHack functionality, like generating workshop orders to build the items required for a blueprint
For those who are unfamiliar with quickfort/qfconvert, the idea is that you record the keys you want to play back in a spreadsheet. Quickfort moves the cursor to the position that corresponds to the cell in the spreadsheet and plays back the keystrokes. Quickfort runs in one of four modes: dig, build, place, and query. Dig digs, build builds, place places stockpiles, and query changes building/stockpile settings. The mode is determined by a marker in the upper-left cell of the spreadsheet. You can see an example of sheets in each of the four modes
here.
What about digfort and fortplan?Yeah, they work great, actually, but digfort only does dig mode and fortplan only handles build mode, and only the buildings that
buildingplan supports (mostly furniture). I plan to build on what they already provide, but I'd really like to see support for all buildings and constructions, stockpiles, query mode, the full set.
So what's your plan?I wrote a
design doc, if you're into that sort of thing, but here's a quick rundown of what I have in mind:
[/list][/list]Usage:
quickfort list [-l]
quickfort [run|orders|undo] <list number>
quickfort [run|orders|undo] <filename> [-s <sheet_number>]
There will also be some configuration files where you can define custom aliases for query blueprints (like defining the name "ironores" to mean the keystrokes "s{Down 5}deb{Right}{Down}{Right}&{Down}&{Down}&{Down}&{Down 5}&^") and material preferences for orders and building (like forbidding constructions from being made out of precious coal bars or potash). Once all functions are supported, we can also include a library of useful blueprints to be distributed with DFHack.
There would be both a commandline interface at the DFHack# prompt and a GUI interface that will let you scroll through the blueprints and select one to apply.
"quickfort list" prints a list of plans based on the files in the "blueprints" directory, annotated with information from their initial comment (and maybe the sheet name from xlsx files). If -l is specified, the output includes blueprints from the library directory. For example:
[DFHack]# quickfort list
1) farming.xlsx -s1 (dig)
Last Edit: August 21, 2020, 12:26:39 am
+ Attachments and other options
shortcuts: hit alt+s to submit/post or alt+p to preview
SMF 2.0.13 | SMF © 2016, Simple Machines
XH
2) farming.xlsx -s2 (build: workshops)
3) farming.xlsx -s3 (build: furniture)
4) farming.xlsx -s4 (place)
5) farming.xlsx -s5 (query)
6) rooms.xlsx -s1 (dig: dining hall)
7) rooms.xlsx -s2 (build: dining hall)
8) surface-dig.csv (dig: clear trees)
9) surface_walls-build.csv (build)
Skipping 57 blueprints in the library subdirectory. Use quickfort list -l to include them.
"quickfort run" and "quickfort orders" can take either the number from the list command or the full params:
[DFHack]# quickfort run surface-dig.csv
Applied surface-dig.csv (dig: clear trees)
[DFHack]# quickfort orders 7
Reading material preferences from dfhack-config/quickfort/material_prefs
Ordered 1 rock block
Ordered 16 rock thrones
Ordered 16 rock tables
Ordered 4 rock coffers
Ordered 2 rock cabinets
Ordered 36 rock statues
Generated 6 orders for rooms.xlsx -s2 (build: dining hall)
[DFHack]# quickfort run 7
Reading material preferences from dfhack-config/quickfort/material_prefs
Used:
2 chert blocks
16 thrones (11 chert, 5 microcline)
16 tables (10 chert, 6 gabbro)
4 chert coffers
2 microcline cabinets
36 statues (9 chert, 10 microcline, 4 gabbro, 13 orthoclase)
Applied rooms.xlsx -s2 (build: dining hall)
[DFHack]# quickfort run farming.xlsx -s5
Reading aliases from: dfhack-config/quickfort/aliases
Reading aliases from: blueprints/rooms.xlsx sheet: Aliases
Applied farming.xlsx -s5 (query)
"quickfort undo" will undo the specified blueprint, removing placed constructions and stockpiles, and clearing tiles marked for digging. It might be too difficult to undo query blueprints, though.
[DFHack]# quickfort undo 7
Canceled construction for:
2 workshops
16 thrones
16 tables
4 coffers
2 cabinets
34 statues
Scheduled for removal:
2 statues
Undo complete for rooms.xlsx -s2 (build: dining hall)
What are your thoughts? How many quickfort users do we have out there who would appreciate something like this? What other features would you like to see? What are the most annoying manual steps you have to take that could be automated by this project?
Here are the milestones I'm using to track my progress:
Done- Plan is approved by DFHack core devs (@lethosor)
- Forum thread started for public discussions and progress reports (this one)
- Blueprint plugin saves files to blueprints/ dir (PR#1607) -- quickfort will read blueprints from this same directory
- Interface skeletons are implemented (PR#1609, PR#159)
- Settings can be set (PR#163)
- Blueprints can be listed (PR#164)
- Blueprints can be tokenized (PR#165)
- Dig-mode blueprints can be applied (PR#167)
- Place-mode blueprints can be applied (PR#168)
- Build-mode blueprints can be applied (PR#169)
- Query-mode blueprints can be applied (PR#171)
- Stockpile settings are initialized (PR#172)
- Documentation (PR#1617)
- Curated library of blueprint files is included with DFHack (PR#1625)
- Xlsx dependencies are included in dfhack build/release (PR#1620)
- Can read from xlsx files (PR#177)
- Basic buildingplan integration (PR#1622, PR#184)
- Orders can be generated from build-mode blueprints (PR#185)
- Multi-blueprint files/sheets (PR#185)
- Meta blueprints (PR#185)
- Zone mode (PR#185)
- GUI (PR#185)
All done! I have lots of ideas of where to go from here, but I'd like to see the script get some real usage first so we can work out the bugs.