I'm trying a system where the entrance has a series of pressure plates that divert creatures by type, basically like this:
* 1st plate set to creature only, opens a hatch and a door, next
* 2nd plate set to creatures and citizens, again opens a hatch and a door
the idea was that the first plate would filter out goblins, wild animals, necros, etc... all the hostiles that trigger a pressure plate, when they step on it the main path will close by opening the hatch and a new path will open through the door
only my own citizens, kobolds and other trap avoid creatures, and small wild animals woudn't trigger this plate
the next plate would get triggered by my own citizens and a new path through the door will open while the kobold path will be closed by opening the hatch...
both the goblin path and the kobold path go through 4 1x10 retracting bridges, one after the other, to ensure that even if I get the fastest enemy they won't be able to cross the 40 tiles before the bridge opens and drops them to a containment chamber 1 z-level bellow.
the point of the containment chamber is to catch all the enemies in the siege/ambush, once they enter my fort they won't be leaving, if I start killing or hurting them the others usually flee, no going back this way, as long as their friends are alive they'll keep trying to enter until I get them all... buahaha... ehem..
in the case of the goblin path the same pressure plate also triggers the 4 bridges, I was expecting that they would step on the plate, open the hatch closing the original path, also open the door and immediately re-path through the bridge corridor...
it didn't work like that, the goblin ambush I got to play with, would step on the pressure plate open the hatch and the door and instead of immediately re-pathing through the door, they would stand there like idiots so long that the bridges would retract while they still were on the plate or just stepping through the door...
Is there any documentation about how long it takes for creatures to re-path?
I read in the wiki about how many tics it takes for them to move and concluded that the fastest creatures could move 1 tile every 5 tics and the slowest 1 tile every 16 tics, that's how I came up with the 4 bridges distance to avoid any fast creatures to go through the bridges before the 100 tic delay for it to open kicks in...
Next test I did was getting rid of the door, this way they would step on the plate and only break the shorter path through the hatch, since the other path was already there they didn't seem to take extra time recalculating paths with the new path through the door since there was no door now, they would correctly attempt to cross the bridges only to fall to the containment chamber...
The problem I got with this attempt was that after the ambush leader felt and was trapped in the containment chamber the other goblins that haven't jet made it through the bridge would get stuck in place, I only got them to move when I unforbid the hatch that allows entry to the containment chamber, so basically if the other ambusher don't have a valid path to their leader they won't move, it's the same behaviour when the leader gets caged...
To detect and contain trap avoids like kobolds, I have another corridor with bridges, at the middle of the corridor on the z-level above I have an adult pig pastured on a floor grate, behind the grate there is a pressure plate that triggers the bridges, the idea is that when the kobold reaches the middle of the 4 bridge corridor, it gets spotted and revealed by the pig, that runs away from the pasture and steps on the plate, it can't leave the spotting room because it's locked by a pet impassable door, since there are 20 full tiles in both directions the kobold can not be fast enough to reach out of the bridges in any direction so it falls to the containment chamber when the bridges retract triggered by the pressure plate in the pig's spotting room.
By the way it has to be a pig or any other creature big enough to trigger a plate and that is not aggressive, I tried with dogs but instead of running away dogs attack the target so they stay on the grate trying to attack the kobold bellow, I think the pig can be automatized and auto-resets by also making the zone on top of the grate a meeting area and forbidding the door completely so dwarves don't go there, so the pig gets scared steps on the plate, drops the kobold, then the pigs goes back to the meeting zone and the bridge resets since the plate is no longer being stepped on.
I tried the dog and pig and the pig does spots the kobold and triggers the plate, the dog not quite because of the above mentioned. Haven't really tested well the meeting area auto-reset, also need to further test the system to see if any kobold makes it out in the 20 tiles...
Now going back to the re-pathing problems, I also saw this with my own dwarves on the 2nd plate, the idea was to let my dwarves go outside to chop trees and gather plants and when they would enter they could not be followed in by enemies, the problem is if the are bringing in a chopped log and they step on the plate that breaks the path by opening the hatch and offer a new path by opening the door, they get a path blocked cancel and drop the log there on the plate, in the other hand if they are going out to pick up an item and the path changes the simply re-path (or maybe is it that the drop that job and get another one??)
Of course there is also the problem that by having dwarves going in and out through the same only entry/exit they would spot the kobolds or ambushes before the enemies were able to get to 1st plate breaking the whole purpose...
To fix this I'm testing another system that minimizes who goes in and out the fortress, and avoids carrying stuff through the filtering corridors, basically is a drop chute using minecarts, the wood hauler would get the log and go bellow ground through a stair to drop the log on a wood stockpile, this is linked to a minecart that drops the wood through a chute and bellow it is dropped by plate to the final quantum stockpile that will get used by the carpenter or whatever. The hauler and woodcutter could stay permanently outside having a living area near the drop chute protected by a plate that if a goblin tries to chase them it would open a hatch in front of them.
I was thinking maybe a system where the original path doesn't change like my test without the door, or maybe if I open the door before I open the hatch they have time to re-path? and of course the leader problem... maybe some sort of device that allows for enemies of different speeds to catch up and enter the bridge corridor as a group...?