The thing about moats is that you need to set limits on how much they can dig, which has always been one of the things I've responded to against the cry of "don't pansy out and say they can't dig as fast as dwarves" claims...
If they are stopped by a moat 1 z deep, they can just dig 2 z under it... if they are stopped by a moat 3z deep, they just dig 4z under it... if stopped by a moat 10z deep... 20 z deep, 30z deep, etc. Unless you dig moats down to the magma sea, then unless there is a finite limit on how far they can dig, moats are totally pointless.
And "finite limit" is the ultimate, if exploitable solution, because it means that if they never dig more than 5 tiles deep, any wall at least 6 tiles thick will protect you from all diggers.
As outlined in my previous two posts, I think the best solution would be some sort of pathing script or algorithm that is not concrete, having no "finite limit". However, instead, the willingness to dig (and continue digging), as well as pursue
any kind of advanced siege tactic should be determined by other factors. Currently there are a few factors dictating when a siege quits the field and retreats. Adding some sort of indicator on how serious the enemy civilization hates you and how desperate they are to try to keep killing you should be factored on top of this.
Thus a crude value for how much work they are willing to do during the siege. A less serious group will never even bother to initiate advanced siege tactics, while a more serious group will. A group seeking ultimate blood vengeance upon you will perhaps even try multiple advanced siege tactics and won't give up so easily.
Back to Digging. Digging should be pathed in such a manner, as I mentioned previously, that the least amount of work is used to create a tunnel. Any kind of stone should be evaluated as 5x the work as dirt/sand. This will likely translate to a few key points: Firstly, it means they will try to be as close to your fort as possible when digging so that they have the least amount of work to do. The tunnels should try to be a short and narrow as possible. Diggers should also try to avoid digging through stone unless absolutely necessary, and will tire from digging through stone faster than they would in dirt, and give up sooner. This restricts digging, on most occassions, to dirt layers, and will help to limit unnecessary digging and unnecessary tunnel structures that, as people fear, might ruin the map.
Also the pathing should give no precise, concrete path. It should take into account where the diggers are, where their general idea of the fort is, and a lot of randomness. It shouldn't path the shortest path directly into your fort, it should, as best as possible, guess what the easiest area to tunnel would be and try to dig in a direction until discovering your fort or giving up.
The best way I can explain it is that pathing system should give diggers two things:- Best estimated spot to start digging
- Best direction to dig in
It should be abstract. They should accidentally dig into moats, water, and magma. They should NOT automatically know where things are.
This also helps to prevent the "if they just dig one more z-level down" problem. They don't know how far down they will have to dig, and they're trying to keep the tunnel as small as possible, so they'll just keep digging until they hit the moat. If they hit the moat, then obviously they're going to need to stop. If they do, by some rare chance, detect water, they can try to dig down, but that's more work, and more likely to be stone, and more likely to be discounted.
This also makes it unlikely that deep forts will be dug through very often. It'd be lame if humans breached your fort 27 z-levels below the surface. It's too unconventional. By keeping tunnel pathing minimalist and abstract, Toady could actually do quite a job keeping it from being overpowered, lame, and annoying.
Late Addition:Sure. This might make tunneling sound underpowered. But how powerful is it supposed to be. It's supposed to try to create a path into your fort. What if you forget to make defenses? What if they build a bridge over a moat and then dig through a few tiles of stone to get into your fort? The moat isn't going to be the end-all of tunneling, necessarily.
One thing that has probably been brought up in the 25 pages of comments here:
If sappers can deconstruct walls, you might want to use walls instead of moats, if you're looking to keep things clean: the sapper won't bother digging under the wall, they'll just make a hole in it, and you can repair it as good as new. If they can't deconstruct walls – or let's say they can't deconstruct metal walls, because they aren't blacksmiths – that could be an (expensive) defense.
Though I am not sure what the appeal of moats is, except cosmetic. If you really want to passively stop sieges, decoy/ bait/ trap tunnels are a much better defense, to the point where it's boring.
When I think of Sapping, I think of
this.
I don't think any enemy unit should have the ability to deconstruct a wall. On top of this, no enemy unit should be able to dig through a constructed wall, only dirt/sand or stone. If a wall is to be destroyed, it needs to be destroyed by a Ram, artillery fire, collapsing, or an appropriately flagged enemy.