Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 17 18 [19] 20 21 ... 29

Author Topic: DFHack: quickfort | buildingplan | blueprint | blueprints/library  (Read 92229 times)

myk

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #270 on: June 21, 2021, 12:36:39 pm »

Note that the dig-now plugin is still in code review. However, its dependencies *have* been merged, so if you want to give it a spin, you can merge that PR locally and build it yourself.
Logged

falcnor

  • Escaped Lunatic
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #271 on: June 25, 2021, 10:18:00 am »

Long time lurker, old school player trying to check out some automation tools.
I've jumped into quickfort and testing the dreamfort runs on some peaceful instances of DF.
Unfortunately I've run into some errors that I cannot find any posts about (aside from common issues with this in LUA in general) and unable to correct my self.

Trying to run the surface1 macro/label at start and get the following errors.
Code: [Select]
[DFHack]# quickfort run /library/dreamfort.csv -n /surface1
applying blueprint: "/central_stairs"
applying blueprint: "/surface_clear_small"
applying blueprint: "/surface_zones"
applying blueprint: "/surface_name_zones"
...rtress 0.47.05/hack/scripts/internal/quickfort/query.lua:26: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
        [C]: in function 'pairs'
        ...rtress 0.47.05/hack/scripts/internal/quickfort/query.lua:26: in upvalue 'load_aliases'
        ...rtress 0.47.05/hack/scripts/internal/quickfort/query.lua:99: in field '?'
        ...ress 0.47.05/hack/scripts/internal/quickfort/command.lua:54: in field 'do_command_internal'
        ...ortress 0.47.05/hack/scripts/internal/quickfort/meta.lua:52: in upvalue 'do_meta'
        ...ortress 0.47.05/hack/scripts/internal/quickfort/meta.lua:59: in field '?'
        ...ress 0.47.05/hack/scripts/internal/quickfort/command.lua:54: in global 'do_command_internal'
        ...ress 0.47.05/hack/scripts/internal/quickfort/command.lua:120: in function <...ress 0.47.05/hack/scripts/internal/quickfort/command.lua:116>
        [C]: in function 'dfhack.call_with_finalizer'
        C:\data\PEPack\Dwarf Fortress 0.47.05\hack\lua\dfhack.lua:72: in function 'dfhack.with_finalize'
        ...ress 0.47.05/hack/scripts/internal/quickfort/command.lua:114: in field '?'
        ...PEPack\Dwarf Fortress 0.47.05/hack/scripts/quickfort.lua:221: in local 'script_code'
        C:\data\PEPack\Dwarf Fortress 0.47.05\hack\lua\dfhack.lua:680: in function 'dfhack.run_script_with_env'
        (...tail calls...)

Any assistance from anyone?
Thanks much!
Logged

myk

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #272 on: June 25, 2021, 11:36:25 am »

We figured it out on discord, but posting here for the record.

The issue was the extra slash ('/') in the blueprint path -- the code expected "library/dreamfort.csv", not "/library/dreamfort.csv". Some blueprints worked fine with the leading slash (e.g. build mode), but some did not (e.g. query mode). I'm fixing the path normalization code so that leading slashes will be ok to use in the future. All blueprint paths are intended to be relative to the "blueprints" directory under your DF game folder (though this directory *is* configurable in dfhack-config/quickfort/quickfort.txt for players who want to store their blueprints somewhere else).
« Last Edit: June 25, 2021, 11:40:59 am by myk »
Logged

myk

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #273 on: July 07, 2021, 08:59:40 am »

The dig-now plugin has continued to get improved as I play with it more (it really makes testing quickfort go much faster!) and I've started on a build-now script to instantly complete "Construct building" jobs. I thought I was almost done with the script -- buildings get built, items get attached, everything ends up usable. The only bit I had left were simple constructions (e.g. walls and floors) that are handled a little differently by the game.

That last little bit has doubled the length of the script and I'm still not done! There's a lot of logic that is actually very similar to what I wrote in dig-now. Like, if you construct a ramp, a ramp top appears in the z-level above it (if there is open space) and if you build a wall, you have to adjust all the adjacent constructed and smooth natural walls so that they're connected.

I'm trying not to write all the same logic twice, but there are also enough differences between how natural rock is shaped in dig-now and how constructions are handled in build-now that I need to put some thought into how to share the code.

The refactors might take me a while, and now that my last batch of PRs have been mostly merged, I might get started on milestone 2 of the blueprint overhaul plan, which focuses on packaging improvements for the generated blueprints that make them easier to manage and play back in quickfort.
Logged

ldog

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #274 on: July 08, 2021, 09:20:04 am »

Hey Myk. The latest tweaks to the Dreamfort design have really helped speed it along, I will be on schedule for the 3rd migrant wave.
So far everything is fairly clean and trouble-free.

The new stairwell design doesn't suffer from the job cancellation issues the ramps had. I think the digging priority needs adjustment from 7 to 5 (and leave the 4 at 4) because I have noticed the lower priority tasks aren't just lower than other similar tasks, but all tasks (such as hauling;I don't use designated haulers, everyone hauls when they aren't otherwise busy). 5 will keep them from being dug before any 4s, even ones halfway across the map.

I found a way to cheat and add empty bag to sand collection (in-game it won't let you) by copy-pasta and importing order:
Code: [Select]
{
"amount_left" : 1,
"amount_total" : 1,
"frequency" : "Daily",
"id" : 180,
"is_active" : false,
"is_validated" : false,
"item_conditions" :
[
{
"condition" : "AtLeast",
"flags" :
[
"empty",
"bag"
],
"item_type" : "BOX",
"value" : 2
},
{
"condition" : "AtMost",
"flags" :
[
"sand_bearing"
],
"value" : 6
}
],
"job" : "CollectSand"
}
I don't know if you want to add it to the main orders. In theory it should sit quietly until you build a glassworks. Still trying to get the soap cancellation spam to stop, seems like I am constantly ordering extra lye manually, but at least once we get full stock it will stop. I have been adjusting some of the orders to require n+1 of problematic inputs, which seems to help a bit.

The guildhall bp is the old 4x4 instead of the new 3x3.
« Last Edit: July 09, 2021, 11:43:07 am by ldog »
Logged
Quote from: Dirst
For example, if you wanted to check if a unit was eligible to be a politician or a car salesman, you'd first want to verify that there is no soul present...

Quote from: gchristopher
The more appropriate question becomes, are they awesome and dwarven enough.

myk

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #275 on: July 09, 2021, 01:38:38 pm »

Hey Myk. The latest tweaks to the Dreamfort design have really helped speed it along, I will be on schedule for the 3rd migrant wave.
So far everything is fairly clean and trouble-free.
Awesome! I've been pretty happy with it too. I think we've achieved a good balance of functionality and simplicity.

Quote
The new stairwell design doesn't suffer from the job cancellation issues the ramps had. I think the digging priority needs adjustment from 7 to 5 (and leave the 4 at 4) because I have noticed the lower priority tasks aren't just lower than other similar tasks, but all tasks (such as hauling;I don't use designated haulers, everyone hauls when they aren't otherwise busy). 5 will keep them from being dug before any 4s, even ones halfway across the map.
Hummmm. I'll need to give this some thought. Lowering the priority of the stairwell tiles will make it trickier to dig the well cisterns on the services level. I might be able to do it with the stairwell at priority 6, but I need priority 5 to force the miners to dig the cistern tiles in the correct order. Otherwise we could end up with messy ramps or undug tiles on the main service level. Would raising the priority of the stair tiles to 6 be enough? An alternative would be to change *all* the default 4 dig tiles to 3 and move everything up a notch. I think that would make the blueprints unacceptably messy, though, and they'd be less useful as the "copyable examples" I'd want them to be.

I guess I've never run into this before since I use dedicated diggers. I enable hauling on all my other dwarves (or rather I let the autohauler plugin do it for me), but, at least in my forts, diggers are diggers 'til the diggin' is done. I don't really want to impose that playstyle on everyone, though, so I'd like Dreamfort to be as flexible as possible.

Quote
I found a way to cheat and add empty bag to sand collection (in-game it won't let you) by copy-pasta and importing order:
Nice. I'll add it in.

Quote
Still trying to get the soap cancellation spam to stop, seems like I am constantly ordering extra lye manually, but at least once we get full stock it will stop.
It has been difficult to find an orders configuration that works well for soap. I've been thinking, perhaps the best way to solve this problem is to write a dfhack fix script that scans existing orders and adds the missing condition for lye-containing items for any order that produces soap bars. If we call that script from onMapLoad.init, it would solve the issue on every map load after df fails to restore the condition from the savegame.
edit: ok, so I went to the DF bug tracker to get the bug number for this issue, and I was surprised that I couldn't find it. So I started to file it myself. While I was verifying the "steps to reproduce", I found that *the bug has been fixed*! "lye-containing items" conditions are properly restored from saves now! I guess I haven't checked since 0.47.05 came out. I'll update the orders we've been using and see if the "proper" configuration works now.

Quote
I have been adjusting some of the orders to require n+1 of problematic inputs, which seems to help a bit.
Yeah, I've been playing with that as well. The issue seems to be:
1) needed item is produced
2) manager identifies that the needed item exists, activates the orders that use it
3) needed item is picked up and hauled to a stockpile OR item is used by another order
4) newly-activated order can't use the item because it's "in a job" (or already consumed)

I'm experimenting with requiring at least 5 (or, rather, n+4+number of other orders that can consume item) of any item that we use as input. This solves the competing automation orders problem, allows manually-added orders that use the same items to take precedence, and has a very low chance of having all free items in hauling jobs at the same time. It also has the (potentially) useful side effect of maintaining a small cache of basic items that the player can use in an emergency. The downside, of course, is that it will take longer to build up enough items to get started on the item pipelines. This might not be such a bad thing, though, since the automation orders are intended to "nudge" the fortress into a good steady state. I'll play with it a bit and see if there are any problems with the longer ramp-up time.

The automation orders are turning out to take more careful design than I originally thought they would! I'll have to write some documentation on how they work so players can understand and extend them more easily. In the far future, maybe this entire set of automation orders could be implemented as a configurable DFHack script (or integrated into the orders plugin as a generate command).

I'm also making some annotated screenshots of the dreamfort levels (and I'm realizing how difficult it is to make readable annotated screenshots : ) All this will eventually go into the quickfort library guide, I think.
Logged

ldog

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #276 on: July 09, 2021, 02:26:25 pm »

Oh, good find on the bug report for the lye. I'll give it a try again.

I usually dig the stairwell all the way down first anyway; I'm an early cavern breacher. But I'm constantly adjusting dig priorities on the fly anyway.
I have not found an issue with the wells being dug, other than that they jump around from place to place, but I haven't had any cancellations or miners getting stuck. As long as the order you set is maintained it seems to be pretty bulletproof. Still, sounds like I need to give the autohauler a shot. I agree with you about keeping the default at 4.

I recently came to the same conclusions you did with the work orders. So some orders can be kept to pretty tight settings and others need more safety. I do find holding off on importing the orders until after the 1st migrant wave like you said helps some, possibly even until the 2nd(also lets you see who you want to assign to what). I've usually got farming and industry levels dug just around the end of the 1st season starting with 2 skilled miners.

Oh, something else I've been toying with, autobutcher settings. Been adding more to your onmapload.init as they showup since I'm too lazy to go through the raws right now and still adjusting some things.
Code: [Select]
autobutcher target 4 1 1 1 BIRD_TURKEY
autobutcher target 50 50 14 2 BIRD_GOOSE
autobutcher target 2 1 4 2 ALPACA SHEEP LLAMA PIG
autobutcher target 1 1 1 1 CAT
autobutcher target 1 1 0 0 HORSE YAK DONKEY WATER_BUFFALO GOAT
autobutcher target 0 0 0 0 CAVY BIRD_DUCK BIRD_GUINEAFOWL
autobutcher unwatch DOG

Goose is still the overall winner for me (I raise birds primarily for leather), so I really don't want to be bothered with other birds that always seem to migrate in (you'd want to swap the goose and turkey settings...although I like how you went with crundles in that one save...) Pigs are just low maintenance & can be milked, besides providing a lot of meat. A small herd of sheep/alpaca/llama for wool aren't bad. The pasture probably won't handle all 3 at once though. I like to keep 1 cat, obviously those who like a Chinese takeout & kitten totem industry need to adjust settings.  It is generally better to butcher most unwanted animals on adulthood for hides. Cavy/Duck/Guinefowl are worthless since they never give hide. Finally I want my wardogs left alone. Granted they do tend to become a problem for me later, but I just find it hard to butcher dogs. Other animals sure. Sentient beings? Yeah, murder them all. Especially the Elves. Not dogs though...

Now we just need a good giant cave spider silk farm.
« Last Edit: July 09, 2021, 02:51:37 pm by ldog »
Logged
Quote from: Dirst
For example, if you wanted to check if a unit was eligible to be a politician or a car salesman, you'd first want to verify that there is no soul present...

Quote from: gchristopher
The more appropriate question becomes, are they awesome and dwarven enough.

ldog

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #277 on: July 09, 2021, 08:03:35 pm »

So I was going to replace the blunt weapons with silver but because of what I was able to do with the sand collection, it got me to thinking, why stop with silver...
Code: [Select]
[
{
"amount_left" : 1,
"amount_total" : 1,
"frequency" : "Daily",
"id" : 84,
"is_active" : false,
"is_validated" : true,
"item_conditions" :
[
{
"condition" : "AtLeast",
"item_type" : "BAR",
"material" : "INORGANIC:PLATINUM",
"value" : 5
},
{
"condition" : "AtLeast",
"item_type" : "BAR",
"material" : "COAL",
"value" : 100
},
{
"condition" : "AtMost",
"item_subtype" : "ITEM_WEAPON_HAMMER_WAR",
"item_type" : "WEAPON",
"material" : "INORGANIC:PLATINUM",
"value" : 10
}
],
"item_subtype" : "ITEM_WEAPON_HAMMER_WAR",
"job" : "MakeWeapon",
"material" : "INORGANIC:PLATINUM"
},
{
"amount_left" : 1,
"amount_total" : 1,
"frequency" : "Daily",
"id" : 86,
"is_active" : false,
"is_validated" : true,
"item_conditions" :
[
{
"condition" : "AtLeast",
"item_type" : "BAR",
"material" : "INORGANIC:PLATINUM",
"value" : 5
},
{
"condition" : "AtLeast",
"item_type" : "BAR",
"material" : "COAL",
"value" : 100
},
{
"condition" : "AtMost",
"item_subtype" : "ITEM_WEAPON_MACE",
"item_type" : "WEAPON",
"material" : "INORGANIC:PLATINUM",
"value" : 10
}
],
"item_subtype" : "ITEM_WEAPON_MACE",
"job" : "MakeWeapon",
"material" : "INORGANIC:PLATINUM"
}
]
Muahahahahahaha.
Yes, it works. Non-artifact platinum weapons are a thing.
Oh, should add crossbow too, because marksdorfs like to bash too. Maybe shields? That might be too much.
I'd replace the steel mace & war hammer for sure though.
Y'know, I'm thinking maybe add alternate weapon/armor with conditional checks on other types. So like make iron armor/weapons if we have no steel, etc. Maybe just check for metal bars. So no steel bar, make iron, no iron make bronze (seems iron is better than bronze these days). steel/silver/platinum for blunt. Thoughts?

BTW, the lye condition appears to be working :)

I bet we can make jobs for specific brewing/milling/processing too. I had made custom reactions once, but it is such fuckery with the saved games folders that it isn't worth the hassle (if you don't start a fresh save with them you can't add or change them after).
« Last Edit: July 09, 2021, 09:43:53 pm by ldog »
Logged
Quote from: Dirst
For example, if you wanted to check if a unit was eligible to be a politician or a car salesman, you'd first want to verify that there is no soul present...

Quote from: gchristopher
The more appropriate question becomes, are they awesome and dwarven enough.

myk

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #278 on: July 10, 2021, 01:26:21 am »

Making the best weapons possible with whatever materials are available makes sense, but at this level of sophistication, I'm thinking the orders will be easier to maintain as code rather than as a static JSON file. That way we can tweak values across many orders without having to make lots of manual changes. We can also make some things configurable.

If you make an expanded set of orders in JSON, I could use it as a guide to write some orders generation code. How does that sound?
Logged

ldog

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #279 on: July 10, 2021, 08:41:38 am »

Making the best weapons possible with whatever materials are available makes sense, but at this level of sophistication, I'm thinking the orders will be easier to maintain as code rather than as a static JSON file. That way we can tweak values across many orders without having to make lots of manual changes. We can also make some things configurable.

If you make an expanded set of orders in JSON, I could use it as a guide to write some orders generation code. How does that sound?

Sounds good.

For some reason lye-containing items exports as this:
Code: [Select]
{
"condition" : "AtLeast",
"value" : 1
}
« Last Edit: July 10, 2021, 10:16:21 am by ldog »
Logged
Quote from: Dirst
For example, if you wanted to check if a unit was eligible to be a politician or a car salesman, you'd first want to verify that there is no soul present...

Quote from: gchristopher
The more appropriate question becomes, are they awesome and dwarven enough.

ldog

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #280 on: July 10, 2021, 01:16:27 pm »

Weapons & Armor, a bit of tweaking to the rest of the automation orders. Be warned though that I exported this from my game so some prefs are set that shouldn't be (willow is my lightest so most wood jobs, jet for pots, etc) I guess I could do some alternates for those too, like generic make pots unless you have jet, etc.

Also you can't assign silver or platinum crossbows nor platinum war hammers & maces from uniform menu but you can assign them as specific weapons to individuals.

https://pastebin.com/5sBQYZNg

I went copper>bronze>iron>steel>silver>platinum (last 2 only for hammer/mace/xbow of course)
The current consensus seems to be iron is better than bronze, we're using the bronze for bolts, and iron is generally close to surface if present. If using embark bronze for weapons/armor it is likely done manually before automation orders imported anyway (and I have learned importing them too soon is a good way to fuck yourself over).
I thought about adding candy, but being how it's very scarce and very late game I think it's best to leave that to the users discretion.

I just stumbled upon this wonderful tweak; tweak do-job-now. It adds a menu item to the job list that lets you make the job high priority. Since my stubborn assholes never seem to want to build bridges/levers/trackstops and I need that shit done yesterday not when they feel like it, it is a life-saver. I have added it to my onmapload.init. Seedwatch start is another I recommend, turns seed-cooking on/off, default is 30 which is perfect for our layout.

This:
Code: [Select]
{
"condition" : "AtLeast",
"flags" :
[
"lye-containing"
],
"value" : 1
}
is what I believe the condtion should look like, but importing it throws an error. Nothing else I could think of worked, it didn't throw errors, but it just showed up as 1 blank item.

I forgot bismuth bronze, which is an alternative to bronze. Less tin if you have bismuth. I would put it between regular bronze and iron.
« Last Edit: July 10, 2021, 04:43:23 pm by ldog »
Logged
Quote from: Dirst
For example, if you wanted to check if a unit was eligible to be a politician or a car salesman, you'd first want to verify that there is no soul present...

Quote from: gchristopher
The more appropriate question becomes, are they awesome and dwarven enough.

myk

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #281 on: July 11, 2021, 12:28:21 pm »

Ok, some progress to report. The build-now script is in pretty good shape. I've tested it fairly thoroughly, though I'm sure there are still corner cases to discover and address.

Now that I have both dig-now and build-now, I can test dreamfort without any explicit dwarven effort (except for tree cutting, which dig-now doesn't handle yet). As a happy side effect, I can finally get some clean screenshots without force-dumping everything in my fort : )

Behold!
Spoiler (click to show/hide)

(by the way, if anyone has a talent for creating readable annotated screenshots, I'd be grateful for something that looks nicer than the images that I cobbled together)

Now to take a closer look at the manager orders for fort automation.
« Last Edit: July 11, 2021, 03:48:42 pm by myk »
Logged

ldog

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #282 on: July 11, 2021, 11:34:33 pm »

Ok, some progress to report. The build-now script is in pretty good shape. I've tested it fairly thoroughly, though I'm sure there are still corner cases to discover and address.

Now that I have both dig-now and build-now, I can test dreamfort without any explicit dwarven effort (except for tree cutting, which dig-now doesn't handle yet). As a happy side effect, I can finally get some clean screenshots without force-dumping everything in my fort : )

Behold!
Spoiler (click to show/hide)

(by the way, if anyone has a talent for creating readable annotated screenshots, I'd be grateful for something that looks nicer than the images that I cobbled together)

Now to take a closer look at the manager orders for fort automation.


So I grabbed the lua for those scripts, but when I try to run build-now, I get errors about missing argparse files and I can't find them on github. I take it this isn't ready for public use?
Logged
Quote from: Dirst
For example, if you wanted to check if a unit was eligible to be a politician or a car salesman, you'd first want to verify that there is no soul present...

Quote from: gchristopher
The more appropriate question becomes, are they awesome and dwarven enough.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #283 on: July 12, 2021, 09:34:40 am »

I believe it will only work on DFHack 0.47.05-r2 and newer.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

ldog

  • Bay Watcher
    • View Profile
Re: DFHack: quickfort | buildingplan | blueprint | blueprints/library
« Reply #284 on: July 12, 2021, 10:08:23 am »

I believe it will only work on DFHack 0.47.05-r2 and newer.

I'm on r03.
Logged
Quote from: Dirst
For example, if you wanted to check if a unit was eligible to be a politician or a car salesman, you'd first want to verify that there is no soul present...

Quote from: gchristopher
The more appropriate question becomes, are they awesome and dwarven enough.
Pages: 1 ... 17 18 [19] 20 21 ... 29