Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imps pick up incorrect tasks (even when assigned) #777

Open
Loobinex opened this Issue Jul 31, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@Loobinex
Copy link

Loobinex commented Jul 31, 2017

On Keeperklan and the GOG forums many users have been complaining they can no longer keep their treasure rooms filled. Looking into it, the problem seems to be caused by imps going rogue. I'm aware that by design the imp priorities have changed and that imps won't mine gems indefinitely, but they also don't behave according to the new design.

On Keeperklan a user has made a nice test map, attached here: testmap777.zip.

Compare this map in the latest or any recent (0.4.6) build, to the original game or the 0.4.4 release. Start the map, and select the gems. Notice that in 0.4.4 the imps will mine the gems and keep mining. In 0.4.6 they will start to fortify walls and pick up many tasks. I would say this is still acceptable, and could be by design.
However, when in 0.4.6 you'll assign imps to the gems and highlight gold for mining there's always an imps that will refuse to do more than one or two runs of the gems before he goes back to not only mining gold, but also fortifying walls. The result is that players will run out of gold even on maps with gems where they shouldn't.

Important to note is that the faulty behavior seems to be more closely related to fortifying walls than mining gems. Without manually assigning imps the walls are fortified before even the unclaimed path is claimed.

The desired behavior should be that:

  • Imps when not assigned should mine gems when path is claimed and earth/gold is mined and stay on the gems for a few (5-15?) gem runs before picking up another task and going back to the gems later.
  • Imps that are assigned to gems should stay on gems (near?) indefinitely or until reassigned.
  • Imps should only fortify walls when assigned to this task or when everything is dug out, everything is claimed and everything is picked up.
  • When computer players do not function with these rules because they cannot build rooms, they should assign imps to the needed task.
@Loobinex

This comment has been minimized.

Copy link
Author

Loobinex commented Aug 1, 2017

I found the bug in the code here.

In spdigger_stack.c, look at this:
if (((cctrl->digger.task_repeats % 10) == 0) && (dungeon->digger_stack_length > 1))

digger.task_repeats is always 0 here, therefore this condition is always true, so imps will always pick up a new task each time they bring gems to the treasure room. What is supposed to happen is that imps mine gems 10 times in a row before looking for a new job.

An added improvement on top of this bugfix would be to allow imps to continue mining gems for longer if there are only low-priority tasks like fortify remaining, but just the fix already makes a big difference in how much gems are mined.

@spartahawk

This comment has been minimized.

Copy link

spartahawk commented Jan 18, 2018

Loobinex, can you duplicate this issue to your forked unofficial version and assign that to me? Seems like this one is something I could do. I'm impressed you tracked that code down. Are you sure you don't want to learn programming? ;)

@Loobinex

This comment has been minimized.

Copy link
Author

Loobinex commented Jan 18, 2018

I already fixed it in that fork. See 69d0f0f.

But feel free to critique my implementation. Perfectly possible there's stuff wrong with my code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.