PING-PONG...
Scheduling is hard. This is why sometimes such systems turn out to have small caveats and strange behaviors. And in my project I try to compromise as little as possible.
Generally speaking, moving stuff to stockpiles is not that hard. It can be hard to make it fast, but the general idea is simple: select an item from the pool of hauling candidates, select an appropriate dwarf for the task, plot a path from the dwarf to the item, add a pick up task, plot a path to the destination stockpile, add a place item/update stockpile task and pray that while these actions are executed, a different dwarf does not decide to obstruct your path. This is the most basic way to do it, and after you get a good implementation for this you will most likely be fed up with scheduling and pathfinding. With this approach, if a source stockpile has multiple items a ping-ponging effect will appear: the dwarf will go from source to destination and back several times, until the source stockpile is depleted. For a lot of items this is what you want. Logs, boulders and other large or heavy items should be carried one at a time. Even if the object is uncumbersome enough to carry two, I would prefer carrying one without reducing your movement speed.
But for harvested plants, this ping-ponging effect is not desirable and just seems lazy. Here is a video showing it in action, with me pausing after every action to show how stockpiles update:
A better system is needed only for food and other light items. But a smarter system will be exponentially more complicated. Since I started the post saying that I will not compromise, I will embark on the path of non-compromising. A path that starts with smaller compromises! The absolute system will allow a dwarf to fill up his inventory and then place all items in appropriate stockpiles. Without wasting a lot of time and keeping your dwarf locked on this task. But an intermediary system will allow the dwarf to pick up as many items as he can from the same cell and attempt to place these before moving on to other cells. Here is another short video showing drastically reduced ping-ponging levels:
This is why food stockpiles were a lot more complicated to get right.
I still need to decide if it is worth it to visually differentiate harvested food sacks based on content.
And of course, the item browser will show food stockpiles the same way it works with wood, but since I am experimenting with short videos instead of images, I won't spoil this post with a screenshot.
Next post will be about stone stockpiles. After I have another stockpile post scheduled, but I will take a break showing some buildings, probably the kennels, in order to not overly bore people with so much stockpile talk.
First video is not working(says it's private) second is fine
ReplyDeleteThanks for sharing your development. Can't await Stoneage :D
I'm still following this! Can't wait to actually play it!
ReplyDeleteTo Phil:
ReplyDeleteStrange, the problems seems to have fixed itself.
Can you see the video now?
Yeah, now it's working
ReplyDelete