Blecki / dwarfcorp

An open-source 3D colony management game for PC, Mac and Linux
http://www.dwarfcorp.com
Other
580 stars 71 forks source link

Dwarves can easily get stuck. #15

Closed Solsund closed 7 years ago

Solsund commented 7 years ago

All you have to do to shut a brand new game down is accidently dig two blocks deep with all three digging dwarves. Because dwarves can only dig tiles one square away this means a dwarf can not do the essential upwards diagonal dig required to craft a makeshift staircase back out.

Your only options are not pretty. You can dig a small trench then have the game build a Wall in the pit for them to use as a stepping stone back out. That is assuming you have anything in your stockpile. If you don't then you have to dig a 3x3 area for a stockpile then try to build out using your builder, who is now stuck until it works.

If somehow you dig into a cave and fall more than one block down this is still theoretically possible but is tremendously difficult to do. I managed to make three steps up before my dwarves would refuse to go any higher despite the ceiling having empty space to jump into.

A lot of this could be solved by letting dwarves dig diagonally up, so long as the block above them is already missing. Then they could construct their own stairs without all the extra steps, assuming they don't refuse to climb as well.

yueranyuan commented 7 years ago

Yea I've noticed this kind of stuff. I agree that diagonal digging would be nice but aesthetically would it look odd?

Also, It is actually rather difficult to build stairs since it requires a fairly significant amount of micromanagement from the player. The only things that are painless to dig are cuboids.

Having the dwarf AI build stairs automatically is not really a solution - what if they destroy blocks they shouldn't destroy?

Solsund commented 7 years ago

I don't think a diagonal pick would look that bad considering they can already pick out a tile above their own head. It's one of the things that would need to be tried out and we can see how natural it feels.

When I said to "Have them build their own stairs" I more meant that a single miner dwarf could dig out of a hole without having to pull in a builder to build the stepping stones. I wasn't meaning true automation.

mklingen commented 7 years ago

This issue should be top priority. I've always played the game in 2D much like Dwarf Fortress -- mining one slice at a time. It seems most other people like to make Dwarves mine pits and other 3D structures, which is cool and should be supported.

Dwarves can actually mine any block that is 3 away at the moment (including diagonals). The behavior you see is a combination of a few factors:

  1. Dwarves cannot climb walls (so they need to jump on top of blocks to get out)
  2. Dwarf path planning tells them to go to any 6-way (manhattan) adjacent voxel before mining
  3. Mining tasks are assigned using a greedy task allocation algorithm. This algorithm assigns the voxels top to bottom nearest to furthest.

The result is that if you tell the dwarf to dig downwards he may get stuck in a situation where mining a block causes him to fall into a pit that is more than 2 deep. From there it may be impossible to get to a 6-way adjacent voxel to mine the next block, resulting in failure. The inverse problem exists when trying to build towers.

Ways that this can be fixed:

yueranyuan commented 7 years ago

Re: Matt's solutions.

mklingen commented 7 years ago

I have alleviated some of these issues in the past few commits. For example, https://github.com/CompletelyFairGames/dwarfcorp/commit/1fbea99bfd77c1c868294e7065b96b4a3dd0309d makes it impossible to select invisible voxels unless the player explicitly presses a key. I have also made it possible for dwarves to climb out of danger when needed. Next I will fix the planner so that dwarves can plan to a block that is 26 adjacent rather than just 6 adjacent.