Bay 12 Games Forum

Please login or register.

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

Author Topic: Wheelbarrow  (Read 2627 times)

fmunoz

  • Bay Watcher
    • View Profile
    • http://www.wesnoth.org
Wheelbarrow
« on: September 12, 2006, 04:15:00 am »

It could be nice if dwarves were able to create and use wheelbarrows to haul heavy things around...

Lets say... a wheelbarrow lets you move things inside as half of their weigth (plus the full wheelbarrow weigth) but only over smoth stone/road/bridges surfaces (over other surfaces you could get all the penalty).
Dwarves should check the item weigth to advoid hauling a single seed with wheelbarrow.

So if a dwarf has a haul job
-Check if there are any wheelbarrow free.
--if not haul by hand
--Check if item wheigth>wheelbarrow wheigth*2.5
---if not haul by hand
--Get wheel barrow, get item put item in wb, move to destination and drop from it (just like miners do with picks)

This will really help moving those metal bar bins :-)

Logged

Mechanoid

  • Bay Watcher
  • [INTELLIGENT]
    • View Profile
Re: Wheelbarrow
« Reply #1 on: September 12, 2006, 04:18:00 am »

Could include wounded dwarves.  :D
Logged
Quote from: Max White
"Have all the steel you want!", says Toady, "It won't save your ass this time!"

fmunoz

  • Bay Watcher
    • View Profile
    • http://www.wesnoth.org
Re: Wheelbarrow
« Reply #2 on: September 12, 2006, 11:34:00 am »

A similar method could be used to get mules helping with heavier loads...
Logged

GauHelldragon

  • Bay Watcher
    • View Profile
Re: Wheelbarrow
« Reply #3 on: September 12, 2006, 05:51:00 pm »

Wheelbarrows is already in the development page i believe
Logged

praguepride

  • Bay Watcher
  • DF is serious business!
    • View Profile
Re: Wheelbarrow
« Reply #4 on: March 11, 2010, 11:06:54 am »

My thoughts on wheelbarrows would be to improve on the usage of bins.

Basically say there are 5 stones in an area that need hauling. Instead of a dwarf going over and picking up one stone at a time, it would pick up an unclaimed bin (or perhaps a "wheelbarrow" item) and move it to the first item. It would drop the bin, put the stone in the bin, and then take the bin on to the next item. Repeat until either the bin is full (do bins ever get full?) or the job is done and then the dwarf takes the bin over to the destination, sets down the bin and takes out the items one by one.


Complications:
-If bins are never full, this could get very unpleasant for large tasks. If you want 100 stones hauled, instead of them gradually being hauled you'd have one dwarf running around with a super-heavy bin.

-If items are sent for dumping, making sure the bin isn't dumped with the items

-having space to put down the bin etc.

-job claiming. Should the dwarf claim several items at a time or will other dwarves be claiming the other stones around it, this would result in Clogged announcements of "Job item misplaced". If you have 5 stones and 5 dwarves hauling stuff, one dwarf (or even all 5 dwarves) might all take bins and thus you'd have 5 bins at the location and 5 dwarves fighting over which bin does which stone go into.

Perhaps the solution would be that the bin would allow the dwarf to claim stuff within a 10 tile radius (this would be stopped by walls & impassable terrain). So he'd set down the bin and "claim" a bunch of stuff nearby, moving them back and forth to the bin before continuing onward. This would prevent some obstacles but the main problem would remain:

If you have 5 stones right next to each other, and 5 dwarves hauling, how do you have the AI identify that this is a "bin" job and have a single dwarf move a single bin to the area for collection instead of having 5 dwarves all pick up 5 bins and each try and move the 5 stones?

Logged
Man, dwarves are such a**holes!

Even automatic genocide would be a better approach

Atanamis

  • Bay Watcher
    • View Profile
Re: Wheelbarrow
« Reply #5 on: March 11, 2010, 11:57:33 am »

This is related to Bloat 10 in the development plan:
"Bloat10, WHEELBARROWS, (Future): Wheelbarrows could be made and used by haulers to do several jobs at once. The AI for this is complicated though."

Past Threads:
Wheelbarrow - September 12, 2006, 02:15:00 AM
When will Wheelbarrows be in the game? - March 07, 2007, 09:13:00 AM
Eternal suggestion Vote: 1. (783)     Improved Hauling - Wheelbarrows, mine carts, stacking, all goes here.

There is probably room to flesh this idea out further, but there has also been a great deal on interest in it already.
Logged

praguepride

  • Bay Watcher
  • DF is serious business!
    • View Profile
Re: Wheelbarrow
« Reply #6 on: March 11, 2010, 01:00:09 pm »

I know people have brought up "hey, let's have wheelbarrows' and other hauling aides, but the discussion stops there.

As I brought up, there is a HUGE issue with the AI handling wheelbarrows right. So I'm not saying "hey, I think wheelbarrows should be in the game"

I'm saying

"Hey, this is how I think wheelbarrows COULD be logically included into the game. Here is a HUGE problem with it that I can't figure out, anyone else want to step up and try addressing this issue?"


I'm betting that the AI issue I brought up is the same one that Toady realized when he said that the AI would be "complicated."

Instead of just shouting out "I want blue bats in the game" why don't we try and do something productive and actually figure out how a blue bat (or a wheelbarrow) might work. We don't have to be 100% right, but there's a better chance of us being right if we try to figure out the logic as opposed to just saying "I want it" and moving on.
Logged
Man, dwarves are such a**holes!

Even automatic genocide would be a better approach

Atanamis

  • Bay Watcher
    • View Profile
Re: Wheelbarrow
« Reply #7 on: March 11, 2010, 02:43:41 pm »

I agree, I just wanted to link in other discussions for context on the question. Fleshing out the idea further is always a good idea, no matter how many times it has been discussed before.
Logged

praguepride

  • Bay Watcher
  • DF is serious business!
    • View Profile
Re: Wheelbarrow
« Reply #8 on: March 11, 2010, 02:54:24 pm »

Well, from the threads you linked it was never really discussed. People just posted "wheelbarrows should be in the game" and more people agreed/linked to previous threads and that was that...
Logged
Man, dwarves are such a**holes!

Even automatic genocide would be a better approach

BlckKnght

  • Bay Watcher
    • View Profile
Re: Wheelbarrow
« Reply #9 on: March 11, 2010, 06:11:43 pm »

I think the ideas that I've heard here so far can be split out into three pieces which would be semi-independent:

Use wheelbarrows to speed up the moving of heavy bins.
This is the idea described in fmunoz's OP. When hauling a bin to or from the trade depot, a dwarf would fetch a wheelbarrow if the weight of the bin would slow them down by a significant amount (hopefully they'd be smart enough to consider how long it will take to get the wheelbarrow as part of this calculation). This idea would not effect jobs that don't already involve hauling bins, and it could be coded independently of the other two.

Use a bin (or some other container) to gather several items at once when performing a job that requires multiple ingredients.
This is the idea that praguepride brought up.  In this situation, a dwarf performing a job that requires several items (like the metal and charcoal bars needed to forge plate mail) would grab a bin or other container and use it to carry all of the required items in a single trip. Some new logic for how jobs claim materials might be needed for this to work well, but I don't think a massive jobs rewrite would be required.  The hauling of loose items to stockpiles would not be effected by this simple version of hauling multiple items, since stockpiles create a separate hauling job for each one. This idea can take advantage of the wheelbarrow idea above, but it doesn't require it. If wheelbarrows are considered containers themselves, they might be usable in place of bins in this idea though.

Change tasks that create many independent hauling jobs to instead create a smaller number of jobs that each require the hauling of several items.
This gets scarier than the other ideas, as choosing how to combine multiple jobs into one can be tricky (this is I think what Toady One is referring to when he says hauling changes will be hard). I think the simplest form of this idea would effect only stockpiles and perhaps large construction projects. Designating the construction of a 5x5 block floor might create 5 jobs each requiring five blocks, rather than 25 independent jobs. Creating a 10x10 wood stockpile could create 25 jobs, each requiring the collection of 4 logs (hopefully four that are close to one another). The exact number of items to group into a single job could be determined in lots of different ways (and the details of the algorithm might be something that gets adjusted over several releases). This idea would enable the bin usage from the second idea above to be used when filling stockpiles and building megaprojects. Indeed, the code for this idea would probably require the bin one to be written first.
Logged

praguepride

  • Bay Watcher
  • DF is serious business!
    • View Profile
Re: Wheelbarrow
« Reply #10 on: March 11, 2010, 08:10:19 pm »

And I think before this could be addressed, how jobs are selected would need to be fixed.

As I type this, I watch a dwarf go clear across the map to bring back a stone for a masonry job. It's comical because I've got a 1-square stone stockpile right in front of him. So he's sitting in the craft shop and decides "I need a stone."

He has to somehow step past the 100+ stones right in front of him to go on a month long journey across the map to pick up a random stone on the ground.

/sigh.

Sometimes I wonder if dwarves just shouldn't be allowed to pick their own material, period. It might make things a hassle, but it also might make things FAR easier. Using the standard material selection screen would mean that every job you queue up could use either the exact material you want or the closest material (if you just enter - enter). Then perhaps a toggle to indicate whehter you want to use a "wheelbarrow" (or as I call it, a mobile bin) to speed things up...

but I digress...
Logged
Man, dwarves are such a**holes!

Even automatic genocide would be a better approach

neek

  • Bay Watcher
    • View Profile
Re: Wheelbarrow
« Reply #11 on: March 11, 2010, 08:38:29 pm »

You know, that never works either--when making a wall, they never select the stone where the wall is supposed to go, they always grab the one right next to it. Then they see the stone already there, and think, "Ain't that some shit. I'm going to grab a drink."

With just a thought, I'd probably do something like this:
1). Check total number of identical hauling jobs and dwarves with appropriate hauling job and free job.
2). Divide total number of hauling jobs amongst available dwarves.
3). If the weight of total jobs exceeds the dwarf's carrying capacity, check for free moveable container appropriate for job (bin, wheelbarrow, chest, bag, etc.).
3a.) If free wheelbarrow, reserve, move to grab. Determine total to carry by by dividing total items to be moved by bin capacity.
3b). If no free wheelbarrow, determine total that can be carried in a single path.
4). Path first hauling jobs in a circular route. Assign top-first to nearest item, then to next nearest stone until trip has been exhausted. Move next dwarf in line to reserve the next nearest stone, ad nauseum, until all available hauling jobs are queued up.
5). Go to 1.

It handles two things at once: 1). dwarves can carry far more than they let on. This resolves that problem by simply pathing to the nearest and next nearest, until total carrying capacity or total weight has been exhausted. Rinse and repeat. 2). This pathing system can then be applied to, say, planting--a farmer will grab a bag of seeds instead of one seed at a time (as seed bags aren't mixed.) This will lead to some odd problems, like a dwarf hauling a metric dwarf-ton of crafts from point A to point B. Determining maximum carrying weight is finicky, as a dwarf can haul ridiculous weights around, just at a slower speed. There needs to be a threshold (so the variable in mind would have to derived from endurance and strength at the same time); that is, a dwarf's maximum carrying weight is enough to not over-exert the dwarf.

How much processing power this would take, I can only imagine, but if it's set as the norm and handled fairly succinctly, it might be a good start at impoving the system.
Logged

Norseman

  • Bay Watcher
    • View Profile
Re: Wheelbarrow
« Reply #12 on: March 12, 2010, 12:06:57 am »

My thoughts on wheelbarrows would be to improve on the usage of bins.

Basically say there are 5 stones in an area that need hauling. Instead of a dwarf going over and picking up one stone at a time, it would pick up an unclaimed bin (or perhaps a "wheelbarrow" item) and move it to the first item. It would drop the bin, put the stone in the bin, and then take the bin on to the next item. Repeat until either the bin is full (do bins ever get full?) or the job is done and then the dwarf takes the bin over to the destination, sets down the bin and takes out the items one by one.

The bin is going to get heavy. I think it would be better for the dwarf to set the bin down, put the stone in it, then put the other nearby stones in the bin, then carry the bin away. If it has to carry the bin while it goes to each stone, it will be slow and unrealistic. Nobody wants to carry a bin full of rocks around while they pick up rocks.

Also, bins do get full. Dwarves eventually stop putting things in them.

-If items are sent for dumping, making sure the bin isn't dumped with the items

Just use the bins like temporary 1x1 stockpiles. When you want to haul rocks, rock stockpiles are automatically made on top of some of the rocks. Dwarves carry bins to the 1x1 stockpiles as normal, and fill the bins in the stockpiles as normal. When the bins become full, they're carried away to either dumping points or other stockpiles. If they're carried to normal stockpiles, the bins are simply left in the stockpile, assuming the stockpile has not reached its limit on bins (if it has, the bin must be unloaded). If they're carried to dump points, a new temporary 1x1 stockpile is created near the dump point, then the items inside the bin are designated for dumping, though the bin is not. When the bin is emptied, the temporary stockpile is removed and the bin becomes available for reuse.

-having space to put down the bin etc.

Should be easy in most cases. There might be some special cases where it would be difficult, like if you wanted to haul all of the items in one very large stockpile to another very large stockpile. You'd just have to put the bins on the nearest available square. It wouldn't be perfectly efficient, but it would be better than what we have now.

-job claiming. Should the dwarf claim several items at a time or will other dwarves be claiming the other stones around it, this would result in Clogged announcements of "Job item misplaced". If you have 5 stones and 5 dwarves hauling stuff, one dwarf (or even all 5 dwarves) might all take bins and thus you'd have 5 bins at the location and 5 dwarves fighting over which bin does which stone go into.

When you have a cluster of stuff that needs to be packed and moved, calculate how many items can go into each bin. If 10 items can go in each bin, then make one temporary stockpile for each dwarf with the hauling labor enabled, to a maximum of the number of items. If we have 100 items, and 5 dwarves with the hauling labor, then we make 5 temporary stockpiles. If we have 100 items and 15 dwarves with the hauling labor, then we make 10 temporary stockpiles.

A cluster of stuff that needs to be packed and moved would be defined as items which are no more than, say, 3 tiles apart from any other item in the cluster (ignoring the Z axis). Once you've determined how large the cluster is, you make the temporary stockpiles anywhere inside the cluster, or as close to it as possible if they can't be made inside.

Perhaps the solution would be that the bin would allow the dwarf to claim stuff within a 10 tile radius (this would be stopped by walls & impassable terrain). So he'd set down the bin and "claim" a bunch of stuff nearby, moving them back and forth to the bin before continuing onward. This would prevent some obstacles but the main problem would remain:

Once the bin is set down into the temporary stockpile, it can claim enough nearby unclaimed items to be filled. It claims the nearest items first and ignores items which have been claimed by other bins already.

If you have 5 stones right next to each other, and 5 dwarves hauling, how do you have the AI identify that this is a "bin" job and have a single dwarf move a single bin to the area for collection instead of having 5 dwarves all pick up 5 bins and each try and move the 5 stones?

First you do a cluster test - when an item needs to be hauled check for items of the same type within 3 tiles (ignoring the Z axis) which also need to be hauled, and which need to be hauled to the same or a nearby stockpile or dump point. If there's at least 3 items, it passes the cluster test. If there's less than three items nearby, we don't need to bother with bins.

If we pass the cluster test, we continue checking to see how large the cluster is. Once we've assessed the size of the cluster, we calculate how many bins will be needed to contain all the items in the cluster. When we determine the number of bins, we check how many dwarves have the hauling labor enabled. We create a number of temporary stockpiles equal to whichever value is lower: the number of bins necessary, and the number of haulers.

We position the temporary stockpiles on top of items in the cluster. The exact location doesn't matter too much.

Now that we have the temporary stockpiles we have dwarves bring bins to the stockpiles. They set the bins down and the bins claim all the items nearest to the bins. Any dwarf can then move the claimed items into the bins that claimed them. When the bin is full, the bin is taken to the stockpile or dump point where it will be unloaded if necessary. As soon as the bin is picked up, the temporary stockpile it was on is removed. If more temporary stockpiles are needed (because there weren't enough haulers to get everything in one pass) they are created randomly on top of any items in the cluster that remain unclaimed.
« Last Edit: March 12, 2010, 12:10:01 am by Norseman »
Logged

jfs

  • Bay Watcher
    • View Profile
Re: Wheelbarrow
« Reply #13 on: March 19, 2010, 03:38:15 pm »

You know, that never works either--when making a wall, they never select the stone where the wall is supposed to go, they always grab the one right next to it. Then they see the stone already there, and think, "Ain't that some shit. I'm going to grab a drink."
My idea for a (partial) solution to this:
Make the "move material to construction site" and "construct building from materials" into separate jobs.
For example, you order 10x10 (100) tiles of floor to be constructed and pick whatever stone. You then get 100 "haul stone to constuction site" jobs, and when each of those get completed a new "construct floor" job is created.
Another (potential) part of the solution would be to, the first time a construction job fails because of site blocked, the job just gets moved to the back of the internal queue of construction jobs to do, but also gets a flag. If a flagged job is begun, but is still/again blocked, only then it gets suspended.


Also, I like the idea of multi-hauling items by picking an empty container, placing it somewhere, which could make a temporary building (which the player couldn't control), which possibly more than one dwarf could work on filling with stuff for moving. Then finally someone would pick it up.

How about makeshift wheelbarrows by attaching rope or chains to a (rolling) barrel?
Logged

praguepride

  • Bay Watcher
  • DF is serious business!
    • View Profile
Re: Wheelbarrow
« Reply #14 on: March 19, 2010, 03:47:42 pm »

The issue about bins & weight is an iffy one. For heavy things like stones, yeah, but what about light things? Having a "basket" item that gatherers can take to plunk down in the middle of an herb field or farm, they can load that with stacks of food no problem.

Ammo is another light item that might need gathering. Whether for melting or if ammo can finally be restacked properly then gathering up usable ammo is a definite use for a "bin" of some sort (possibly take quivers and fill them up?)
Logged
Man, dwarves are such a**holes!

Even automatic genocide would be a better approach
Pages: [1] 2