Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Do materials search from workshop, not worker  (Read 917 times)

Neowulf

  • Bay Watcher
    • View Profile
Do materials search from workshop, not worker
« on: January 24, 2011, 04:59:21 pm »

Pretty simple, when a worker takes up a workshop job do the "find closest material" search from the workshop center square, not the worker position.
Stops the workers grabbing whatever they feel like for the first job even when you've got a stockpile of the stone you want blocks/mechanisms made from sitting next to the workshop.
Logged

aepurniet

  • Bay Watcher
    • View Profile
Re: Do materials search from workshop, not worker
« Reply #1 on: February 07, 2011, 03:46:29 pm »

i think it might be better to search from both. you take the total distance between the item, the worker, and the workshop.

Item .. [20 tiles] .. Workshop .. [20 tiles] .. Dwarf .. [10 tiles] .. Item

from the workshop - walk west 40 tiles, pickup item, walk east 20 tiles, build
  60 tiles total

from both - walk east 10 tiles, pickup item, walk west 30 tiles, build
  40 tiles total

obviously path finding is done after this stage, but ranking items by total distance (item + workshop) should be more efficient.

the only problem i see with either this suggestion or your's is that when the item is picked up, the code hasnt decided which workshop to use yet.

ideally (for me) i could designate a certain stockpile to be an input stockpile, for a workshop, and all item searching would be restricted to that.
Logged