|This article is about the current version of DF.|
- This page is one of several inter-related articles on the broader topic of defending your fortress and your dwarves. The defense guide is a general overview of the threats that will challenge your fortress and things to consider when preparing a standard defense. For tips on laying out your architecture to protect your military, see security design. For complex traps that are not a minor/optional part of a larger defensive plan (but might be adapted or plugged into one), see trap design. For specific advice on how to get your soldiers prepared for any threat, see military design.
In Dwarf Fortress, you will often find yourself beset by hostile creatures looking to murder your dwarves or take their treasures. Protecting your fortress from intruders is a challenging task and a broad, complex topic. A wide variety of creatures can threaten your dwarves, and there is no one approach or philosophy that perfectly addresses every possibility. Fortress layout, military organization and training, traps and more, all contribute to the overall "defense" and survivability of your fortress and the dwarves that live and work both within there and in the world around it, and likewise no one article can include every last detail. This guide will pull from many other articles, but will prefer to refer to those rather than re-post information that is already found (and better placed) there.
There are three important things to consider when planning the defenses for your fortress. First, you must protect the fortress itself - the buildings, the hallways, the dwarves within it. But second, protecting the dwarves outside and topside as they go about their work is also important. These two goals can often be rather divergent, as your dwarves may need to wander the open countryside to collect herbs, cut trees, hunt, fish, and while outside the bounds of your fortress they can find themselves quite vulnerable.
Lastly, there is game style - you want the game to be "fun" for you, and with some strategies it's quite possible to defend yourself into complete boredom, or just go down a road that is not attractive style-wise. While this article cannot tell you how to have fun, it will comment on this when appropriate, and you should keep it in mind as well.
Note - There is not room in this article to expand adequately on every sub-topic - please see specific articles for a complete discussion as desired.
 General guidelines
While admitting that "Rules are made to be broken", there are some general recommendations that have a proven value in defending a fortress:
- Minimize fortress entrances: Have a strong and clear distinction between inside and outside. This usually corresponds to underground and surface, but not always - you can have a complete medieval-style castle complex on the surface. But each point of entry should be hardened against attack. Don't make more entrances than really necessary. If there is a useless or redundant opening, seal it off, one way or another. (Some creatures can destroy doors if they can reach them, but drawbridges are safe.)
- Concentric circles: Think redundancy - one wall may not be enough. With the existence of door-destroying and bow-wielding attackers, double or multiple hard barriers between the inside and the outside are essential to fend off the worst assaults, and if they get inside one barrier it's nice to have another behind that. Sometimes captives will escape their cages inside your fortress. The choke points between the circles are where you build traps and lockable doors, and station troops.
- Assume the worst: Build up your defenses before the enemy shows up - like right now! Plan on being sieged by scores of goblin archers, door-breaking trolls, invisible kobold master thieves, dive-bombing giant eagles, flame-breathing fire imps, angry elephants, and a bronze colossus - all at once. Hopefully, you will never have to face that kind of threat, but being ready for anything is the best bet, and, more realistically, when things go wrong (and with dwarves, they will, just believe it) you will have a buffer of defense to fall back on.
Danger comes in a variety of forms in Dwarf Fortress. Understanding the diverse threats is the first step to keeping your dwarves alive.
- Wild animals
- Creatures vary in threat and habits. Some animals are quite dangerous, but most are easily excluded by the humble door or hatch, even if it's not forbidden. Some few are able to destroy doors and hatches, statues and other buildings, and some are thieves (see below), or will eat your food (such as bears). A lone animal, even a clear predator, will usually flee from a stronger force, but some undead and evil creatures can be blindly aggressive. Combat is random, and any animal can kill any dwarf - and vice versa.
- Thieves & child snatchers
- Many creatures are "thieves" in the general sense, and offer their own potential headaches - a raccoon or small tribe of rhesus macaque or mandrill monkeys can enter an unsecured area unannounced, grabbing items of value and running, and it doesn't matter how many you kill if one or three make off with some prized possessions. But a creature with a listed ( ) profession of Thief has a few additional nasty surprises, namely being invisible until spotted by your dwarves or domestic animals, being able to bypass locked or forbidden doors, being armed with a real weapon, and some imperfect ability to avoid triggering traps (though some seem better at it than others). Kobolds and goblins are individually more dangerous than animals, but when spotted there's a special message, either "Protect the hoard!" or "Protect the children!", as appropriate.
- An ambush is a small number of enemies (less than ten) that are invisible until spotted, but are easier to spot than thieves. The alert message is "An ambush! Curse them!" They skulk around the outside of your fortress, unseen until they strike, looking for wandering dwarves or caravans entering or leaving. They will often flee off the map if challenged.
- A siege is a large number of armed and organized attackers that are announced as soon as they appear on the map. The alert message varies by race - the most common being a goblin siege announcement: "A vile force of darkness has arrived!". While siegers are on the map, the word "SIEGE" appears in the top corners of the screen. Siegers are organized into a number of squads, each squad having a different weapon choice. Some sieges bring dangerous creatures to aid the armed attackers. If you are at war with a civilization, expect annual sieges at least.
- Enemy archers
- Attackers with bows or crossbows are worth separate mention as they are much, much more threatening than those with melee weapons. Out-shooting them with your marksdwarves is risky, as is charging them with inexperienced melee fighters. Well-trained, well-armored melee dwarves or special techniques are recommended to shield your dwarves from the deadly rain of arrows.
- Building destroyers
- Flying animals
- Melee units sit there and do nothing against flying enemies, slowly losing their teeth from attacks from usually weak fliers like buzzards. Therefore you need to make sure you have flak. Often the case is that the ranged weapons disable the enemy such that they can't fly and the melee units finish them off. This is especially the case with flying Forgotten Beasts.
- A werebeast is a humanoid cursed by a deity to transform into a savage animal form every full moon. When in animal form, they are stealthy (invisible until spotted) and extremely strong, and they avoid traps and can destroy buildings. If a dwarf is bitten by a werebeast in animal form, he may be infected.
- A vampire is a humanoid cursed by a deity to become a bloodthirsty undead horror. They will disguise themselves as an ordinary dwarf (or other person), with a false name, history, list of relationships, etc. Their immortality gives them plenty of opportunity to practice skills (particularly social ones), so they will often be elected to a position like mayor. Once inside your fortress, they will drink the blood of sleeping dwarves, which is usually fatal. They have enhanced speed, strength, stamina, and pain resistance in combat, and do not need food, water, booze or air (thus cannot be drowned).
- Titans and Forgotten Beasts
- Titans and forgotten beasts are similar to megabeasts in terms of size and strength, but are procedurally generated from random creature parts and may have procedurally generated special attacks (such as fire breath or web shooting) as well. Titans and forgotten beasts appear alone, with an alert message that mentions the creature by name. The two are very similar; titans attack from outdoors and forgotten beasts attack through underground caverns, but otherwise they present the same challenge. A titan from a benign biome will not attack your fort.
- Before hitting that war with anyone. If so, things can get hot fast, with more and larger ambushes and sieges, and sooner. This is unusual, but a nasty surprise if you didn't check. and embarking, to civilizations on the pre-embark screen, and see if you are at
 Elements of a defense
Dwarf Fortress is very open-ended, and any number of defensive, engineering, fortification and military principles that have worked in reality will work in DF. Combine different elements into the defense you want.
A moat with a drawbridge is perhaps the simplest defense known to Dwarvenkind, and not a bad start. The Fortifications article on Wikipedia is also a good source of inspiration. But simply shutting the outside world out and allowing invaders to mill about outside your moat is not always a desirable solution. Enemies will still prevent caravans and migrants from arriving, will kill liaisons, and prevent any desired outdoor activities. In addition, Dwarf Fortress players often find it enjoyable to perpetrate mass slaughter of invaders rather than helplessly glare at them from inside their caves.
For this, you will need a more complicated defense than a passive ditch and walls. One common method of defense is to build a walled structure above the entrance to your fortress, stationing Marksdwarves on the second floor overlooking the drawbridge-entrance. Another is to engineer a very long but narrow entrance, at the end of which are ballistae waiting to unload at unfortunate monsters in the field of fire. The variations are infinite.
 Physical layout
These are the walls, floor, fortifications and so on that create the towers and perimeters of your fortress, acting as physical barriers for your dwarves and against threats. However, they always work in conjunction with the other elements. Creative use of layouts can achieve some quite satisfying results.
For reference, arrow fire is usually about 20 tiles, though stray shots can travel further, and firing from higher elevations actually reduces the range about 1:1.
- The lay of the land can be your friend, but the way of the dwarf is to shape the land as needed. Removing slopes can create safe, private terraces and valley walls that prevent all access. Chasms and rivers (not brooks!) create hard barriers, but an open chasm or magma vent can be a source of dangerous creatures. Small hills can serve as vantage points for archers (yours or theirs!), but if carved with stairs leading up from within, they can be quick strategic strongpoints. Narrow valleys can become chokepoints for entrances, where your marksdwarfs can overlook any who come and go. Augmented by constructions below, the terrain becomes your first option for defense.
- Do note that as of version 0.40.24 invaders can now climb walls and, in some cases, swim rivers or moats. This limits somewhat the usefulness of natural defences, but with care they can be augmented by constructions and still provide important first-line defences.
- Some players take quite a while before their first unpause, using that time to look around and think about the terrain, planning their fortress entrance and envisioning basic defenses.
- Constructing walls around your entrance is the simplest start, and an essential part of fortress defense, but a wall alone is not a complete defense. Currently, no creature can knock down a wall but they can climb on 1 z high walls. Not only does it keep enemies out, your archers can stand on top of the wall and fire down. Keep in mind that this makes them vulnerable to enemy fire. To help protect against that, build fortifications.
- Also, keep in mind that flying enemies (such as swarms of birds) can fly over a wall, so you might want to build a ceiling to seal off particularly important areas.
- Fortifications are the marksdwarf's friend. They do not allow passage, but allow hand-held missile weapons to pass through, and are often placed on top of walls for tactical advantage. Projectiles have a chance of being blocked, based on the firer's skill and distance to the fortification. There's no chance of the missile being blocked if the firer is adjacent to the fortification, with increasing chances as any distance increases. Keep your marksdwarves close and keep enemies away - if an enemy archer can walk up to your fortifications, now they're adjacent too, and the fortifications will have zero effect. Build fortified firing platforms above ground level and put a nice wide moat between the wall and the enemy. Fortifications have no effect on siege engines.
- Like Fortifications, Vertical Bars and Wall Grate will also allow projectiles to fire through them while impeding units' movement, but these constructions provide no defense - the missile fire works both ways equally. Unlike Fortifications, Bars and Grates may be connected to a Lever, and opened or closed remotely - thus, they are good for forming a portcullis.
- Consider a wall of fortifications, then further away from your fort a wall of Bars. Your marksmen are always adjacent to the Fortifications however the enemies can only ever get as a close as the bar wall. While the wall doesn't offer any extra protection it does stop the enemy at the fortification problem. Also can be achieved by a ditch in front of the fortification.
- Now that dwarfs can climb 1z walls, it is possible for dwarfs hiding behind fortifications to dodge over said fortifications when they come under enemy fire, even if that enemy fire is coming from the far side of the fortification. If you happen to have lava moat on the far side of your fortifications, this can lead to unforeseen Fun.
 Doors (& Hatches)
- Doors are the simplest way to keep an enemy out. (A floor hatch in this sense is just a Z-axis door, and in most ways works the same.) Most creatures will be stopped by any door or hatch, though some others can smash them. With a little tinkering, doors can be made 3 tiles wide or more, but this remains mostly for aesthetics without much practical use, as wagons will still not be able to pass them. You can forbid doors to keep (most) hostile humanoids and creatures out, and your dwarves in.
- Additionally doors can specifically be closed only against animals, to keep beloved pets from wandering into enemy fire (they may pile up at the door and use the chance to slip out with a dwarf).
- Forbidding all doors and entrances breaks the pathfinding of enemies, making them lurk at the map border where they entered, which can be quite inconvenient in the case of an invisible ambush that then rushes at your fort in just the moment your civilian dwarves move out to, say, cut trees.
- Floodgates, alone or in a line, may be used as removable walls since they need no support and disappear when "opened" remotely, although using a wide drawbridge will be much more economical in terms of materials and mechanisms. (Be aware that building destroyers can batter down closed floodgates, and any object can prevent a floodgate from closing again, even a single, stray crossbow bolt or monarch butterfly remains.)
- A floodgate can be used just like a door, with two differences: A floodgate can be placed anywhere, unlike a door, which needs to be adjacent to a wall. A floodgate is closed by default, and can only be opened with a lever. Be careful not to trap your dwarves.
- Channeling a ditch is a fast and effective defense. Creating an effective moat requires several steps, including designating ramp removal. The moat doesn't have to be filled with water or magma. A dry moat is actually a better defense than a water-filled moat, because many creatures can swim across a water-filled moat. If you want to build an access/escape route for your moat, consider where it leads - the enemy might use that too.
- Keep in mind that moats filled with water will freeze periodically in Temperate climates. This can work against you, letting the enemy cross it with ease and waltz right up to your defenses, but they can also work in your favor if the enemy happens to be swimming or treading on it as it freezes or thaws, respectively. A compromise would be if the moat and wall combination had at least five z-levels (preferably block walls) to climb above the water level; then the enemy would still have to climb.
- A moat cuts off access for your dwarves as well, so a retractable- or drawbridge is usually included in the design. But a moat with a non-retractable bridge is still potentially useful: It keeps enemy archers away from your fortifications, and it channels enemies into a narrow and predictable path. A drawbridge without a moat can be a big remote control door, sealing an entrance when it's "up". (This doesn't work with retracting bridges.) However, an actual door activates immediately and is more suitable for smaller-scale one-tile doors.
- Bridges come in 3 forms - a permanent construction (a floor or top of a wall built out over a void), a retractable bridge, and a drawbridge. The movable type have a maximum size of 10x10 (including one solid "anchor" line of tiles at the base), and require a lever and two mechanisms to link them to be raised. Permanent bridges can be designed or later modified to include the latter.
- A retractable/raise-able bridge over a deep trench is a simple and almost air-tight defense - only flying creatures can pass it (once the bridge is raised). The raised bridge also blocks arrow fire for anything behind it. Channels may be dug to form ditches, or moats - be aware of what might exist or be planned for the next z-level down. For defensive purposes they do not need to be filled with anything - as in the middle ages, a dry ditch is more than enough to prevent ground units from approaching (though of course, projectiles may be launched over it with impunity). With a retracting bridge over the moat, any units or items on top of the bridge will be dropped into the moat (and, if the moat is filled with water, drown unless they can swim out; if it is filled with magma, they burn to death.)
- Bridges can throw creatures a distance (in a random direction) when the bridge is raised/retracted, possibly injuring them on landing. Creatures on top of drawbridges will be utterly destroyed if they are flush against wall and have a floor tile above them, as will anything, friend, foe or object, on a floor that is covered when the drawbridge is lowered. This offensive use of drawbridges is known as the Dwarven Atom Smasher.
- A drawbridge works as a door when "raised", sealing the passage it raises against. Consider this when choosing the direction a drawbridge is to raise.
- There are three important things to remember:
- Always build the bridge to raise towards the inside (so that it completes your wall).
- The lever has to be pulled by a civilian or off-duty militiadwarf, not a full-time soldier.
- Water can freeze solid in cold weather.
- Also, some rare creatures can cross fluids, even magma. Nothing but flying creatures can get out of a channel.
 Remote control
- If you link a lever to a door, hatch cover or floodgate, it becomes impossible for your dwarves to open and close it normally. Pulling the lever is the only way to open it. This keeps your dwarves locked in as well as keeping enemies out. (It's unknown if thieves can bypass a closed door once it's linked to a lever or pressure plate.) There is often a frustrating delay between ordering a lever pulled and when a dwarf pulls it, and another shorter one between pulling the lever and the barrier responding.
- Any item or creature in an open barrier at the moment it tries to close will not only prevent that barrier from closing, but that "close" signal will be lost. Any lever will have to be pulled twice more - to reset to "open", and then to (try to) close again. This is not the case with drawbridges, which crush anything and everything below them when they close.
- Automated barriers & traps
- You can automate a barrier or trap by using a pressure plate instead of a lever, but there are complications there. Unless the 'Citizen' setting is set, only "enemies" or wild creatures will trigger a pressure plate; your dwarves and tame animals can walk on it all day long. If the 'Citizen' setting is set, dwarves, diplomats, traders, and tame animals can also activate the pressure plate. No device, trap or barrier, can be constructed in a tile where a pressure plate is - that is the only constructed object that can be there. But with creativity, this can still be a powerful addition to your fortress defense.
- Full article: Trap design
Walls, bridges and fortifications provide barriers that stop intruders. However, the easiest way to kill intruders is to use traps. A line of traps can wipe out an entire ambush, and inflict significant damage on a siege. However, be aware that a design using vast numbers of traps has the potential to take some of the fun and challenge out of the game - use accordingly. Also, some creatures avoid traps (kobolds, forgotten beasts) and will simply walk right over them with impunity, unless they fall unconscious or get webbed while on one.
 Defensive Engineering
There are several types of traps that a mechanic can place in a single tile and that target a single creature, but there are larger, more complex traps that only you can design, using levers, pressure plates or other constructions. The limiting factor is your own imagination. Some examples of the more common designs include:
 The drowning chamber
Take reservoir filled with water, and put a retracting bridge over it. When enemies are on the bridge, retract it -- they will fall (or be flung) into the water and drown. Variant one: use magma instead of water. Variant two: trap the enemies in a room and then flood it.
If you allow a way to remove the water temporarily, you can even retrieve their belongings for your own use.
 The dodge-em trap
One of the disadvantages of the weapon trap is that skilled or lucky enemies can dodge the pointy bits. The dodge-em trap uses the targets' dodging ability against them. Create a narrow, elevated walkway with empty space on the sides. Place weapon traps on the walkway. The goal of the weapon traps is not to kill the enemy, but rather, to make the enemy dodge -- typically into the open space on one side of the walkway. Gravity takes over at that point, and the deceleration trauma at the end of the trip has the final say. The higher the walkway is, and the more dense the floor material at the landing site, the more damage the enemies will take upon impact.
Using lots of low-power weapons (such as training spears or spiked wooden balls) in the traps can increase the chances of forcing a dodge, rather than impaling the enemy in situ and jamming the trap.
Don't let your dwarves engage the enemy in melee on the walkway. Your dwarves will dodge and fall.... Firing crossbow bolts at enemies on the walkway from behind fortifications is fine, though.
- Full article: Military
A sufficiently large military can be used as a reactive force to rescue ambushed dwarves and safeguard the passage of caravans through unknown dangers, or even to sally out and meet a sieging force mano a mano. The disadvantages are many -- soldiers must physically move to the conflict zone which may be many screens away from the nearest entrance to your fortress, by which point dwarven lives may have already been lost. Training is slow and erratic unless carefully micromanaged (or unless a danger room is employed). On-duty dwarves will not retreat under any circumstances, and hold your position is way beyond their tactical ability, so battles may quickly spill out of your control. Therefore, keeping a lot of dwarves in a squad will increase your odds of survival when someone picks a fight with a pack of zombie troglodytes. Dwarves are also failure-prone -- even when not injured, they need time off for sleeping, eating and drinking.
Nevertheless, a military force gives you options not available any other way. See military design for various possibilities.
 Early warning
Some threats (sieges, titans, ...) are announced upon arrival, but others are sneaky. Thus, it's helpful to detect the more subtle threats before they start gutting everyone in your library.
Some animals (see below) make excellent, albeit expendable, sentries. In the case of building destroyers, you can set up statues, doors, and other furniture. These may serve not only as alerts, giving you a notification when a statue is toppled, but also as lures or delays. While the enemy is distracted by all the pretty doors, you have time to get your military into position.
Any animal (or dwarf) can act as a sentry - if a hidden enemy comes close to them, that enemy may be revealed (depending on the sentry's Observer skill). If that happens, an announcement is generated and the game is paused. Most animals aren't strong enough to take more than one armored goblin warrior, and enemies with bows are even worse. The real purpose of guard animals is to spot thieves. Anything will do here, even a kitten will do the job, and some players prefer not to risk a useful animal. You can also use this as opportunity to pasture some unwanted pets in strategic locations.
Guard animals are a good second line of defense in open entrances after your traps. A wardog can usually tear a thief apart, and will (briefly) delay goblin warriors while you respond. Also, the death of any animal will be announced (but the game will not pause), alerting you to the threat if you were not already aware of it. (Note - Some tamed animals will not fight goblins!)
Most enemies will go after your animals just as blindly as they attack your dwarves. An expendable chained animal can bait enemies into dangerous passages, even into places unconnected to your fortress. Such an animal chained out on the far side of the map can alert you to ambushes that start there before they threaten your local dwarves.
Restrain animals in narrow corridors (width 1 or 2), or in matched pairs against the walls of 3-wide corridors, preferably in places where enemy archers can't easily fire at them.
Or, if you feel like being
evil resourceful, you could attempt to get a dragon (good luck), and watch as goblins run towards it and get burned to ashes. (Be careful not to ignite your dwarves!)
 Siege engines
- Full article: Siege engine
Siege engines take some planning to use effectively, and have a range of about 100 tiles compared to a crossbow's 20 or so. Both catapults and ballistae can be very deadly, but both have their drawbacks -- they take time to reload and can only hit targets at the same z-level, and they are woefully inaccurate in the hands of unskilled operators or when loaded with low-quality bolts. Furthermore, they're manned by civilians, who will abandon their posts should the enemy get too close.
Now you know what you might face, and what cards you have in your hand. To that we add complications, things that make defense so much fun...
 Surface jobs
There are many times when dwarfs want to work on the surface. Wood cutting, gathering plants, hunting, fishing, mining exposed veins or gems, building defenses or other structures, growing above-ground crops, helping wounded comrades or recovering dropped items are only the most likely. Often they are alone and vulnerable to wild beasts or ambushes.
Burrows are one option to handle civilian eagerness, but only soldiers can currently be broken up by burrow - civilians are all grouped into the same category, so when you try to restrict civilians to one burrow to stop them from going outside, you should make sure they can still access the whole of your fort (especially if it's still expanding). You can try to wall in huge areas of the map, possibly with drawbridge gates that can open for caravans, but the larger the area, the vaster the project, the further your dwarves will be from existing defenses, and the more time they will spend working above ground.
Making smaller enclosures in key areas with underground tunnels leading to them can be an easier first step. Likewise, tunneling to the inside of an exposed vein of ore keeps your miners sealed from the outside until you are prepared to mine the last tiles, possibly after placing doors or walls just inside that tunnel. Having military stationed or patrolling nearby is another option.
- Burrows. Making effective use of the burrow system, it's very easy to set a safe place designated as an emergency burrow and restrict civilians to it. Setting that alert state when there are enemies about causes your dwarves to immediately run to the emergency burrow and stay there until the alert is turned off.
- Lock the front doors. It takes a truly airtight fortress to keep the entrance open while there are still enemies outside. If there's even one exit, your dwarves will use it. Try testing this while it's safe: Raise the bridges, just like you would in a siege, and designate some trees for cutting. If there's a way out, your woodcutters will find it.
- Forbid dropped equipment and corpses. Mark every item on the battlefield as forbidden. This includes any items dropped by dead merchants or scuttled wagons. You can have this done automatically for dwarf and enemy corpses and inventories in the orders menu at the forbid options .
- Delete stockpiles and turn off tombs. As a preemptive measure, you can easily delete your Graveyard stockpiles. Dwarves don't haul things if there's no stockpile to place them in. Turning off or removing coffins stops burials as well.
- Keep them busy. Make a bunch of busy-work for your dwarves, just to keep them underground. It's not perfect but it helps. Time to re-organize your stockpiles.
 Water sources
Access to water can be vital. Wounded dwarves need water, so if there's not an underground water source you'll lose valuable soldiers to thirst. Try to have a well or cistern your dwarves can use safely. Remember to keep an extra bucket or two available.
Some water sources are good locations for fishing, providing food during longer sieges.
 Civilians trapped outdoors
Anything that blocks intruders will also block your dwarves. This can cause the problem of dwarves being trapped outside with the enemy, and the enemy will find them. Having more than one entrance can be useful here, but each requires adequate defenses - the weakest link and all that. If you make these entrances accessible by drawbridge only, with a (short) moat outside that, and keep the drawbridge up most of the time, having lots of entrances shouldn't be too much of a problem.
 Trade depot & caravans
Factoring in 3-tile wide access to the trade depot adds a layer of complexity. Letting merchants in while keeping enemies out requires a careful balance. The merchants can reveal ambushes and thieves like any other creature, and their arrival is frequently accompanied by an ambush or a siege. If the merchants run into an enemy squad, they can be slaughtered before reaching your doors, and that hurts your reputation (as well as possibly causing your civilian dwarfs to want to go running out and collect their dropped items). Consider sending heavily armored escorts when expecting a caravan (usually the middle of the third month of each season, except winter). Unless it's an elven caravan, it will have some guards escorting it, and you can take advantage of the distraction to attack an enemy from both sides, but keep in mind that if the merchants themselves are under attack, they will flee.
You will possibly want to build the depot inside your walls/defenses with retractable-/draw-bridges, so you can seal an enemy out while you conduct your trading. Keeping the Depot at the center of the map also lets your dwarfs drag things to it faster, and leaves it to the caravan to do the hauling.
A common trade depot design involves two separately sealable paths: one from the outside to the depot, and the other from the depot to the inside of the fortress. This "airlock" design helps keep your inner fortress safe even if the trade depot becomes compromised.
The Depot Access command () shows three-tile-wide paths a caravan's wagons can take. Caravans still appear where those paths meet the edge of the map, even if they have no wagons (elves don't use them). By choosing a brook bed recessed into the ground, or building floors to block travel around the edge of the map, it is possible to keep a caravan path only a few squares wide at the edge of the board, which is completely separate from all other visitors to the map. In this way you can leave the path to your Depot open all the time with virtually no risk from sieges and random creatures unless they enter one of those few squares.
 Branching corridors
Enemies will take the most direct path to your fortress, (even if it's not very direct at all). You can use this to your advantage. Have two paths to the fortress: a long, twisting, three-wide road, and a shorter, one tile wide, trap-filled passage. Attackers will usually prefer the short and deadly path. This makes a good line of fire for a ballista, too.
Alternately, you can have a primary, convenient, direct 3-wide path to your fortress open most of the time, with a convoluted detour that is forced (by drawbridges) only during sieges, lined with traps and overseen by marksdwarves. The possibilities are infinite.
Be careful where you place the levers controlling your various entrances, traps and other defenses. Or any lever at all, for that matter. Make sure they are either central or close to locations of idle dwarfs, or both - near a meeting area or bedrooms of nobles is often a good plan. Make sure that the entire path to each lever is underground or your dwarves might be unable to reach them if told to stay in certain warrens (test this during peacetime!) Try putting all your defense-related levers in a single room, perhaps down a staircase from your meeting area, and put a door (or hatch) on the entrance(s). Then you can lock your lever-puller inside to ensure rapid response time.
Another solution to the problem of rapid response time is to make your lever room double as a pump room. Pumping is a good way to build up your dwarves' attributes regardless of whether the pump is doing work or not. If you want a dedicated lever operator or three, turn off all their labors except pumping, and set the pumps up so that they can be operated exclusively by your dedicated lever operators. Rotate these positions every so often so the attribute gain will be distributed among multiple dwarves.
For the truly ambitious, the lever room could be spread over multiple levels, and the pumps could work together to power one or more artificial waterfalls. (Waterfalls work well in this case because their operation is not fortress-critical, and your dwarves like the mist they produce.)
Use Notes to label each lever and attached device and trap clearly - if you come back to a game after a week and can't remember your levers, they are useless (or, worse,
dangerous Fun!) Color code your levers with different color mechanisms if that works for you.
 General Suggestions
 First concerns
 Pre-embark decisions
Defense starts before the game does, at embark when you're choosing your location, your dwarves' starting skill mixes, and your starting equipment and supplies. If you expect trouble (an evil biome, perhaps), then it can be crucial to bring at least one axe. Picks make decent weapons. A supply of wood means you don't have to chop trees for a while, and similarly a few simple stone (a few bauxite can't hurt) allows you to make immediate workshops even before your miner has swung her pick. While an untrained dwarf can usually wrestle most small and medium beasts, one unarmored (semi-)military dwarf with an axe or crossbow can be a big edge against most early threats.
For most starts, unless your embark location is very close to the mouth of an open volcano or you are starting in an evil biome, there should be no serious immediate threats. Unless you are at war with a civilization (visible on the pre-embark screen), sieges and ambushes don't start until you've created some wealth, the first winter at the earliest. So wild animals are your only concern, predators that might prey on lone dwarfs and thieving animals that will target your valuables.
 Striking the earth
First, look around. At the terrain, at the animals present. Scan themenu before un-pausing the game at the start, and regularly. More animals will enter the map, constantly and without warning, so keep an eye on visitors.
One of your first priorities is to get things underground or otherwise secure, to prevent rot but also to prevent theft. Carving out a channel/moat, or removing the slopes to a hill, or building a wall, or a combination of those will work fine, but better if you don't have an unwanted entrance to wall up later. Soil is very fast to dig out, and just as strong against enemies, but may not be desirable for a later, mature fortress. Balance convenience against your long-range plans and visible threats.
Consider and plan the entrance to your fortress - perhaps a ramp leading down, or a tunnel into the side of a hill or cliff. A long, narrow entrance (a valley and/or tunnel) allows you to control it, with archers, with traps, with a siege engine at the end. It gives you time to prepare your military. However, it also means that your dwarfs will have to walk that entire distance every time they enter and leave your fortress, and be that much further from help should they need it. Entrances vary from a few tiles to many dozens. Start with something smaller for now, but plan on how to develop the entrance you want later.
An L-bend, or several, or drops in z-level may provide better security, or a firing platform for siege engines and/or archers. Many complex traps involve several levels beneath the entrance (for drainage of liquids or other diabolical purposes.) Using some of the principles above, it might look something like this...
#################### (a)? (-trap ...# ? area-) . .# (A's/SE) ################...# # # #D D# # # <Inner Fortress> (Not to Scale) (a) = bait animal, on restraint # = tunnel walls, above-ground walls, valley walls with slopes removed, and/or channels ? = ramp up, drawbridge, moat, defensive structures, or combination of all traps = mechanic's traps and/or complex death traps, as you wish. ... . . = area open to sky, to prevent "dwarves staying inside" from archers outside entrance ... D = wardog on restraint (A's/SE) = future site for archers and/or siege engines (planning ahead)
The above might be longer or shorter, partially or entirely above or below ground, or have more turns. The "inner fortress" might only be a Trade Depot, with another similar entryway behind that. Instead of the turn, it might drop a level and dive below the sight of the Siege Engines. Since the first caravan won't arrive for at least 6 months, you can dig a 1-tile wide tunnel for now, or a staircase, and then dig out to another location for a more formal entrance. This is only a very rough, very simple example of combining possibilities.
 It's mine!
Consider how you will secure your valuables, your entrance, and any land you want to claim as "dwarf only" - by channeling, removing the slopes from nearby hills, maybe walls? At first, consider including at least enough above-ground terrain for any farm plots and meeting areas. This could perhaps be as small as a 5x5 walled enclosure, or be multiple compounds, but some players aim at claiming (most of) the entire map. Any barrier limits your dwarfs, but keeps enemies out until you have your fortress up and running at a basic level and are prepared to respond properly. Due to thieves' ability to get past locked doors, and a caravan needing a path that's 3-wide, you won't be able to create a hard "gate" that you can open and shut until you have a mechanic's workshop and some mechanisms for levers, to link to a drawbridge.
 Inside vs. outside
Not "above ground" vs "subterranean", but the border where the inside of your fortress starts, what you claim as "yours" vs "out there". Some fortresses just have one main gate, some try to own the entire map. Some have an "airlock", a middle ground (remembering multiple, layered defenses!) where a Trade Depot is kept, that visitors can access and is protected, but then a deeper, even more secure inner fortress - think of a castle courtyard - inside the walls but not yet inside the castle itself. A safe zone for friends, still unfriendly for enemies but taking extra precautions against full intrusion.
This can be above ground or deep underground, a direct line or a maze of z-levels - that's all up to you, how much work you think "security" is worth. Hey, it's not like you have to do the heavy lifting.
That line of defense - any line - can be passive (walls and barriers and traps only) or active, with military, either on permanent duty or with stations to report to when activated. Use remote controlled bridges to create movable walls and closed gates or open hidden moats to reroute visitors, enemies and/or your dwarves depending on the situation, so there is no one "configuration", but several different options all side by side.
 Mechanic's traps
Traps are a good friend for the starting player. We're talking the simple traps that a mechanic places - complex death traps are up to you. Stone traps are a good start - they're easy, effective against all but the biggest creatures, and ammo is plentiful if you're mining in stone. When goblins show, they can number less than a dozen to start, but grow over time. Start with a row in an early chokepoint, maybe your entry hall or outside it, make that one row into a few, and go from there. But lead your target - count on the next attack being larger than the last.
If you want to breed monkeys for skin, bone and meat, or amuse yourself with live goblins, a row or five of cage traps at the very entrance of your fort would be a good start. Leave room for this when you place your stone traps - killing the monkeys first won't allow live monkeys to be caged. (You still get the meat & etc. from those corpses, just not breeding stock.)
As your dwarfs create weapons, or you trade for them, or (later) as you gather those of your fallen enemies, weapon traps will become attractive. There is no hard rule or formula for all this - be creative.
 Complex traps
Between levers, pressure plates, water and magma, much fun can be had. But this article won't deal with any specifics. (See Trap design for those.) We will say - plan ahead. Think about what you might want to do, and leave ample room for it, in all 3 dimensions.
To start, you will probably have few if any full-time military standing guard over your dwarfs - there is just too much to do at first, and serious threats are (hopefully) several seasons away. If you are going to make weapons and armor, have stockpiles near where your draftees work and rest, perhaps near an entrance/exit, but not so close that it might get over-run before your dwarfs can equip. Eventually you might have perhaps a quarter (or more or less) of your dwarfs as full-time military, and they'll need a barracks where they will sleep and practice, archery ranges if that's their weapon of choice, and quick, safe routes to their battle stations or patrol areas. When to begin a full-time military presence is personal choice and influenced by your game situation, but plan on eventually having them live and practice near where they will be fighting as much as possible. See Military design for a more complete discussion on planning and deploying military and militia.
 Different philosophies
There are many, many ways to play DF. Some players play hard and tight, and some fast and loose. Some take no risks and protect every last dwarf and cat, and others happily leave a highway of dwarf and animal bodies for the next immigration wave to follow. Some live for the slaughter of ASCII goblins, and others for the mega-project. No one "defense" will serve everyone's tastes. Don't forget that you can reclaim lost forts, so don't feel all is lost if your fort falls.
 Losing is fun
There is no final "win" in Dwarf Fortress, no end point or Easter egg that says "Congratulations!" - it just keeps going, until, inevitably and unavoidably, you will lose. That's part of the game. So it's all about how you play until then, and finding your type of fun in that process.
 "Fun" vs. security
It's not hard to create an acre of traps that, realistically, simply no threats can survive. If you want to pursue a megaproject (that is not a defensive trap) in peace and security, this may be a good plan. However, if you look forward to the military end of things, then you want to allow, or at least be able to invite combat at your choosing. Inexperienced players are recommended to use the hall-of-traps entryway, at least to start. Many experienced players challenge themselves by limiting their use of simple traps, or other voluntary handicaps. It's all about what you think is fun. To prevent ambushes and sieges altogether,
[INVADERS:NO] can be set in d_init.txt.
The fewer surface jobs your dwarves have to run, the less exposed they will be to potential harm. There are a number of ways to reduce surface exposure while keeping your fortress well-stocked:
- Hunting requires chasing animals across the map, almost invariably far from home. For maximum safety, you're better off disabling your hunters.
- Woodcutting requires trees to chop down, and trees grow on the surface. Once you discover the caverns, you can build tree farms underground to solve your wood needs.
- Grazing livestock require grassy pastures. Once you discover caverns, you can likewise establish pastures underground, on well-grown underground floor.
- Giving water to the wounded requires fresh water. Internalize your water supply with a well.
- Caravans need to get in while ambushers and siegers need to stay out. Using the fact that wagons need a three-tile-wide path to your trade depot, you can place strategic constructions around the map to force them to always take one easily-defended route.
 See also
|Military and Fortress Defense|
|Guides||Military quickstart • Interface walkthrough • Defense guide • F.A.Q.|
|Soldier Management||Military overview • Soldiers • Scheduling and alerts • Squads • Equipment • Marksdwarf training|
|Design Tips||Military design • Security design • Trap design|
|Invaders||Ambush • Megabeast • Siege • Thief|