|This article is about an older version of DF.|
Factions govern how creatures will react upon each other's presence. The world is full of dangers for your unfortunate dwarves and it seems that nearly everything is trying to kill them; fortunately, said dangers are also hostile to each other most of the time. Confrontations between such opposed factions happen in both fortress and adventure mode; the wise player will see to it that they weaken each other instead of ganging up against one's fort or adventurer.
 Faction relative hostility
The table below shows the behaviour of different factions when confronted:
1Advanced civilizations are subject to the mechanisms of diplomacy and may routinely go at war and conclude peace treaties depending on worldgen and according to each civ's ethics. On the one hand, war against elves or humans is not that uncommon; on the other hand, goblins will almost always be hostile toward everyone else.
2Cave civilizations are always friendly toward adventurers and they can be either hostile or friendly toward your dwarves. They often become friendly when confronted with a megabeast. Note that this behaviour does not apply to most animal people, who are simply treated as wildlife.
3Werebeasts will switch factions from whatever civilization they belong to under their normal form to a special, species-dependent faction on full moon. Different species of werebeasts will be hostile to each other.
4A demon often takes control of a goblin civilization, and sometimes becomes the ruler of a human civilization by posing as their god. Other demons are typically hostile.
Due to their
[BABYSNATCHER] tag, goblins will be almost always at war with other civilizations; megabeasts and semi-megabeasts are neutral toward each other, but will try to kill everything else they can find - whether it be in worldgen, adventure mode or fortress mode. Undead creatures will attack every creature that isn't undead (or a necromancer) due to their
[OPPOSED_TO_LIFE] tag. Kobolds are unable to speak besides in utterances and are thus at war with everyone else - note that if you start as a kobold in Adventure Mode when they are available, you will be unable to speak to anyone and other kobolds will attack you on sight because they won't be able to talk to you either.
It seems that undead just ignore necromancers or fellow undead, but the necros themselves will lash out at each other if they belong on different civilizations/towers. This is important in adventure mode - should you learn the secrets of life and death, all zombies will become neutral to you, letting you seize the opportunity to make short work of their squishy and unarmed masters. In adventure mode, undead you raise will follow you as if they were companions; however, they will all turn neutral if you purposely attack one of them.
There are exceptions to the above table: most notably, foreign creatures occupying a noble position in a civ for whatever reason (e.g. demons that have impersonated a god to take control of human civs, or necromancer kings) will behave the same way any other civ member would toward your dwarves or adventurer. Hence the ludicrous possibilities for a demon to visit your fortress as a diplomat (or join you in your adventures) or a friendly necromancer inadvertently wreaking havoc on your fortress by raising corpses whenever it can. Berserk dwarves are hostile to everyone. Vampire dwarves (and humans) will also be neutral toward undead even when not confronted. You can take advantage of this, ordering your vampires to kill necros when facing a siege; a vampire can and will path toward a necro unhindered and usually beat him to death. You can also order vampires to kill zombies one by one as they won't react unless attacked.
 Loyalty cascade
Loyalty cascades are the result of entity members attacking each other. The conflict will escalate into a full civil war (hence Toady One referring to it as the "civil war bug") and won't resolve until one side of the conflict is wiped out. Loyalty cascades can be triggered in both fortress and adventure mode.
If you order your military to kill merchants from your own civilization, a bizarre result of the way loyalty is handled makes the members of your military who attacked the traders become enemies of your civilization, but members of your fort's government (dwarves of this faction will henceforth be referred to as separatists). As enemies, they attack your other dwarves (citizens), but as members of the fort, they still follow orders. Allowing citizen militia dwarves to attack the separatists will give them opposite loyalties of the separatists, (i.e. loyal to civ, not to fort), or loyalists, who do not follow orders. And then, if a separatist or loyalist kill a citizen, they become enemies of the civ and fort, making them Renegades, who are essentially complete enemies of the citizens.
If you use cage traps against goblin sieges, you are likely to capture a few mounts from various species. You may assign them to your animal trainers and attempt to tame them, thus gaining a few facts about each specific species; but under no circumstances should you ever release them from their cages, as they are always considered enemies to your civilization and will wreak havoc as soon as they are free. Not only that, but they will trigger a similar loyalty cascade as soon as they attack your citizens, leading your fort to its demise through a never-ending civil war - as well as some copious jabberer-chomping. The best course of action is to keep re-training the mounts in their cages over and over again, thus facilitating future taming of their wild counterparts.
If one of your dwarves turns into a werebeast and you send your military to kill them while shapeshifted, failing to kill (and allowing the dwarf to revert to normal) may cause a loyalty cascade.
 How to deal with loyalty cascades
To prevent the cascade from spreading, order the original separatists away from the fortress and let them fight amongst themselves. If the results are renegades, it is okay to allow other dwarves to kill them (by stationing them nearby). If the results are separatists/loyalists, then you will need to separate them somehow.
Dwarves from these different "factions" will cancel jobs if they ever come across one another, each running away. This will likely lead to a massive number of job interruption announcements reading Urist McDwarf cancels Eat: Interrupted by Farmer
NOTE: Tame Animals are loyal to civ and fort indefinitely due to a bug, so they can be used to kill off separatists/loyalists without repercussions.