View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0013106 | Dwarf Fortress | Creatures | public | 2025-02-20 05:42 | 2025-05-27 21:09 |
Reporter | amade | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | sometimes |
Status | new | Resolution | open | ||
Platform | PC (Steam) | OS | Win 10 | OS Version | 19045.5371 |
Product Version | 51.05 | ||||
Summary | 0013106: Wildlife creatures in a pack changes followed unit to newborn livestock | ||||
Description | Using DFhack I've observed that the reason why wildlife will frequently get stuck unable to leave the map is because the unit they're following is not a member of their pack, Instead, one of the fortress' livestock, usually one that was recently born during the pack's stay on the map, has become the pack leader for at least one of the wildlife creatures. Because pack members follow one another in a chain, this leads to having the whole pack stuck on the map because the creature at the top of the chain is trying to follow a fortress creature. So far I have not been able to directly observe exactly when and why creatures change the unit they're following. In normal behavior, once the animal's leave_countdown runs out and it's not following any unit (i.e. it's at the top of the pack's chain), it will head for the map edge to leave. So after the leader at the top of the chain leaves or dies, the one following it will no longer have a unit to follow and proceed to leave the map, and the rest of the pack will follow suit one by one. Note: Pack leaders that are caught in cage traps will also strand the whole pack on the map until it is released or killed. | ||||
Steps To Reproduce | 1. Keep some livestock and breed them (egg-layers are easiest for high frequency and large numbers) 2. Wait for wild animals to appear in packs (e.g. reindeer) and note which units are following which in 'unit.following' 3. Get some new livestock to be born while wild animal is still on the map (either requires some luck in timing or DFhackery) 4. Observe any changes to 'unit.following' in any creatures in the pack still remaining on the map | ||||
Tags | wildlife | ||||
|
I believe I now understand why this happens. When wildlife spawns in a pack, the first animal (the leader) will usually spawn first and follows no other creature. The other animals in the pack will spawn to follow the creature with an ID that precedes it, e.g. a creature with the ID 48013 would be set to follow 48012. However, the animals will sometimes spawn out of order, e.g. 48013 enters at the edge of the map before 48012 does. Lacking a valid unit to follow, the game ends up assigning a different unit to follow; which seems to be the leader's ID offset by -1 (so, if leader was 48012, the followed unit becomes 48011). This ID usually belongs to the most recent newborn livestock, or a different wildlife creature from a different group that had spawned much earlier. This behavior occurs more frequently with pack animals in caverns because the confined spaces may prevent animals from spawning in and move away from the edge properly. Btw, follow links are not deleted when the unit they're following gets captured in a cage; so they'll end up trying to follow a captured pack member into the player's fortress. I do not think this counts as intended behavior, especially for benign/shy creatures. Possible fixes for suggestion: 1. Ensure that wildlife animals in a pack cannot spawn out of order. 2. If the game cannot assign a valid ID to follow, it should default to the leader's ID, else it should set unit.following to nil. 3. If the followed unit gets caught in a cage, set unit.following to nil. |