Bay 12 Games Forum

Please login or register.

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

Author Topic: Dwarves planning their pathing before they build  (Read 6855 times)

ThatAussieGuy

  • Bay Watcher
  • King of the HFS & only man to win v0.31.25
    • View Profile
Dwarves planning their pathing before they build
« on: August 08, 2011, 09:37:53 pm »

Would it be possible to implement a dwarf taking a look at where he's standing when he build something with one enclosed side (say, a wall blocking off a large empty chamber to store water in) and decide to stand on the other side because he'd "know" he wouldn't be able to path out after he'd finished building? (or that the floor tile he just removed is gonna drop a whole section and he's standing on it rather than the safe side)

Nil Eyeglazed

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #1 on: August 09, 2011, 03:28:03 am »

Would it be possible to implement a dwarf taking a look at where he's standing when he build something with one enclosed side (say, a wall blocking off a large empty chamber to store water in) and decide to stand on the other side because he'd "know" he wouldn't be able to path out after he'd finished building? (or that the floor tile he just removed is gonna drop a whole section and he's standing on it rather than the safe side)

Umm, no?  To the first part at least.

Sure, he could realize that he'd be boxed in, if every wall was immediately adjacent and you used a cheap hack, but what about if one wall was one square away?  What about if it was two squares away?  Eventually, you have this massive change where dwarves build based on an anticipated next task and pathing to that task and so claim two jobs and path three times for every build and still do things you didn't want them to do, because you wanted them to wall themselves in on the food side, not the booze side, and you need a lever pulled but that task has been claimed by a dwarf busy building a construction such that the lever is on the same side as he is, he's gonna pull it just as soon as he's done building this wall, which should be sometime in Timber.

As for the second-- what would be the fun in that?  If you get rid of dwarven stupidity, you don't have nearly as much of a game.  Next you'll be telling me dwarves should be smart enough not to drink from burning barrels!
Logged
He he he.  Yeah, it almost looks done...  alas...  those who are in your teens, hold on until your twenties...  those in your twenties, your thirties...  others, cling to life as you are able...<P>It should be pretty fun though.

Dae

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #2 on: August 09, 2011, 03:53:12 am »

Bugs aren't features. We are the ones charged to embody dwarven stupidity. We do quite a good job at it.

Pathing jobs in advance isn't possible because it would require dwarf to take 2 jobs at the same time, which would result in situations where nobody would do this critial task because some dwarf said "Hey, I'll have a go at it, nobody touches that !".

The simplest way to resolve the problem of dwarves walling themselves in would be to optionnally specify which direction you want the dwarf to be standing when building a wall. Coupled with an algorithm that orders construction jobs based on if they block the preferred building direction of another wall, or in the worst case with an option to specify build order so you can manually change the job order, it would work.
Logged

ThatAussieGuy

  • Bay Watcher
  • King of the HFS & only man to win v0.31.25
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #3 on: August 09, 2011, 04:02:39 am »

Actually, that would probably be better.  Add a step after laying a wall that goes something like "build from which side?" or something similar.

Dae

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #4 on: August 09, 2011, 07:04:11 am »

Na, making it every step would just be a hassle when you don't care which direction they're built from. I'd insist on making it optional.

Moreover, we could force the job manager to handle wall designation rectangles as a serie of layers from the inside to the outside. What I mean is, it would spawn jobs but would put them in a "waiting state" that would be not suspended, but wouldn't get dwarves assigned to it. A sort of suspended state that un-suspend itself when all the walls from the inside layers are built. This state doesn't have to be displayed to the user, it just has to wait for the more centered square to be filled.
Even without specifying a direction, this would work, but there is bound to be some cases where it won't work and specifying a direction would be useful. By default, the direction would be to stand so the wall is between you and the center of the designation.

You'd still have hurdles when designating several zones or a few walls at a time, in which case the ability to designate direction and build order manually would be useful, but such a system would cover 95% of a player's needs.
Logged

dwarfhoplite

  • Bay Watcher
  • Gentledwarves, prepare for Glory!
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #5 on: August 09, 2011, 07:08:14 am »

the stupidity of dwarves is part of the fun in the game
Logged

Dae

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #6 on: August 09, 2011, 08:23:14 am »

Systematic stupidity isn't fun, it's frustrating.
It would be a fun feature if it was a feature to start with. For example if we had dwarves with a low kinesthetic sense, spatial sense or preferably analytical ability wall themselves in, now THAT would be a feature.
Also, it would be natural selection. Or eugenism. There's a fine line between the two...
Logged

Haedrian

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #7 on: August 09, 2011, 09:41:52 am »

An 'exploit' you can use to get around this is to put a construction on the side you don't want him to stand and suspend it. Dorfs will prefer to stand on the other side. Worked for me.
Logged
When life gives you kittens, make biscuits

Likes llamas for their long necks

Wimopy

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #8 on: August 09, 2011, 01:55:07 pm »

Step by step "Build THIS from THAT side" wouldn't help too much. Dwarves usually build from the side that's closer to the material used. (They're lazy.) If there are items on the site, it's more random, if I noticed it right. So don't build a small 1 tile room to hold water by making 3 tile walls, build the top 2 first, then continue. It's slower and safer.
Also, if dwarven stupidity causes losing and losing is fun, dwarven stupidity makes fun.
Logged
Now updating the Monster Hunter Universe mod
Current Version: 0.4.95b - Updated June 17, 2015
New Thread
Download
Old Thread

Draco18s

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #9 on: August 09, 2011, 02:26:54 pm »

Dwarves usually build from the side that's closer to the material used. (They're lazy.)

Pfft!  Ah haha!  I wish this was true.

It is, unfortunately not true at all.

Quote
Avoiding Entrapment

When building walls to close off portions of caves or mines, masons have a habit of standing on the wrong side and trapping themselves within.  To avoid this happening in the first place, know that masons have a preference on which side of their work target they will stand, in the following priority order:

    west, east, north, south, northwest, southwest, northeast, southeast.

Note that last line.  That priority order is the same for ALL TASKS from mining to building constructions.
Logged

Wimopy

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #10 on: August 09, 2011, 04:53:49 pm »

I see, I just observed how rebuilding a wall with the building material on different sides of the wall's site seemed to influence where they stand while building.

I did notice the preferences, but still, building only one tile per side seems the best option... a door that is forbidden or lever activated usually helps, if you have enough materials to spare for things like that.
Logged
Now updating the Monster Hunter Universe mod
Current Version: 0.4.95b - Updated June 17, 2015
New Thread
Download
Old Thread

JasonMel

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #11 on: August 10, 2011, 02:27:36 pm »

What about first calculating and comparing the builder's path to booze/bed/meeting room from both sides of the wall, and then, if that's inconclusive, just build on the side with the bigger enclosed area? Probably not perfect, but may guess correctly in the majority of cases.
Logged

Draco18s

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #12 on: August 10, 2011, 02:34:33 pm »

What about first calculating and comparing the builder's path to booze/bed/meeting room from both sides of the wall, and then, if that's inconclusive, just build on the side with the bigger enclosed area? Probably not perfect, but may guess correctly in the majority of cases.

Too finicky.  The game would have to know which singular object to path to (what if the dwarf doesn't have a bed room?  What if there's no booze?  how do you find "bigger area"?)

The absolutely only way to do this is to path to the X,Y,Z cooridinates of the wall itself and stop 1 tile short.
Logged

JasonMel

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #13 on: August 10, 2011, 02:55:25 pm »

The absolutely only way to do this is to path to the X,Y,Z cooridinates of the wall itself and stop 1 tile short.

But what if the dwarf decides to take stone from the wrong side of the wall?

To answer your questions:

What about first calculating and comparing the builder's path to booze/bed/meeting room from both sides of the wall, and then, if that's inconclusive, just build on the side with the bigger enclosed area? Probably not perfect, but may guess correctly in the majority of cases.

what if the dwarf doesn't have a bed room? 

Just path to the nearest bed. If there are no beds, fall back to booze.

What if there's no booze? 

Fall back to enclosed area.

how do you find "bigger area"?

The number of pathable tiles the dwarf has access to. I don't know anything about programming pathfinding, but there must be a way.
Logged

Draco18s

  • Bay Watcher
    • View Profile
Re: Dwarves planning their pathing before they build
« Reply #14 on: August 10, 2011, 03:09:16 pm »

how do you find "bigger area"?

The number of pathable tiles the dwarf has access to. I don't know anything about programming pathfinding, but there must be a way.

Flood Fill is a remarkably expensive algorithm, as are any pathfinding algorithms.

Besides, if the dwarf picks up a rock from the "wrong side" it will cause fewer problems than attempting to location the "best" destination through any other method.  It's faster (CPU wise), simpler, and more effective than a "path to booze, fail, path to my bed, fail, path to any bed, fail..." system of fallback.  In fact, a rock from the "wrong side" (when it comes up) is almost always the player's fault and can be trivially avoided by forbidding nearby "wrong side" stones before designating the construction.
« Last Edit: August 10, 2011, 03:12:31 pm by Draco18s »
Logged
Pages: [1] 2 3 4