PDA

View Full Version : Annoying imp priority



jomalin
June 24th, 2014, 03:08
Imps are sometimes annoying with their priority.

1. If i drop an imp in an owned slab just close to enemy slabs to claim them, they start reinforce my walls before!
2. If i drop an imp to take an enemy spell book and also all the surrounding slabs are all claimed by me, he will start reinforcing walls instead of taking fast the spell book.

Mefisto, can you change this?

I attach a savegame with the second case. Try to drop the imp to get the spell book...

mefistotelis
June 24th, 2014, 11:30
To change order in which imps selects jobs on a drop site, we'd have to make a wider discussion.

YourMaster
June 24th, 2014, 11:49
The order doesn't seem to be like it was in original DK, it changed in FX a little while ago, and it was an issue already reported: https://code.google.com/p/keeperfx/issues/detail?id=289
I also mentioned it in this issue: https://code.google.com/p/keeperfx/issues/detail?id=229

In earlier KeeperFX builds I also don't remember this issue, and it is very noticable, as imps now always seem to prioritize enforcing walls when being dropped, over all other tasks.

jomalin
June 24th, 2014, 13:16
To change order in which imps selects jobs on a drop site, we'd have to make a wider discussion.

I agree, but imps never reinforced walls before claiming enemy slabs before. That's something new i don't know in which KeeperFX it changed (i spent some months without playing).
Can you change this at least to have the usual behaviour?
This is very important because when you enter in a enemy terrain, you cannot start claiming slabs fastly because they start to reinforce walls, it is very frustating.

mefistotelis
June 24th, 2014, 15:57
The function which selects imp job on drop is here:
https://code.google.com/p/keeperfx/source/browse/trunk/keeperfx/src/creature_states_spdig.c#478

What is the order you'd like to propose?

jomalin
June 24th, 2014, 18:26
The function which selects imp job on drop is here:
https://code.google.com/p/keeperfx/source/browse/trunk/keeperfx/src/creature_states_spdig.c#478

What is the order you'd like to propose?

Sorry mefistotelis but i don't know how that function works (existent structures, states, etc).

What SDLstJob_ConvImprDungeon mean?

I see it is a value from an enum:


enum SpecialLastJobKinds {
SDLstJob_None = 0,
SDLstJob_DigOrMine,
SDLstJob_ConvImprDungeon,
SDLstJob_ReinforceWall3,
SDLstJob_UseTraining4,
SDLstJob_Unkn5,
SDLstJob_Unkn6,
SDLstJob_Unkn7,
SDLstJob_Unkn8,
SDLstJob_ReinforceWall9,
};

- Wich is the state that make the imp to claim slabs?
- What's the difference between SDLstJob_ReinforceWall9 and SDLstJob_ReinforceWall3?
- In the function you told me:


long check_out_available_spdigger_drop_tasks(struct Thing *spdigtng)
{
struct CreatureControl *cctrl;
cctrl = creature_control_get_from_thing(spdigtng);

if ( check_out_unclaimed_unconscious_bodies(spdigtng, 768) )
{
return 1;
}
if ( check_out_unclaimed_dead_bodies(spdigtng, 768) )
{
return 1;
}
if ( check_out_unclaimed_spells(spdigtng, 768) )
{
return 1;
}
if ( check_out_unclaimed_traps(spdigtng, 768) )
{
return 1;
}
if ( check_out_empty_traps(spdigtng, 768) )
{
return 1;
}
if ( check_out_undug_drop_place(spdigtng) )
{
cctrl->digger.last_did_job = SDLstJob_DigOrMine;
return 1;
}
if ( check_out_unconverted_drop_place(spdigtng) )
{
cctrl->digger.last_did_job = SDLstJob_ConvImprDungeon;
return 1;
}
if ( check_out_unprettied_drop_place(spdigtng) )
{
cctrl->digger.last_did_job = SDLstJob_ConvImprDungeon;
return 1;
}
if ( check_out_unclaimed_gold(spdigtng, 768) )
{
return 1;
}
if ( check_out_unreinforced_drop_place(spdigtng) )
{
cctrl->digger.last_did_job = SDLstJob_ReinforceWall9;
return 1;
}
if ( check_out_crates_to_arm_trap_in_room(spdigtng) )
{
return 1;
}
cctrl->digger.last_did_job = SDLstJob_None;
return 0;
}

why the first IFs doesn't make changes over the CreatureControl structure and they only return 1?

Sorry, many questions but i haven't programmed KeeperFX by myself...

mefistotelis
June 24th, 2014, 19:17
Sorry mefistotelis but i don't know how that function works (existent structures, states, etc).

Ok, I think you're trying to get too deep. Just look at function names inside "if ()" commands.

They are making the order:


( check_out_unclaimed_unconscious_bodies(spdigtng, 768) )
( check_out_unclaimed_dead_bodies(spdigtng, 768) )
( check_out_unclaimed_spells(spdigtng, 768) )
( check_out_unclaimed_traps(spdigtng, 768) )
( check_out_empty_traps(spdigtng, 768) )
( check_out_undug_drop_place(spdigtng) )
( check_out_unconverted_drop_place(spdigtng) )
( check_out_unprettied_drop_place(spdigtng) )
( check_out_unclaimed_gold(spdigtng, 768) )
( check_out_unreinforced_drop_place(spdigtng) )
( check_out_crates_to_arm_trap_in_room(spdigtng) )



why the first IFs doesn't make changes over the CreatureControl structure and they only return 1?
This isn't important for the order; anyway "return 1" means "Job has been assigned" and it ends the function in that point - further "check_*" functions are not executed. Changes to CreatureControl are only made for jobs which a digger "assigns to itself" (so after it finishes one work, it will try to do something similar - ie. find another dead body, or claim another tile).

Tha value "768" is a range of checking - it is equal to one slab range (3 subtiles * 256).

jomalin
June 24th, 2014, 22:11
Thanks for your explanation.
So, why imps are reinforcing walls before claiming enemy slabs? Because I see that "if" in the 10th position:


if ( check_out_unreinforced_drop_place(spdigtng) )
{
cctrl->digger.last_did_job = SDLstJob_ReinforceWall9;
return 1;
}

YourMaster
June 24th, 2014, 23:55
I agree, the order listed there is fine, but when dropped this is not the order they follow. They always take the job nearest it seems, where in the past they also took a close job, but seemed to understand that if you drop them in an hallway right next to fallen prisoners, they had to get the prisoners if a few tiles away, not fortify the wall right next to them.

Ecarus
June 25th, 2014, 02:37
As i dont understand nothing of this, i can only say my opinion, when you drop a imp, the priority would be:

1.- Dig
2.- Claim
3.- Reinforce

And the other, i dont understand, what it is? Jobs that imps does when they are working as usually?

mefistotelis
June 25th, 2014, 07:52
I agree, the order listed there is fine, but when dropped this is not the order they follow.

Ok, in that case I will check the saved game from first post to try to find out what's really wrong.

jomalin
June 25th, 2014, 13:39
Ok, in that case I will check the saved game from first post to try to find out what's really wrong.

My savegame was for the second case i told: the imp doesn't take the spell book. But i found why: it is because i have a closed door blocking the way to the library, that is one of the cases i just tell in my recently new post:
http://keeperklan.com/threads/4745-Suggestion-create-the-missing-messages-to-inform-the-player-about-blocked-ways
If you add the warning messages i suggest, you can use this savegame to test if it appears.

So we need to investigate the other case: why imps prefer reinforcing walls before claiming enemy slabs.