-
Notifications
You must be signed in to change notification settings - Fork 199
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
new tool: idle-crafting #1257
new tool: idle-crafting #1257
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
running anything every 53 ticks is likely going to be a performance sink, but from a quick look through this code, it seems reasonable architecture- and logic-wise.
re:performance testing, try this:
enable idle-crafting
:lua dfhack.internal.resetPerfCounters()
- run for a few in-game days
:lua require('script-manager').print_timers()
Here are some rough ballpark figures.
Note: this was over 7 days for the bad case where one of the two workshops was lacking input materials, causing it to not queue a job and run the full unit loop every 53 ticks. Disabling the workshop that is lacking input materials, the Lua timer details look as follows:
over the course of these 7 days, only two dwarfs were assigned to the workshop, all other iterations terminated at the very first check (i.e. that the workshop is available). |
So, under normal operation, the performance impact is minimal. However, de performance impact becomes noticeable if job creation fails. Maybe, it is better to remove the workshop from the configuration, if job creation fails (which should only happen if there are no materials). |
you could also do an exponential backoff, like TCP, so it will automatically re-engage when there are materials again |
Hmm, exponential backoff sounds a bit annoying to implement. But it should be relatively straightforward to disable a workshop until the next run of the main loop (which runs every 8419 ticks, approximately once a week). |
that's probably sufficient |
I implemented suspension of failing workshops until the next run of the main loop. |
docs/idle-crafting.rst
Outdated
idle-crafting disable | ||
disable idle-crafting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest choosing one to be the canonical form, and only documenting that form. Both can be supported by the code, though, for flexibility.
docs/idle-crafting.rst
Outdated
|
||
:: | ||
|
||
idle-crafting status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idle-crafting status | |
idle-crafting [status] | |
idle-crafting thresholds <thresholds> |
docs/idle-crafting.rst
Outdated
Overlay | ||
------- | ||
|
||
This script provides an overlay to the "Tasks" tab of craftsdwarf's workshops, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've discussed a little on Discord about placement. You didn't put this on the "Workers" tab because the tab is too crowded with orders
overlay widgets, correct? Can we rearrange those widgets to make room for this one?
Another option is to hang the idle-crafting
toggle off the side of the panel, like we do for the stocks screen:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I do think that hanging toggles of to the side is acceptable for things that are essentially full-screen, I don't think that it's the right thing to do for building cards.
The only solution I can see for gaining a reasonable amount of space would be to split the "Permitted General Work Order Labors" into two columns. However, that is a list widget, so splitting this would complicate the code elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much room does this widget need? Can it be made to fit in the area to the left of the Permitted General Work Order Labors panel?
Alternately, we could make the Permitted panel shorter and let the list be scrollable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that the natural form is a single long line at the bottom. So, it technically does fit, but it does look a bit squished.
What about extending the "Permitted General Work Orders" to the full width, and moving their labels to the right of the list? This would provide the one line distance to make it not look squished, while also avoiding scrolling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can shrink the labor list max height by 2 rows to accommodate this. The craftsdwarf's workshop will get a scrollbar, but it's the only (vanilla) workshop that will see any change. No other workshop has such a long list.
Co-authored-by: Myk <[email protected]>
As far as I am concerned, the tool now works pretty well. However, I have only tested it using the one fort that I'm currently playing. Thus, there may (likely will) be some corner cases that I didn't anticipate. Thus, I would be happy if this tool could spend some time in testing before being released. In particular, because this should be useful for just about every fort out there. 😬 |
Also, I am wondering whether this tool is really a "gameplay" tool, or whether it actually might qualify as "auto". Technically, you could closely watch every single dwarf, wait for a moment when they are idle, and then make them master of a workshop and queue a max-priority craft item job there. I'm not saying that this is realistic, but the tool doesn't enable any behavior that the player couldn't force using vanilla means. |
Yeah, I had the same debate with myself about gameplay vs. auto. I settled on "gameplay" since we portrayed the tool as giving units more autonomy instead of relieving the player of a tedious burden. I can also see this getting extended later with other "abilities" that we can give dwarves. |
This tool allows idle dwarfs to automatically satisfy their crafting needs.
This isn't ready yet, but given that it involves quite a bit of reverse engineering and guesswork, I think this is the time to get some reviews.