New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blueprint overhaul plan #1842
Comments
@lethosor at a high level, does this plan sound ok to you? we can dig into details in the code reviews. |
Sounds good to me! (at least from a quick read-through.) Honestly, even part 1 would be a significant improvement. I'll look through the first couple PRs soon. I should have more time this week than I did recently. I also want to get r2 out due to a couple other unrelated fixes, so if the existing PRs are stable enough for a release, that might be a good cutoff point for r2. (Maybe I should start making proper release branches...) |
Some PRs will come in pairs -- one for The initial implementation of |
Awesome work!! |
Agreed. Feel free to request features on the quickfort thread: http://www.bay12forums.com/smf/index.php?topic=176889.msg8306977#new That particular feature, though, is already pretty high priority on my backlog: https://docs.google.com/document/d/17EjZlGsUOJ6E8WtqkCRZi9BBKjL9L1IdHfkB3Ajqas8/edit?usp=drivesdk |
note to self: I seem to have forgotten to expose the description field for the blueprint modeline. I'll need to add that. edit: oh, I see, the description would potentially need to be different for every phase.. maybe it's better to leave that out. we still have the blueprint name that acts as a unique identifier |
I did some work on carved tracks in Here the code, to remind myself later:
|
What to do with carved fortifications? They can't be dug in the "dig" phase since the walls have to be smoothed first. Perhaps we should rename the "track" phase to "carve" and have it include tracks and fortifications? We'll also need to add a "smooth" phase between "dig" and "carve". Ugh. Do we also need options for "minimal smoothing" (i.e. just fortification tiles) vs. "all smoothing"? How about whether we included engravings in the "carve" phase? |
This is now supported in |
Design doc and tracking bug for the blueprint plugin overhaul. Public discussion in the blueprint thread. This text covers my ideas for:
Objectives
The point of this overhaul is to make blueprint a more productive member of the quickfort ecosystem. Blueprint is the easiest way to create useful, valid quickfort blueprints, especially for people new to quickfort. However, there are a lot of opportunities to make blueprints easier to create, edit, and play back. There are also many ways to improve the quality of the generated blueprints via capturing more map information.
Here are the goals in list form, with tags that we can use later to categorize the project plan tasks:
[Reliability]
Ensure the blueprint -> quickfort workflow works reliably[Generate]
Make it easier to generate usable blueprints from a map[Edit]
Make it easier to edit generated blueprints[Playback]
Make use of DFHack quickfort usability features to make the blueprints easier to play back[Completeness]
Capture as much map information as possible in the generated blueprintsUse cases
There are two major groups of users that this work is targeting:
I am catering the default settings to members of group 1, with most of the non-default options intended for members of group 2.
For group 1, the expected workflow is:
blueprint gui
orgui/blueprint
to generate a minimal .csv blueprint filequickfort gui
orquickfort run
at some later time to apply itI want everything to be as simple as possible for this group. Quickfort has the capability to display messages after a blueprint is run, so we can autogenerate a walkthrough for replaying the blueprints later.
Group 2 will use a greater variety of options and spend time editing the blueprints before replaying them with quickfort. The features that make blueprints easier to read, understand, and edit are for this group. Group 2's expected workflow is:
blueprint gui
orgui/blueprint
, fiddle with options, and generate pretty-printed .csv or .xlsx filesquickfort
I expect members of group 2 to make iterative changes to the modified blueprints, either via direct editing or by using blueprint to generate blueprints for specific map areas, which they will then use to overwrite portions of their modified blueprints.
Features and commandline API
This section is written in the format of DFHack plugin documentation since we'd have to write that later anyway : )
note: I haven't checked it for formatting bugs yet. Also, this text assumes all features are already implemented. In reality, I plan to add bits of help text incrementally as the related features are completed.
GUI design
Right panel is overwritten with the blueprint interface and all keyboard input
is intercepted. Panel has 28 columns for text. Format:
The game cursor is active and can be moved with the cursor keys. When Enter is
hit, the
Select the first corner.
line changes toSelect the second corner
and the
ESC
line changes to:After the first corner is selected, a green flashing
X
appears where the cursoris. As the cursor is moved, the area from the start position to the current
cursor position will flash with green
X
characters. The selected dimensions andarea will appear on the gui panel, for example:
When the second corner is selected, the gui sends the configuration to the main
blueprint generation routine (as if the blueprint command were invoked directly
with those options). Then a summary dialog is shown detailing which files were created.
n
replaces the current name string with an editable field, pre-populatedwith the current name (or a blank if the current name was the default "blueprint" string).
Enter commits the new name.
ESC
dismisses the edit widgetwithout changing the name. If files with the given basename are detected in the
output directory, a warning is displayed, e.g.:
a
toggles betweenAutodetect
andCustom
, with the following lines shownif
Custom
is set. Each phase toggles betweenOn
andOff
.f
cycles acrossMinimal text .csv
,Pretty text .csv
, andBinary .xlsx
m
toggles betweenOn
andOff
s
starts a workflow where the player can select a map tile to use as theplayback start position, and is then prompted to enter a string to use as the comment.
When set, it will look like this:
Hitting
s
when the start tile has been set will toggle it back toUnset
(though the comment will be saved for when the user selectss
again to select a different tile).t
cycles acrossNo
,Level
,Group
, andPhase
Minimal UI workflow
Although setting of the blueprint name is technically optional, I expect the minimal flow to be:
n
, enter a name, hitEnter
As soon as the second corner is selected, appropriate blueprints will be generated and the summary dialog is shown.
Architecture and algorithm
Files:
plugins/blueprint.cpp
plugins/lua/blueprint.lua
scripts/gui/blueprint.lua
Here's my attempt at an architecture diagram (thanks, asciiflow.com!)
We'll also need to extend the xlsxreader plugin to support writing
.xlsx
files. The xlsxio library already supports writing. We'll just need to wire it up through our xlsxreader plugin (and rename it?) or write a new plugin just for writing.Overall, I expect the core algorithm to look something like this:
If sparse maps are too slow, we can use fixed-width pre-allocated buffers with a backup sparse map to pick up any cells that can't fit in the buffer.
Project plan
Each milestone contains a description and component tasks. Tasks items are tagged by the goal they work towards and my initial estimation of task complexity (S/M/L).
Milestone 1 - Fundamentals [done]
Wrap the blueprint entrypoint, implement the basic gui, set up verification
tests, and do other dev preparation tasks. The functional test suite will take
blueprint-generated files, run them through quickfort, run the modified map
back through blueprint, and compare the input to the output. These tests can
be extended incrementally as we add new features to blueprint. It will also act
as an integration test for quickfort, which I haven't otherwise written yet.
I don't want to wait for dig blueprints to be dug out by dwarves, so I'll need something
that reads dig designations and converts them into a "dug" state immediately. Options are
a new plugin/script (
modtools/dig-dug
? : ) or extending the tiletypes plugin to make target shapedependent on current dig designation. Tiletypes already has the logic for converting a tile to
a different shape, so adding logic to the plugin instead of creating a new script might be the
best approach.
Milestone 2 - Make blueprints easier to use in quickfort [done]
Start making the generated blueprints easier to use in quickfort. Previous
behavior will still be available via flags, but I'll be shifting the defaults.
First, I'll start writing multi-blueprint files instead of one file per phase.
This makes blueprints easier to move around and share. It also makes quickfort
#meta blueprints possible, which will dramatically reduce the toil associated
with reapplying the blueprints later.
Second, I'll introduce the ability to output the files in different formats. The
current output format is somewhere between what I envision the "minimal" and
"pretty" output formats being. Although "pretty" will make .csv files easier to
manually edit, I'm going with "minimal" as the default because it's faster to
read and write, and once I implement the xlsx output format, that will be the
one I will promote as best for editing.
Last, I'll add support for the quickfort start() modeline marker so blueprints
can be played back more naturally.
Milestone 3 - Quality of life improvements [done]
Take a short break from implementing radical changes and fix some of blueprint's
functionality holes.
Milestone 4 - Prep for meta blueprints [done]
Phases! Phases! Phases!
First, add support for carved tracks and zones.
Second, split the build phase. The current build phase combines constructions
and buildings, but this can lead to problems later when you try to attach a door
to an unbuilt wall. This method also misses flooring underneath buildings and
furniture. Splitting off a "construct" phase fixes this.
Finally, split the query phase. The current query phase just designates rooms,
but there's a lot more the query mode can accomplish. In particular, there is a
bifurcation between #query blueprints that can be run immediately after #place
and #build blueprints and #query blueprints that can't be run until buildings
are built and furniture is placed. So redefine "query" as "can be
run immediately" and add a "rooms" phase for query blueprints that must wait. All current functionality would move
to "rooms", so in order for something to be written to the new "query" phase,
we'll take the low hanging fruit of recording building, stockpile, and zone
names in the "query" blueprints. More will be added to these two phases later.
Milestone 5 - Meta blueprints [in progress]
Now that we have the phases separated out from the previous milestone, we can
group them properly with meta blueprints:
Group 1: dig
Group 2: construct
Group 3: build, place, zone, query
Group 4: rooms
This reduces group 3 from up to 4 commands down to 1. This is a big usability
improvement.
Milestone 6 - Documentation
Gravy
Possible future tasks
The text was updated successfully, but these errors were encountered: