dwarfcorp
dwarfcorp copied to clipboard
AI: "Air humping" - Dwarves getting stuck in pathing loops
https://steamcommunity.com/app/252390/discussions/1/1692669912390094558/
Secretaryland_480_131813429616057161.zip Secretaryland.zip
See Steam thread above. Looks like they're experiencing more and more pathing loops from crafters, the farther they play into the game. I've requested they send us a save. Not exactly sure what they're experiencing, but I've observed a pattern of bug I've been trying to suss out that sounds familiar. Not 100% on the repro, but this is usually how it occurs:
- (I usually use cooking, but I'm guessing any repeatable craft works) Set a repeatable task, like 10x cooking meals.
- After the Crafter is done, set another 10x crafting meals.
- Observe the Crafter eventually become stuck on a few voxels jumping back and forth (the "humping" I think the player is referencing)
- Eventually they'll become unstuck form this behavior, but then eventually caught in a new loop, pathing back and forth between the crafting station and another location, usually a stockpile. The task will still be to cook, but the Crafter seems unable to collect the required resources for some reason. Canceling the task resolves the bug.
1299186a
I believe I have fixed the root cause of this issue by accident while developing palisades. Will test this save to see if I can reproduce it.
okay, I believe I have fixed this, and that save does not currently have the problem.
Forensics:
- When crafting multiple items, and "Any" is selected as an ingredient, the dwarf assigns random goods from your stockpile to be the source of the item.
- If the crafting gets interrupted, it gets put back on the task queue with those selected ingredients.
- If those ingredients are no longer present for whatever reason (maybe another dwarf ate them), the dwarf believes the resources are available, but they are in fact unavailable.
- When the dwarf arrives at the crafting station, it believes that it has the resources already, but when it looks in its backpack, it finds the resources to be missing.
I fixed this by making the crafting task clean up after itself on failure, and made the dwarf check the contents of its backpack to be extra sure that it has the resources before attempting to craft.
Still seeing this behavior:
Observe the Crafter eventually become stuck on a few voxels jumping back and forth (the "humping" I think the player is referencing)
in 233bc5a8
It's not exclusive to crafters.
Here's an example: Important Hills_386_131822986041129880.zip Important Hills.zip
That example doesn't seem to have the problem you're describing...
although it does have a ton of other problems mainly with pathfinding, which is pretty baffling
Some possible issues I just fixed from this save:
-
If plans were taking a very long time, it was possible dwarfs could abandon them before the planning was finished. The next time the dwarf would try to get a path from the planner, it would be the old path. Fixed this by assigning an ID to each path plan.
-
While "taking a walk" dwarfs were sometimes jumping up and down on the same spot over and over. Prevented this.
-
Radius of path plans was just not set correctly.
-
The greedy fallback is awful and almost never works. I removed this completely and now dwarves have reverted back to their old behavior of standing still while waiting for a plan.
Also fixed this issue
- Upon loading from a file, the dwarf's planners weren't getting set up correctly. As a result, dwarfs were getting their paths mixed up with other dwarfs. This generally wrecked mayhem.
While "taking a walk" dwarfs were sometimes jumping up and down on the same spot over and over. Prevented this.
Thems the humps, so it's fixed.