Bay 12 Games Forum

Please login or register.

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

Author Topic: Let dwarves carry more than one thing  (Read 1829 times)

Zemat

  • Bay Watcher
  • Zemat, programmer, cancels coding: Too insane.
    • View Profile
Let dwarves carry more than one thing
« on: February 09, 2008, 03:08:00 pm »

Since I don't like to waste the precious loot that goblins drop when they are hunted down like the pigs they are I set all my dwarves to pick it up. But the process can take ages since dwarves have to carry each item individually even if they are small like mittens or seeds.

Why not let dwarves be a little smarter than that? If several things have the same job associated with them, like "store in stockpile", and they are on the same place, like a dead goblin body, why not let a dwarf try to carry them all as long as he has enough hands and can carry the weight? The dwarf could make use of backpacks and bags as equipment if necessary to carry more weighty stuff and more of it. And a single dwarf could carry a bag of seeds and proceed to plant all of them in one trip instead of doing one trip for each seed.

[ February 09, 2008: Message edited by: Zemat ]

Logged
You too can help bring to life the RogueLife Project!

Align

  • Bay Watcher
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #1 on: February 09, 2008, 03:15:00 pm »

This is more complicated than it seems, I expect.
Logged
My stray dogs often chase fire imps back into the magma pipe and then continue fighting while burning and drowning in the lava. Truly their loyalty knows no bounds, but perhaps it should.

Zemat

  • Bay Watcher
  • Zemat, programmer, cancels coding: Too insane.
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #2 on: February 09, 2008, 03:23:00 pm »

Yeah I guess. But it can be carried out with a few restrictions.

For example, I guess the way a hauling job is carried out goes like this. When the job is assigned the dwarf performs two steps:
  - Go to the object location.
  - Pickup the object.
  - Go to the target stockpile location.
  - Drop the object.

This could be made a little more complex like this:
  - Pickup equipment (a bag or backpack).
  - Go to the object location.
  - See what objects in the same location have the same job.
  - Pickup the objects and store them in a bag.
  - Go to the target stockpile location.
  - Drop an object.
  - Go to the target stockpile location.
  - Drop an object.
  - Go to the target stockpile location.
  - Drop an object.
  - and so on as long as there are objects in the bag with the same job...

Of course. Maybe the way jobs are carried out is completely different and this can't be done.

Logged
You too can help bring to life the RogueLife Project!

Sean Mirrsen

  • Bay Watcher
  • Bearer of the Psionic Flame
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #3 on: February 09, 2008, 06:02:00 pm »

SUB Job
1.Take job
2.Go to job location
3.Execute job part 1
4.If job has no more parts, end.
5.While job has parts left...
6.Search for untaken job of type matching current.
7.If job does not exist, execute next job part and ->5
8.If part 1 of existing job is performable (i.e. has space left in grasp or pack), GO SUB that job.
9.Execute next part of current job and ->5
10.Check and cleanup any unfinished jobs in the queue.
11. END.

Alright, even my pseudo-coding skills are rather lacking, but the point is fairly clear, I think. Mechanics will pick up all mechanisms they can carry this way, and will be doing less runs. Etc, etc.

Logged
Multiworld Madness Archive:
Game One, Discontinued at World 3.
Game Two, Discontinued at World 1.

"Europe has to grow out of the mindset that Europe's problems are the world's problems, but the world's problems are not Europe's problems."
- Subrahmanyam Jaishankar, Minister of External Affairs, India

ilnar

  • Bay Watcher
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #4 on: February 09, 2008, 07:13:00 pm »

its a reasonable thought, and shouldnt make huge extra demands of the cpu, since the pathfinding already has to be done,,
the coding might be tricky depending on how toady set it up originally
Logged
 laugh in the face of danger,
then i run away.

Draco18s

  • Bay Watcher
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #5 on: February 09, 2008, 08:35:00 pm »

So, if there are 40 objects and 40 free dwarves....how do you assign the jobs?
Each dwarf takes 1?
Send 4, each dwarf takes 10?
One dwarf sent out to gather what he can, then assign another dwarf?
Send all dwarves, but they can "steal jobs" from each other?
Logged

Zemat

  • Bay Watcher
  • Zemat, programmer, cancels coding: Too insane.
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #6 on: February 09, 2008, 08:48:00 pm »

quote:
Originally posted by Draco18s:
<STRONG>Send all dwarves, but they can "steal jobs" from each other?</STRONG>

They pretty much do that already.

On the other hand, job assessment could be done before reaching the first job site so that the dwarf can take over all objects in a single place before any other dwarf is assigned the job. And the less dwarves you assign to a single job the more free dwarves you'll have free for other kind of jobs.

Logged
You too can help bring to life the RogueLife Project!

penguinofhonor

  • Bay Watcher
  • Minister of Love
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #7 on: February 09, 2008, 11:42:00 pm »

.
« Last Edit: October 28, 2015, 11:00:49 pm by penguinofhonor »
Logged

The-Moon

  • Bay Watcher
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #8 on: February 10, 2008, 12:48:00 pm »

quote:
Originally posted by ilnar:
<STRONG>its a reasonable thought, and shouldnt make huge extra demands of the cpu, since the pathfinding already has to be done,,
the coding might be tricky depending on how toady set it up originally</STRONG>


In fact it would reduce the amount of cpu needed. Combining Jobs together means extra people don't have to do those jobs. Meaning less CPU needed.

Logged
There is absolutely no time, to be taking time for granted. ~Busta Rhymes

numerobis

  • Bay Watcher
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #9 on: February 11, 2008, 04:08:00 am »

quote:
Originally posted by Zemat:
<STRONG>They pretty much [steal jobs from each other] already.</STRONG>

I'm trying, and failing, to figure out in what way this statement approaches reality.

Logged

Sean Mirrsen

  • Bay Watcher
  • Bearer of the Psionic Flame
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #10 on: February 11, 2008, 06:59:00 am »

Say you have a legendary stonecrafter. You tell him to make masterwork bauxite mugs nonstop. At some point he runs off to drink, and a dabbling stonecrafter that arrived in the last migrant wave occupies the workshop. That's what job stealing is.
Also frequently occurs with engravers, miners, etc.
Logged
Multiworld Madness Archive:
Game One, Discontinued at World 3.
Game Two, Discontinued at World 1.

"Europe has to grow out of the mindset that Europe's problems are the world's problems, but the world's problems are not Europe's problems."
- Subrahmanyam Jaishankar, Minister of External Affairs, India

helium

  • Bay Watcher
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #11 on: February 11, 2008, 07:11:00 am »

Sean Mirrsen

1) You fail to designate jobs and let the dwarves use whatever skills they came with != job stealing.
2) You fail to setup workshops for specific users and let the dwarves roam wild != job stealing.

Logged

Zemat

  • Bay Watcher
  • Zemat, programmer, cancels coding: Too insane.
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #12 on: February 11, 2008, 11:32:00 am »

I have to clarify. Job stealing doesn't happen as such but the effects expected from job stealing (hauling jobs canceled) do happen. You can see the effects sometimes whenever you see a "XXX cancels YYY, job item destroyed or misplaced"

It's not job stealing per se but sometimes two different jobs are assigned to the same object or same place and causes the same effect of two dwarves going after the same job. For example, if dwarves are removing stuff from a workshop which is targeted for removal and the removal happens, all the hauling jobs will be canceled.

If job stealing where to happen due to changes related to this suggestion it wouldn't be more disruptive than this.

[ February 11, 2008: Message edited by: Zemat ]

Logged
You too can help bring to life the RogueLife Project!

ilnar

  • Bay Watcher
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #13 on: February 11, 2008, 11:45:00 am »

quote:
Originally posted by The-Moon:
<STRONG>


In fact it would reduce the amount of cpu needed. Combining Jobs together means extra people don't have to do those jobs. Meaning less CPU needed.</STRONG>


not realy,,,
i mean, there would have to be a range thing, or one dwarf would grab all jobs of the same type in the whole fortress,,, not good
also theres the extra pathfinding between jobs, with the whole z level thing, and shortest dwarven path, might make things worse,
it depends on how toady set up the ai
and since its not open sourse, im reluctant to try

Logged
 laugh in the face of danger,
then i run away.

Sean Mirrsen

  • Bay Watcher
  • Bearer of the Psionic Flame
    • View Profile
Re: Let dwarves carry more than one thing
« Reply #14 on: February 11, 2008, 12:16:00 pm »

Err, no, that wasn't what my algorithm meant.

With my algorithm, the dwarf will take a job "Dump stone", go and execute its first part "Find&Pickup stone", then stop for a moment and wonder, "Are there other "Dump stone" jobs around?" and "Can I carry one more stone?", and if the answer to both is "Yes", he will take the next job as well, go and pick up that stone, then wonder again, etc, until he can't carry any more stones or there're no untaken dump jobs, at which point he'll go to the dump location and work backwards through the que, completing jobs in the reverse acquisition order, thus dumping all stones at once 'cause he's already at the dump site and he hasn't got to go anywhere.

(Actually, now I see a flaw in the algorithm I posted (it will cause him to look for another stone as soon as he dumps one), but it does convey the basic point.)

This won't cause one dwarf to take all existing jobs at once, this will cause one dwarf to take such an amount of jobs as he can realistically complete, and only as quick as he can get to all of those jobs.

Logged
Multiworld Madness Archive:
Game One, Discontinued at World 3.
Game Two, Discontinued at World 1.

"Europe has to grow out of the mindset that Europe's problems are the world's problems, but the world's problems are not Europe's problems."
- Subrahmanyam Jaishankar, Minister of External Affairs, India
Pages: [1] 2