Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Food pathing  (Read 731 times)

buzz killington

  • Bay Watcher
    • View Profile
Food pathing
« on: June 23, 2009, 04:40:26 pm »

What logic do dwarves use when pathing to food?  Assuming that multiple locations have their favorite treats, will they go to the nearest stockpile or some random location?

I always seem to see a crowd of drunken dwarves in my deepest beer cellar when there is plenty of booze closer  :-[
Logged

Albedo

  • Bay Watcher
  • Menacing with spikes of curmudgeonite.
    • View Profile
Re: Food pathing
« Reply #1 on: June 23, 2009, 05:09:57 pm »

What logic do dwarves use when pathing to food? 

Lah-jik? What is this word of which you speak? It is foreign to my dwarven ears, and offends them.  This lahjik sounds much like the infamous majik, and should be avoided.  It is not dwarven.
Logged

loopoo

  • Bay Watcher
    • View Profile
Re: Food pathing
« Reply #2 on: June 23, 2009, 07:22:05 pm »

Albedo pretty much summed it up. And, such is the way of the almighty Albedo, he had to play around with the words and make it so much more interesting to read.

Dwarves, they have no sense.
Logged

Grendus

  • Bay Watcher
    • View Profile
Re: Food pathing
« Reply #3 on: June 24, 2009, 07:47:49 am »

Dwarf pathing is fubar right now, as z-levels throw them off badly. Assuming there are two stockpiles on the same z-level with each having the specific article of food the dwarf is craving, the dwarf will run to the nearest one. It's unclear if dwarves consider a z-level to be a single step or if they use some bizarre, inverted algorithm to decide that the stone 45 grid squares away down a long single grid mined tunnel about to be flooded with magma is the best for their needs, but experience points towards the latter.

There are a few things we know. Stone dumpsites next to craftsdwarf's workshops are used fairly often, which suggests some level of primitive intelligence. Beyond that, we really don't know.
Logged
A quick guide to surviving your first few days in CataclysmDDA:
http://www.bay12forums.com/smf/index.php?topic=121194.msg4796325;topicseen#msg4796325

torne

  • Bay Watcher
  • arf arf
    • View Profile
Re: Food pathing
« Reply #4 on: June 24, 2009, 08:46:17 am »

From experimentation it seems that for finding "the nearest whateveritis" they consider distance to be the number of tiles to the object in a 'straight' line, ignoring walls and paths and allowing diagonal movement, and treating all three axes the same (including for diagonals, so going one tile north, one east and one up counts as just one, not even three, let alone the real path distance).

If you have a multi-Z-level area filled entirely with stones and stick a craftsdwarf's workshop in the middle and set it on repeat, the stones will be used up in an expanding cube:
1) First the 9 squares directly below the workshop and the 9 squares directly above it (the workshop will already be cleared)
2) Then the 16 squares surrounding the workshop, the 16 squares surrounding the 9 empty squares above and below, and the 25 squares on z-2 and z+2
3) and so on :)

It seems very likely that for most item finding tasks this is the algorithm, though it's restricted to stuff that's in the same connectivity zone (i.e. it skips areas that are entirely inaccessible from the starting point). It's just the obvious generalisation from 8-way movement distance in 2d :)
Logged