Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Job dependencies  (Read 571 times)

Zack Weinberg

  • Bay Watcher
    • View Profile
    • http://zwol.livejournal.com/
Job dependencies
« on: July 08, 2009, 02:41:31 pm »

There's closely related stuff to this in several of the popular job-related suggestions, but I haven't seen exactly this, so...

Some things your dwarves can make are at the end of long chains of production operations.  For instance, take glass blocks:

  • Chop wood
  • Wood furnace: make ash
  • Ashery: make potash
  • Kiln: make pearlash
  • (Glass furnace:) gather sand
  • Glass furnace: make clear glass blocks

If you don't have magma, you also have to produce fuel for three of these operations, and if you don't have bags for the sand, you have to make those too.  Every link in the chain currently has to be scheduled individually and micro-managed lest jobs get canceled for lack of raw materials.  This is silly.  The dwarves should be able to handle job dependencies for you (I envision this being a Manager function).

There's two aspects to this.  First, if the appropriate raw materials are lacking for any job, it goes into a new "waiting for materials" state and does not try to assign a dwarf; it automatically comes off the "waiting for materials" state when materials become available.  The jobs screen sorts "waiting for materials" jobs separate from all others, and shows you what is missing for each.  This, all by itself, would be a significant improvement over the present situation.

Second, if you queue a production order via the Manager, she checks the stocks and automatically queues production of whatever that job needs that you don't already have.  She does this recursively, so a single request for clear glass blocks would schedule everything on the above list, but she stops when you hit true raw materials (ore, wood, stone, sand, plants, etc).  If you don't have enough of those, the manager will still let you queue the order but she'll tell you (as best she can given the state of the stockpile records) how much of which things are required. You then go designate more mining or whatever.

If you can't make something because you are missing a workshop for something on the dependency chain, or a dwarf with the necessary labor enabled, the manager should also be able to tell you that.

Relatedly, it would be nice to be able queue construction of furniture in advance of its production (as long as you don't care which chair goes where) -- each construction would just take whatever furniture of the appropriate type is next produced.  This should *not* auto-queue furniture production, since you probably care what materials are used, but the manager screen should have a second list of all the furniture that needs production.  (Noble mandates, trade good requests, and undersupply of bins/barrels/bags could also show up there.)
Logged

Granite26

  • Bay Watcher
    • View Profile
Re: Job dependencies
« Reply #1 on: July 08, 2009, 02:43:16 pm »

How should it behave if there are multiple paths to produce the intermediaries?

Zack Weinberg

  • Bay Watcher
    • View Profile
    • http://zwol.livejournal.com/
Re: Job dependencies
« Reply #2 on: July 08, 2009, 02:54:28 pm »

How should it behave if there are multiple paths to produce the intermediaries?

Breadth-first search of the dependency tree, so you get whatever chain is shortest, would be good enough for me.

It might be nice to retry longer chains when it hits raw materials that don't exist, in case you do have some intermediaries on a longer chain, but I wouldn't miss that.  (The only case of multiple paths I know about is ash->lye->potash versus ash->potash, and breadth-first search would get that right anyway.  Maybe it might come up for alloys? But you always say exactly which metal you want for metal items.)
Logged

Granite26

  • Bay Watcher
    • View Profile
Re: Job dependencies
« Reply #3 on: July 08, 2009, 02:58:47 pm »

Not if you're saying 'Bronze Axe' it doesn't.

Zack Weinberg

  • Bay Watcher
    • View Profile
    • http://zwol.livejournal.com/
Re: Job dependencies
« Reply #4 on: July 08, 2009, 03:03:36 pm »

I'm not sure I understand.  Bronze smelts either from tin+copper bars or from tin+copper ores; the bars smelt from the ores.  The algorithm I suggested would pick up on the ores if you've got them, otherwise recurse and check for bars, and if you haven't got that either, queue the shortest path (direct smelting of bronze) and tell you to go mine more ore.
Logged

jaked122

  • Bay Watcher
  • [PREFSTRING:Lurker tendancies]
    • View Profile
Re: Job dependencies
« Reply #5 on: July 08, 2009, 03:39:44 pm »

I think glass furnace should do all this itself, if you build it bigger!