Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4

Author Topic: Job Priorities Discussion  (Read 35073 times)

Granite26

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #15 on: November 11, 2008, 03:15:19 pm »

It looks like character stats have been revamped / nigh finalized, so I wanted to bring this subject back up.  (Unfortunately it's pretty simple, so there's not a lot of expounding to go into it)

SquashMonster

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #16 on: November 25, 2008, 12:18:15 am »

I think the best way to prioritize jobs would be to give each dwarf a workshop-style menu instead of the labor list.  You could add labors to the list the same way you add tasks to a workshop, but instead of deleting tasks when completed, the dwarf would simply always do the highest-priority job on the list that has tasks available.

For example, a dwarf with mining at the top of his list, followed by all the hauling labors, would always mine as long as there are squares available to mine.  When he runs out, he'll take the first-listed hauling job until there aren't any of those, then progress down the list until he runs out.  At which point he becomes an idle dwarf as normal.
Logged

kaypy

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #17 on: November 25, 2008, 10:16:28 am »

A quick and nasty way to get a lot of benefit without having to change the code base much:

I am assuming based on what I remember of discussions elsewhere that the job code at the moment works something like:
* Periodically check the jobs list
* For each job, check if there is a suitable dwarf available.
* If so, assign job to dwarf

Priorities could be quickly added in by tweaking the availability such that a dwarf is available if they have been assigned that labour with priority N and have been idle for N-1 passes through the jobs list.

Thus they would be immediately available for their highest priority labour, but would tend to idle a bit for others. I think you can accomplish an awful lot of the wishlist here just by being able to prioritize tasks in such a manner. You would also need to be able to prioritize tasks that at the moment dont allow toggling (eg lever-pulling) but that would be a relatively minor UI tweak compared with adding priorities at all.
Logged

Drakeero

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #18 on: December 02, 2008, 11:03:28 pm »

Ok, I'm a bit of a noob.  How do you assign a job directly to a dwarf?

As for a suggestion...um... well, I really haven't had any luck with the job manager window.  A bunch of tasks which I really haven't gotten too far in.  Would it be useful to have more basic tasks in it?
Logged
Cage traps are my magma.

Granite26

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #19 on: December 03, 2008, 09:25:13 am »

Ok, I'm a bit of a noob.  How do you assign a job directly to a dwarf?

As for a suggestion...um... well, I really haven't had any luck with the job manager window.  A bunch of tasks which I really haven't gotten too far in.  Would it be useful to have more basic tasks in it?

The player doesn't, the AI does that.  We're talking about AI procedures here.

I'm not sure what you think the job manager does?  It's a list of all the atomic tasks that can be assigned to a dwarf (by the computer).  Anytime something needs to be hauled, a task gets added to haul it.  The tasks on that list are assigned automatically to idle dwarves.

Faces of Mu

  • Bay Watcher
  • I once saw a baby ghost...but it was just a tissue
    • View Profile
Re: Job Priorities Discussion
« Reply #20 on: January 28, 2009, 11:03:51 pm »

I think the best way to prioritize jobs would be to give each dwarf a workshop-style menu instead of the labor list.  You could add labors to the list the same way you add tasks to a workshop, but instead of deleting tasks when completed, the dwarf would simply always do the highest-priority job on the list that has tasks available.

For example, a dwarf with mining at the top of his list, followed by all the hauling labors, would always mine as long as there are squares available to mine.  When he runs out, he'll take the first-listed hauling job until there aren't any of those, then progress down the list until he runs out.  At which point he becomes an idle dwarf as normal.

I had a similar idea on a thread elsewhere where the player gets to order the dwarf skill list per dwarf to change their priority. This assigning jobs method fits in better with the overall game mechanics and would make it easier for new players. I'd prefer that the jobs weren't removed from the list as they were all complete, though.

Also, a global priorities list that would set priorities for dwarves whom you haven't given priorities would be good, with an optional toggle to make it override individual commands (so you can get all dwarves to do the same things temporarily). Even saving global and individual dwarf priority profiles would be awesome.
Logged

BonSequitur

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #21 on: January 29, 2009, 01:26:15 am »

A related issue is that dwarves will go idle or take less important jobs even when there is still work to be done, because another dwarf, often one which is a very long way away, has been assigned the job. It's very common to designate a large room for digging and watch as it gets dug up only partially because, by the time the last few tiles have been dug, a miner that was eating/drinking/partying/on break has been assigned to dig one of the last tiles, and is making his way painfully slowly across half the fortress. Often, that same dwarf will go hungry or thirsty en route, cancel the job, and the original dwarf which had already left will be assigned to it, causing massive frustrating delays. It would be nice if large areas designated for digging (Or dumping, or another multi-dwarf, multi-part job) were treated as a single collective job rather than spawned a lot of individual jobs.
Logged

Granite26

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #22 on: January 29, 2009, 09:27:39 am »

I think the best way to prioritize jobs would be to give each dwarf a workshop-style menu instead of the labor list.  You could add labors to the list the same way you add tasks to a workshop, but instead of deleting tasks when completed, the dwarf would simply always do the highest-priority job on the list that has tasks available.

For example, a dwarf with mining at the top of his list, followed by all the hauling labors, would always mine as long as there are squares available to mine.  When he runs out, he'll take the first-listed hauling job until there aren't any of those, then progress down the list until he runs out.  At which point he becomes an idle dwarf as normal.

I had a similar idea on a thread elsewhere where the player gets to order the dwarf skill list per dwarf to change their priority. This assigning jobs method fits in better with the overall game mechanics and would make it easier for new players. I'd prefer that the jobs weren't removed from the list as they were all complete, though.
Poor writing on my part.  I pretty much meant what you said.  Allowing the user to sort 'off' tasks could be useful, and certainly not harmful

praguepride

  • Bay Watcher
  • DF is serious business!
    • View Profile
Re: Job Priorities Discussion
« Reply #23 on: March 02, 2009, 01:57:53 pm »

This wouldn't require a lot of logic change, just editing a few numbers.

It seems like there are internal priorities. Hunting > Mining > Hauling. I don't know the full layout but I think that just reordering those hard-grained values might make things run smoother.

Basically you'd put the time sensitive tasks as highest (cooking/rendering/butchering/tanning/harvesting/planting seeds) as those tasks have time limits. Then put "skilled labor" tasks (smithing/crafting/other workshops with the priority being more difficult skills first (so gem cutting > masonry). Next it would go to resource gathering (hunting/woodcutting/pond filling/fishing/gathering wild plants/gathering webs) and then the "other" (mining/screw pump operation) and finally hauling.

Example: In the current version, if a dwarf has Hunting/Butchering/Cooking and there is a wild animal, a corpse waiting to be butchered and food waiting to be cooked, at least from my observations that dwarf (if no other dwarves complete any of the other tasks) will hunt until there is no game left, maybe butcher (if the corpses haven't rotted) and then proceed to cooking.

With the reordering of these "hard-grained" values, the dwarf will either cook or butcher until those jobs are completed. Then when there are no more cooking/butchering jobs left it will go out and hunt. When it brings the animal in, he will butcher it before heading out for another kill.
Logged
Man, dwarves are such a**holes!

Even automatic genocide would be a better approach

tsen

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #24 on: March 05, 2009, 06:49:32 pm »

A possible related solution would be the ability to create profile templates that are saved permanently and importable/exportable. Each template would act as a combination labor enabler/disabler and job priority setter. So "Farmer" might look like:

High Plant Seed
Mid  Harvest Plant
Low Mill
Low Process Plant

High priority takes the first job of that type as normal. Mid waits X job cycles for a new "High" task to come up, and Low waits say 3x job cycles. Got a new Milker/Cheesemaker?  Apply a template and forget about him/her instead of taking 30 minutes to micromanage the tasks of your new immigrants.

Something else that could prove useful would be assigning specific tasks to the templates as well, so for example we could have:

Glassmaker
High Make Glass
Mid  Collect Sand

Also, a "Universal" template for all dwarves to do if the AI has used their normal template and they're still idle would help a lot.

Lastly and only peripherally related is being able to designate 2 or more levels of priority to areas that affect the priority of hauling tasks so important areas can stay clear while the outer reaches of the fort get things done more slowly.
Logged
...Unless your message is "drvn 2 hsptl 4 snak bite" or something, you seriously DO have the time to spell it out.

Squirrelloid

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #25 on: March 05, 2009, 10:21:55 pm »

So, this sort of goes along with a number of suggestions about improving economic performance in the fortress, but it really bears on job priority.

So, all jobs have a value.  This is true now, although that value is only apparent when teh economy kicks in.

Proposal:
1: A job which isn't done after some period of time increases in value.

2: The job list is maintained sorted by current value of the job.

3: Dwarves choose jobs from the job list by choosing the most valuable job they are enabled to do

4: Dwarves evaluate value by taking the given value and adding a modifier for (a) how much they like the task and (b) how skilled they are at the task.

So, Urist McJobless goes looking for a job, and starts searching the job list.  Urist knows how skilled his is at every task, so the farthest he has to search down the job list is MaxVal - modifier for max preference + skill combination (he can't possibly choose a job lower than that).  He chooses the job he personally finds the most valuable.

Implications:
Dwarves tend to choose jobs they're good at.
Dwarves tend to choose all *skilled* jobs in preference to unskilled labor.
When the economy kicks in, jobs pay based on their current base value.

Proposal:
Players can put incentives on jobs they want done quickly (either individually or categorically).  Basically, they can add a bonus value to a job to make a dwarf take it faster.  This acts as an increase in the base value (and thus the job pays the dwarf more in the economy).

Going to such a method of job assignment is both reasonable from the dwarves perspective and a good fit for better local economic behavior in pricing of goods.

Edit: fixed a statement by adding an appropriate adjective.
« Last Edit: March 06, 2009, 12:46:13 am by Squirrelloid »
Logged

Granite26

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #26 on: March 06, 2009, 09:53:38 am »

Added your idea Squirrel.
Adding your modifier, Tsen.
Prague, yours is listed as 'hardcoded'

Important for new users

Currently Jobs pick dwarves.  This means that any intelligent behaviour coming from the dwarves requires a total rewrite of the jobs system, and likely a big slowdown.  This is easy to forget.

Squirrelloid

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #27 on: March 06, 2009, 12:41:23 pm »

Currently Jobs pick dwarves.  This means that any intelligent behaviour coming from the dwarves requires a total rewrite of the jobs system, and likely a big slowdown.  This is easy to forget.

Assuming the code is compartmentalized in a rational manner, I'm not convinced this is that hard to work around.

(1) There's already a job queue of some sort.  Various dwarf choosing proposals are merely going to require a different sorting algorithm.  (Btw, the current algorithm appears to be a stack - LIFO - based on queueing up lots of build construction orders and observing which were filled first)

(2) It should only be trying to assign jobs to idle dwarves anyway, which is exactly the trigger we need for the dwarf to want to choose a job.

(3) Currently it has to work through the list to find a suitable job, which is sort of like the dwarf looking for the job.  For example, the job stack looks like this:

build wall (iron), cook fine meal, dye cloth, make leather coat,...

A leatherworker becomes idle.  The first job tries to claim him and fails.  Then the second.  Then the third.  Finally the fourth job succeeds. 

How is that different except in semantic terms than the dwarf looks at the first job, then the second job, etc..., until he finds one he wants?

Basically, searching by job or by dwarf are effectively the same, and any improved jobbing assignment algorithm will either need to retain a memory of some number of jobs (to find a better fit), resort the queue, or both.

-------

If someone would like to explain what the current algorithm is doing to make the above not true, I'd be interested in hearing it.  Anything which doesn't boil down to the above does strike me as grossly inefficient and probably in need of a rewrite anyway.  (Why waste processor time trying to assign jobs to busy dwarves?)
Logged

Granite26

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #28 on: March 06, 2009, 01:57:45 pm »

you're on your own for research there, I just know that when the dev has talked about this topic in the past, the jobs pick dwarves thing was a major stumbling block for improvements.  Don't know the code, so I won't second guess that.

Granite26

  • Bay Watcher
    • View Profile
Re: Job Priorities Discussion
« Reply #29 on: July 30, 2009, 12:20:56 pm »

Jobs picking dwarves has also been brought up as a major cause of lag (since there is likely to be more socks that need hauling than dwarves to do it)

This is exacerbated by both sieges (lots of goblin crap) and mass mining designations
Pages: 1 [2] 3 4