dkfans / keeperfx

Open source remake and Fan Expansion of Dungeon Keeper.
https://keeperfx.net/
GNU General Public License v2.0
777 stars 77 forks source link

Imp pathfinding #399

Open mefistotelis opened 9 years ago

mefistotelis commented 9 years ago

Originally reported on Google Code with ID 399

What steps will reproduce the problem?
(please describe a single problem, providing as much detail as possible)
1.see attached savegame. Load and find gems
2. observe strange imp behaviour taking a long winding route to a treasure room
even though one is right next to them
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
(you can see your KeeperFX version by viewing keeperfx.log in notepad)

0.45.1422

Please provide any additional information below.
(describe one bug per report, but with all you can gather about it)

Reported by dayokay65 on 2014-10-17 10:27:59


mefistotelis commented 9 years ago
re-checked with nightly build 1503, and it's still the same strange behaviour.

Reported by dayokay65 on 2014-12-08 14:27:25

mefistotelis commented 9 years ago
I find imp behaviour quite irritating now. They seem to have become less 'clever'? For
example, if they dig out a room, they nearly always miss a few squares when 'claiming',
so I have to pick one up and drop him next to it/them.

Reported by dayokay65 on 2015-01-25 19:31:10

mefistotelis commented 9 years ago
It is important to know where are they going when stopping the dig task.

Could you check what is the new task they've taken?

Reported by mefistotelis on 2015-01-25 22:31:28

mefistotelis commented 9 years ago
It is about claiming, not digging.

My experience is that the will sometimes continue to claim tiles in another room if
those tiles are closer (if you ignore the walls in between).

Reported by Loobinex on 2015-01-25 23:34:40

mefistotelis commented 9 years ago
I see.

When Imp finishes a task, he does the following:
1. try to repeat the last task on surrounding slabs
2. try to get different task from imp tasks queue
3. if no task - go to do nothing state, walking around and toking

The tasks queue I mentioned is updated every 128 game turns; it contains all tasks
for imps in given players dungeon - unless there are too many tasks of specific kind,
in which case some are ignored. The queue size is 64 tasks.

So, when imp claims a tile which has no unclaimed sibling, and there are other imps
claiming that part too, it is possible that he will be assigned a task somewhere else.
But after queue is updated, he should get back for the remaining part.

I think the mechanism made there is quite good and I'm not sure if it needs any update.

Or maybe there is a problem where the step 1 is not used even though it should be?

Reported by mefistotelis on 2015-02-03 23:28:08

mefistotelis commented 9 years ago
The issue can occur with only a single imp.

See attached image. When an Imp claims tile A, as a player you want the imp to continue
claiming at tile B. That makes sense as it is the closest tile.
However, the imp will think that tile C is closer(ignoring the wall it is) and continue
claiming at tile C.

As a player that means you cannot start building your room yet.

How that relates to the process you describe I do not know. I do not know how the tasks
are prioritized, but I would assume that if there are 2 similar tasks (e.g. claim dirt),
the closest gets prioritized by the imp.
I think it is similar to issue #187, which in behavior differs from the original game.

Reported by Loobinex on 2015-02-04 00:49:36