Dwarf Fortress Bug Tracker - Dwarf Fortress
View Issue Details
0000797Dwarf FortressPathfindingpublic2010-04-08 08:352020-05-18 20:21
king doom 
0000797: Animals/pets repeatedly try to find path through pet-locked/"tightly closed" doors, causing lag
Doors can be set to stop pets and animals moving through them, but they do not stop pathfinding calculations from planning routes through them, leading to swarms of animals headbutting doors, choking your PC to death as they try again and again to move down the same route over and over, despite the fact there is a door in the way.
Build a corridor with an exit where an animal might want to go. A cat and the surface works well, as the cat will try and wipe out every vermin in existence on the surface. Make a door, place the door in the corridor, mark it tightly closed, watch the game slowly choke to death and die.
door, hatch, leftover from 40d, pathfinding, pet
has duplicate 0007846resolved Dwarfu Dogs behind door set to passable but not pet passable cause fps drop 
has duplicate 0007915resolved Footkerchief Animals trying to path out of the cavern bring FPS to a crawl when they reach a non pet passable door 
has duplicate 0007921resolved Footkerchief Animals stuck behind pet impassable doors cause fps drop 
has duplicate 0008890resolved Dwarfu Lock 4 puppys in a room and the FPS goes down substantially 
has duplicate 0009390resolved lethosor Fort slows from a stable 100 fps down to a permanent 5 without anything unusual happening 
has duplicate 0009689resolved Knight Otu Game at Unplayable Speed 
has duplicate 0010602resolved Loci FPS death after immigrations 
has duplicate 0010888resolved Loci Severe lag due to bugbat pathing through pet-impassable door 
related to 0001340new  Walling off HFS kills FPS 
related to 0002945new  Animal trainer selects animal behind pet-impassable door, waits forever for animal to arrive at kennel 
related to 0005555new  War dogs ignore "tightly closed" and forbidden doors (walk through them, then canĀ“t find back). 
related to 0006446acknowledged Footkerchief Birds claim nest boxes behind tightly closed doors 
related to 0008213resolved Toady One Restrained animals repeatedly try to path to meeting areas, then forced prone 
Issue History
2010-04-08 08:35king doomNew Issue
2010-04-08 10:57king doomTag Attached: pathfinding
2010-04-08 10:57king doomTag Attached: door
2010-04-08 10:57king doomTag Attached: pet
2010-04-08 11:29SquirrelloidNote Added: 0002104
2010-07-22 10:31MaDeR LevapNote Added: 0010830
2010-07-22 10:41OzoneGrifNote Added: 0010837
2010-07-22 10:45smjjamesNote Added: 0010839
2010-07-22 11:10FootkerchiefSummaryDoorways marked tightly closed do not count as barriers with regard to animal pathfinding. => Animals/pets repeatedly try to path through "tightly closed" doors, causing lag
2010-07-22 11:10FootkerchiefSticky IssueNo => Yes
2010-07-22 21:11eatatreeNote Added: 0010856
2010-07-22 21:11eatatreeIssue Monitored: eatatree
2010-07-26 08:27KanddakTag Attached: leftover from 40d
2010-07-26 11:49KanddakIssue Monitored: Kanddak
2010-11-03 14:06jwest23Issue Monitored: jwest23
2010-11-18 18:20FootkerchiefRelationship addedrelated to 0001340
2010-11-18 18:20FootkerchiefRelationship addedrelated to 0002945
2010-12-14 08:30FootkerchiefSummaryAnimals/pets repeatedly try to path through "tightly closed" doors, causing lag => Animals/pets repeatedly try to find path through pet-locked/"tightly closed" doors, causing lag
2010-12-14 14:24hyperactiveChipmunkIssue Monitored: hyperactiveChipmunk
2010-12-14 20:16RhenayaIssue Monitored: Rhenaya
2011-03-27 01:52LavNote Added: 0016657
2011-11-13 05:17TBeholderNote Added: 0018977
2014-02-01 10:29FootkerchiefRelationship addedrelated to 0005555
2014-02-23 13:08FootkerchiefRelationship addedrelated to 0006446
2014-02-25 15:57eidakoNote Added: 0024566
2014-02-25 15:57eidakoTag Attached: hatch
2014-02-27 11:14FootkerchiefAssigned To => Footkerchief
2014-02-27 11:14FootkerchiefStatusnew => acknowledged
2014-08-04 20:30DwarfuRelationship addedhas duplicate 0007846
2014-08-08 14:12FootkerchiefStatusacknowledged => confirmed
2014-08-08 14:12FootkerchiefRelationship addedhas duplicate 0007915
2014-08-08 14:49MopsyIssue Monitored: Mopsy
2014-08-08 14:58smjjamesNote Added: 0028618
2014-08-08 21:304maskwolfIssue Monitored: 4maskwolf
2014-08-09 05:37FootkerchiefRelationship addedhas duplicate 0007921
2014-08-14 04:09StebIssue Monitored: Steb
2014-09-01 14:12FootkerchiefRelationship addedrelated to 0008213
2014-09-13 16:44Dame de la LicorneIssue Monitored: Dame de la Licorne
2014-12-04 11:08smjjamesNote Added: 0031257
2015-04-01 00:07DwarfuRelationship addedhas duplicate 0008890
2015-05-24 06:44WittyNote Added: 0032715
2015-12-20 20:27lethosorRelationship addedhas duplicate 0009390
2016-01-04 16:36RobsoieNote Added: 0034316
2016-04-13 13:08Knight OtuRelationship addedhas duplicate 0009689
2016-04-13 13:08Knight OtuNote Added: 0035009
2016-11-03 16:33FantasticDorfNote Added: 0036029
2016-11-07 07:26FantasticDorfNote Edited: 0036029bug_revision_view_page.php?bugnote_id=0036029#r14522
2017-01-27 07:25FantasticDorfNote Deleted: 0036029
2017-01-27 07:51FantasticDorfNote Added: 0036226
2017-01-27 10:40FantasticDorfNote Edited: 0036226bug_revision_view_page.php?bugnote_id=0036226#r14586
2017-01-27 10:41FantasticDorfNote Edited: 0036226bug_revision_view_page.php?bugnote_id=0036226#r14587
2017-06-08 19:19HuntthetrollIssue Monitored: Huntthetroll
2017-10-06 13:30a52Note Added: 0036766
2017-10-19 05:01FantasticDorfNote Deleted: 0036226
2018-03-06 09:31LociRelationship addedhas duplicate 0010602
2018-03-06 09:33LociNote Added: 0037861
2018-09-19 13:18LociRelationship addedhas duplicate 0010888
2018-09-19 13:19LociNote Added: 0038817
2020-02-24 13:55clanlIssue Monitored: clanl
2020-03-03 16:16AlatunNote Added: 0040308
2020-03-03 16:17AlatunNote Edited: 0040308bug_revision_view_page.php?bugnote_id=0040308#r16389
2020-05-09 16:48bugsubmitter20001Note Added: 0040534
2020-05-18 20:21evilmasteryodaNote Added: 0040557
2020-10-06 05:22psychowicoIssue Monitored: psychowico

2010-04-08 11:29   
This was true in .40d as well. Animals pathfind as dwarves and get surprised when they can't go through tightly closed doors, and just sit there and try to repath repeatedly. Since pathing thinks they can go through the tightly closed door, they keep trying. Processor issue: the animal is continuously calling the pathfinding code.

Quick test: get an animal trapped in a room with 2 doors. Lock one and tightly close the other. Watch the animal move to the tightly closed door and sit there with a '?' flashing. Switch which door is locked and which is tightly closed. Animal moves to the new tightly closed door.
MaDeR Levap   
2010-07-22 10:31   
I suppose this would require separate map of pathable tiles in memory, at least two versions (for animals and for everything else). Funny thought: how would be memory req for having separate path tile map for each living entity? This could allow things like forgetting about part of fortress for this dorf that got hit in head recently. But I do not see this being implemented any time soon.
2010-07-22 10:41   
For gameplay purposes,
tightly closed doors should prevent animals from passing through...

It's pretty much useless right now because your animal will pass along with a dwarf, then get stuck in the room and can't go out until another dwarf comes.
2010-07-22 10:45   
Its a very old issue, I don't know how far back it goes, but certainly before 40D.
2010-07-22 21:11   
This happens to me as of 31.10, and also happened in 40d.
2011-03-27 01:52   
Not sure about Dwarf Fortress, but at home my cat is *constantly* trying to path through closed doors, meowing in dismay when he cannot. :-)

Besides, this animal behavior is actually pretty useful in many situations.
2011-11-13 05:17   
The main performance problem IMHO is that everything tries to path into everywhere. If critters at least occasionally preferred random wandering (a job with a set probabilty to pop up at each new job "?") within their sight, they would still fail, but won't have to recalculate the way around half of the map when they fail.
This doesn't mean they won't occasionaly try to pass closed doors even in wandering mode.

Having dragons beeline to your doors may have some sense (they have heard about you and are overconfident), but for mindless critters like scorpions there aren't great reasons for map-wide clairvoyance.

As to learning critters, a simple compromise is to mark food/danger/potential consorts met during wandering in a set (per critter) number of (decaying/renewable at a set rate) waypoints would need much less memory than a full mental map (even ONE, let alone per critter).
2014-02-25 15:57   
Also applies to hatches. I had a hostile giant olm trapped under one that was forbidden and tightly closed. The olm came rushing at it when it was made non-forbidden, but just sat under it and alternated between prone and standing until I set it to allow pets. A cool emergent behavior IMO (nasty creature lurking under a hatch, waiting for a dwarf to come along and open it), but ultimately a bug.
2014-08-08 14:58   
This one might get some attention now since it's a contributor to lag in worldgen forts and mountainhomes.

The pastures help by keeping them from pathing elsewhere, but the bug is still there.
2014-12-04 11:08   
This can also be reproduced in any worldgen fort as the loads of cats rush to one place and get stopped by a door, causing noticeable lag.
2015-05-24 06:44   
I can confirm this for .40.24. Some crundle was trying to path through a door set to be tightly closed - and my usual 100 FPS dropped down to 15. The FPS made a complete recovery once I disabled the setting on that door, and the crundles flooded my fort.
2016-01-04 16:36   
Still happening in 42.04 , saved game :
http://dffd.bay12games.com/file.php?id=11607 [^]

On save load, you should be on the 1st cavern level
There's a barrack with a squad of soldiers training there, and a double door leading directly to the cavern.
Both doors have disabled pet passage, so only non-pets can move through.

In front of those doors there is a group of "naked mole dogs".

Unpause the game you will quickly notice that game performance is so bad it's unplayable.
Press q , move the cursor over the double doors and enable pet passage.

Suddenly performance is back at relatively playable, while the naked mole dogs enter the barracks
Knight Otu   
2016-04-13 13:08   
lightman posted a 0.42.06 save in 0009689.
2017-10-06 13:30   
A single cave crocodile lowered my FPS from about 40 to only 9 because she was trying to get through a tightly closed door. Even killing all other creatures and deleting all items with DFHack didn't make a significant difference to FPS as long as she was still alive.

http://dffd.bay12games.com/file.php?id=13122 [^]
2018-03-06 09:33   
v0.44.05: Magnani posted a save in 0010602:

http://dffd.bay12games.com/file.php?id=13540 [^]
2018-09-19 13:19   
v0.44.12: aids_spreader posted a save in 0010888:

http://dffd.bay12games.com/file.php?id=13998 [^]
2020-03-03 16:16   
(edited on: 2020-03-03 16:17)
v0.47.03: still has this issue. Ran into this problem several times so far. Because I was not aware of this bug, I thought my save was corrupted and did a restart. Now it happened again: a cave swallow from 1st cavern wanted to go through a door that did now allow pets (to prevent cats go to cavern and kill the cave spiders). Game dropped to 1 FPS on my machine. After making the door pet passable, FPS went back to normal.

2020-05-09 16:48   
v0.47.04: still has this issue. Ran into this problem each time I build an enclosed atom smasher. Vermin will begin to spawn in the smash area. Cat will try to path through the door.
2020-05-18 20:21   
v0.47.04: Confirmed still a issue. Each time my cygnets hatch from my Giant Swan eggs I go down 20-30fps easily. Each time cave crocodiles or crundles hatch I go to nearly 0FPS. (this is because hatched eggs dont stay in the Pen/pasture. I have a pet locked - impassible door and until I unlock it to become pet passable the FPS tanks.