Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Another reason for hauling weight check  (Read 1203 times)

karnot

  • Bay Watcher
    • View Profile
Another reason for hauling weight check
« on: October 30, 2006, 04:36:00 am »

Something i noticed, a dwarf carrying something will always give road to the emptyhanded dwarf. So, for example, a dwarf hauling a bin full of iron bars will step aside before a dwarf merrily skipping along.

This is WRONG !
Not only its wrong for moral reasons  :) but its also slowing down all the jobs. Since dwarves hauling nothing have higher speed - THEY should be giving road to hard workers.

Logged

Aquillion

  • Bay Watcher
    • View Profile
Re: Another reason for hauling weight check
« Reply #1 on: October 30, 2006, 05:23:00 am »

Am I missing something?  I think it makes sense.  Consider how it works out:

A dwarf hauling something and an empty-handed dwarf on the way to do a different job want to pass through the same corridor.  Suppose the hauling dwarf is moving at speed 200 and the walking dwarf is moving at 1000 (pulling these numbers out of my ass, here.)

If the hauling dwarf yields, the walking dwarf will zoom through in, say, one tick, after which the hauling dwarf will haul through that space, taking five ticks.  End result:  Walker not delayed and takes one tick, hauler delayed and takes six ticks.

If the walking dwarf yields, though, he has to wait five ticks!  End result:  Walker delayed for five ticks, taking a total of six ticks; hauler takes five ticks.

Obviously in that case you want the faster-moving dwarf to clear out first.

Of course, we'd need some system to guard against starvation, where a hauler-dwarf constantly gets blocked off by walkers...  but, again, extended starvation for walkers is far more likely when you have them wait for haulers (if another hauler arrives while the first one is moving, they have to wait another five ticks...  all for a stupid step that could've been taken in one-tenth that time.)

Logged
We don't want another cheap fantasy universe, we want a cheap fantasy universe generator. --Toady One

karnot

  • Bay Watcher
    • View Profile
Re: Another reason for hauling weight check
« Reply #2 on: October 30, 2006, 06:30:00 am »

quote:
If the walking dwarf yields, though, he has to wait five ticks!

Hows that ? It doesnt make sense.
Logged

Silveron

  • Bay Watcher
  • Arichect of Destruction
    • View Profile
Re: Another reason for hauling weight check
« Reply #3 on: October 30, 2006, 12:38:00 pm »

Think railroad crossings.
Would you rather wait for a heavilly loaded freight train to rumble by slowly or a passenger carrier that zips past quickly.
(Assume equal numbers of cars per train)

In this case both the hauler and the walker are spending time passing each other. If the walker stops and waits for the hauler it basically reduces the walker to the haulers speed as well. The point being that its currently set up to not decrease the faster dwarf's speed.

Ed:
Incidentally... what IS the land speed velocity of an unladen dwarf?

[ October 30, 2006: Message edited by: Silveron ]

Logged

Cerej

  • Bay Watcher
    • View Profile
Re: Another reason for hauling weight check
« Reply #4 on: October 30, 2006, 02:01:00 pm »

You're misunderstanding the OP's concern.  Or possibly you're misunderstanding how Dwarf Fortress handles movement and yielding.
code:
<-#########->
<L>
<-.........->
<-#########->


Consider the above map, where H is a hauler and L is a lazy dwarf.  H is moving left and L is moving right.  When they meet up, H will move down a square to make room for L.  Or worse, H will lay down so that L can walk over him.

Considering both examples, H moves every 5 ticks and L moves every tick.
If H moves a square away, L suffers no delay, but H suffers 10 wasted ticks (moving down and then moving up).
If H lays down, L suffers no delay, but H suffers 20 wasted ticks (5 to lay down, then 15 to stand up).

If L moves a square away, H suffers no delay, and L suffers 2 wasted ticks (moving down and then moving up).
If L lays down, H suffers no delay, and L suffers 4 wasted ticks (1 to lay down, then 3 to stand up).

Since less time is wasted for L to yield, L should yield.  But currently, H is forced to yield.

[ October 30, 2006: Message edited by: Cerej ]

Logged

qalnor

  • Bay Watcher
    • View Profile
Re: Another reason for hauling weight check
« Reply #5 on: October 30, 2006, 02:21:00 pm »

Cerej is right. There is only one real exception:

If you have 2 dwarves in the following orientation:

code:

###############
1     2        
###############

And they are both moving rightwards, it makes sense for 2 to come to a stop and let 1 by.

There are also more complicated situations where it is better for the slower dwarf to be the one to give way, basically if the volume is high given the width of the corridor there are certain situations where it is more efficient for the slow dwarf to be the one to give way.

Overall I think that in general the most efficient solution that wouldn't hamper CPUtime would be the following:

If the interaction is in a 1 lane corridor, let it work the way it does now; the slow dwarf giving way for the fast.

Otherwise, let the faster dwarf be responsible for navigation and have the slower dwarf try and continue on his own path.

I think that generally if your main corridor is at least 6xn this is probably the best way to do it without impacting the CPU, but I'm not sure I can imagine every complex situation that might arise from it.

Logged

Sord

  • Escaped Lunatic
    • View Profile
Re: Another reason for hauling weight check
« Reply #6 on: October 30, 2006, 08:08:00 pm »

I think in all cases the faster dwarf should yeild to the slower one. Even in qulnor's example, if I were the slow dwarf carrying a heavy barrel and some young whippersnapper thinks I should stop so they don't have to slow down, well, lets just say they got's another thing coming...

I don't really care much about the efficiency of it. But I would like the dwarves to act like dwarves. Can't really imagine them routinely yeilding to cats and dogs, just because the little beasties are quicker.

Logged

qalnor

  • Bay Watcher
    • View Profile
Re: Another reason for hauling weight check
« Reply #7 on: October 31, 2006, 12:08:00 pm »

Well efficiency is the point of the discussion I think, although you certainly have some interesting points besides that.

And I would certainly not want any dwarf yielding to a cat or dog under any circumstances. I don't know that that happens, does it?

I've never paid that close attention to it because usually dogs come in clouds, and figuring out who is yielding to who and who is just getting swarmed by dogs isn't obvious without examining it closely.

Logged

Sord

  • Escaped Lunatic
    • View Profile
Re: Another reason for hauling weight check
« Reply #8 on: November 02, 2006, 06:27:00 pm »

quote:
Originally posted by qalnor:
<STRONG>And I would certainly not want any dwarf yielding to a cat or dog under any circumstances. I don't know that that happens, does it?</STRONG>

Yes. Just watched in v0.22.110.22b as a dwarf first walked around (moving down-right-right-up to avoid the left-left cat), then ran in to a second cat in the doorway and turned yellow and took 10 or so updates to start moving again (the cat was unaffected). I single stepped to watch the interactions.
Logged