yvsarkisyan / keeperfx

Automatically exported from code.google.com/p/keeperfx
0 stars 0 forks source link

Morkardar Blue Keeper AI malfunctioning #480

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Enemy AI in Morkardar (first Deeper Dungeons level, 80 in game data) doesn't 
play effectively. This happened in both the latest nightly and when reverting 
to 4.5 complete; on the second time I used the sight spell and Reveal Map to 
observe the Blue Keeper.

1.Stops mining his gems early in the level
2.Goes broke (I think?) before he reaches the gold on the other side of the 
map, and only resumes gem digging after finishing the other digging tasks first
3.Seems that even when he has gold, mostly assigns creatures to research and 
workshop; when left for about an hour, creatures are still all lv1~5, mostly on 
the lower end

Needless to say, this makes the level absolutely pitiful, wheras in the 
original game this level's blue keeper trains well and scavenges.

As a side note, is it likely the AI is broken in more Deeper Dungeons levels? I 
was hoping to play through it but this would be problematic.

Original issue reported on code.google.com by kevi...@gmail.com on 31 Dec 2014 at 4:48

GoogleCodeExporter commented 9 years ago
I think this happens cause of the Wizard that guards the Lightning spell. His 
Imps get killed there and it doesn't really react to it. 

Original comment by Krizzi...@gmail.com on 31 Dec 2014 at 5:40

GoogleCodeExporter commented 9 years ago
It would be helpful to have progress of the enemy keeper recorded on a video, 
for both KeeperFX and original Deeper Dungeons. Like a map screen view with 
whole map revealed. This way we'd know where in DD enemy keeper makes better 
decisions.

Original comment by mefistotelis on 31 Dec 2014 at 9:16

GoogleCodeExporter commented 9 years ago
Well, as a rule on maps with gems the original AI did better. Also, imps still 
behave funky.

Original comment by Loobinex on 31 Dec 2014 at 10:02

GoogleCodeExporter commented 9 years ago
With the funky behavior I mean the one mentioned at issue #302. Where the rival 
computer now has imp parties on the map, just wandering around together being 
idle, but outside the dungeon.

Also issue #200 differs from how the original game behaved, this actually 
hinders the computer player more than it does human players.

The most important thing is the gem digging behavior of course, where gems are 
now ignored a bit too much.

Original comment by Loobinex on 31 Dec 2014 at 10:24

GoogleCodeExporter commented 9 years ago
GOG's dosbox Dungeon Keeper runs awfully on my computer for some reason, so I 
can't really record a video of that :/ There is a video on youtube of non-FX 
where someone does the level casually and after about 40 minutes the keeper had 
all lv10 creatures and scavenged away warlocks.

Noteworthy details are when I was examining the enemy keeper with Sight of 
Evil, I'd notice he was not mining the gems, yet he had a lot of imps just 
kinda standing around in his library (where they got slaughtered by warlocks, 
but regardless, they seemed to be idle) He made more to fix that, but they 
still didn't really do anything.

The log file is already gone (oops, although I could make a new one today 
easily) but it had a ton of "job assigned NULL" for the enemy's creatures, and 
some stuff about going over the max for the dig queue I think. 

Since the enemy AI is clearly just futzing about uselessly, I should probably 
go ahead and record the video+obtain new log file, as there's an ingame 
function for that and the free Horned Reaper lets me rush the Reveal Map.

Original comment by kevi...@gmail.com on 31 Dec 2014 at 2:06

GoogleCodeExporter commented 9 years ago
Upon going back to the latest nightly to rush Reveal Map and record the keeper 
(the previous post was observations from 4.5 standard), he mined both gold 
seams immediately and then returned to his gems whilst his treasure room was 
full (he evens builds a second one this time), but he still just doesn't train 
his creatures. I got Reveal Map just as he started to fight the room of wizards 
for presumably the first time; if he'd actually been training more of his 
creatures I think he might've been able to handle it just fine, as he imprisons 
one and very nearly gets another.

But even before he starts losing creatures, he only has two leveled warlocks at 
3 and 4, everything else is lv1. It takes take a good chunk of time to get to 
the map special, so this isn't just "oh, he didn't have time to train more".

After this, he only lets one troll train (to lv4), the rest get thrown against 
wizards that they just try to run from because they're lv1 vs. lv7 wizards... 
and also because they're melee creatures, and the other wizards are across a 
block of lava. DERP. This is part of the reason he can't kill them; not only 
are his creatures lv1, but he lets them get sniped to death without building a 
bridge to the target. When he breaks the door to the other wizards they kill 
his heart.

So, this time he didn't even live, wow. Nevermind about the video, it'd take 
far longer to watch it than it would to just read this and all that happens is 
he dies. He seemed to manage his money better in the nightly, but he also never 
got a chance to use it.

And as said before, in my first play in the nightly, he lived, but all his 
creatures were lv 1~2, after I spent about an hour training up to 10; so even 
if he lives he still apparently doesn't train. I'm not sure if he was broke or 
not, that time, though.

Original comment by kevi...@gmail.com on 31 Dec 2014 at 2:59

GoogleCodeExporter commented 9 years ago
OH YEAH, the log file. When you get to the lost surface thing it's because I 
tabbed out to sigh about the blue keeper getting killed by wizards. Lots of 
null jobs, and some various errors I don't know whether they're relevant or not.

Original comment by kevi...@gmail.com on 31 Dec 2014 at 3:04

Attachments:

GoogleCodeExporter commented 9 years ago
i'm bad at multiposting I figured you might want the actual save file, this is 
as soon as I get Reveal Map from rushing to it about as fast as I think is 
realistically possible.

Original comment by kevi...@gmail.com on 31 Dec 2014 at 3:09

Attachments:

GoogleCodeExporter commented 9 years ago
Mefisto,... is there a difference in what creatures do research? It seems the 
CP forces all creatures to do research, instead of just creatures with research 
as a primary/secondary job. This is not efficient.

Original comment by Loobinex on 31 Dec 2014 at 5:48

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Computer Player chooses tasks for creatures based on dungeon state, not based 
on creature preferences or skill.

If there's enough money, computer player will choose expensive tasks; otherwise 
it will put creatures into rooms which are free to use.

Original comment by mefistotelis on 1 Jan 2015 at 2:23

GoogleCodeExporter commented 9 years ago
After more observation, I've realized a few more issues.

1.The keeper often drops creatures into a room, but then the creatures 
immediately leave, to go wander back to the wizard room. However, they just 
walk back and forth between the room's entrance forever; there's no CTA spell, 
so either they just fear the wizards too much to fight or their pathfinding 
gets mad because they can't reach them across the lava?
2.The keeper is actually literally unable to kill the wizards; the three that 
are across lava will fall over with 1hp to be imprisoned, but as they're across 
lava, imps cannot possibly reach them. Then they revive after awhile and use 
their heal spell on themselves. The poison traps only further complicate this, 
not that an imp ever gets a bridge to go over the lava with anyway, even after 
land is claimed. Not to mention that the keeper suicides his melee units trying 
to get them to fight wizards they cannot reach.

Although, whilst the keeper does still try to assign creatures to manufacturing 
(even if they just walk back to wizards) he still never tries to train them, 
and he has a full 7x5 treasure room. :T It might just be due to tunnel vision 
on the wizards though.

Whilst I have my doubts if the AI would succeed even if the wizards didn't 
exist or were weaker as training seems like such a low priority to him, they're 
pretty much an infinite stalemate for him right now, preventing him from ever 
doing something or even outright killing him before you ever reach him. 

Original comment by kevi...@gmail.com on 1 Jan 2015 at 3:11

GoogleCodeExporter commented 9 years ago
I tabbed back in and he'd built a bridge (not nearly as soon as he needed to, 
but) so the wizards walked across and killed his heart x______________x

Original comment by kevi...@gmail.com on 1 Jan 2015 at 3:13

GoogleCodeExporter commented 9 years ago
Seems that setting Imprison for AI keepers has an unwanted side-effect here. It 
should probably be switched off.

Original comment by dayoka...@gmail.com on 1 Jan 2015 at 5:10

GoogleCodeExporter commented 9 years ago
I have tried to test this as well. I ran the map by using the cheat menu to 
display the level, and use frame skip to speed up the game. I used r1560.

For me in over 20 games it never happened that the wizards proved problematic 
for blue - with or without imprisonment. Each time when they attacked they did 
so from the east being able to capture 3 wizards straight away. The fourth 
sometimes lived but quickly fell.

Imprisonment DOES need to be turned off for this map: The level is designed as 
a vampire generator for blue: a large and ineffective library has been situated 
in such a way that imps will always dig out that way, getting killed by 
warlocks and providing corpses for the graveyard. Even better would be to 
implement issue #329

A few things go wrong for blue:
• He is too focused on research. New libraries will be built and bile demons, 
hounds and mistresses will be used to do research.
• He often still runs out of gold, causing him to focus on the workshop for 
additional cash. He needs to mine better.
• He will never build a larger training room. A single 5x5 room is not enough 
for 35 creatures. If I give blue all research for free he will still stick to a 
single training room.

Original comment by Loobinex on 1 Jan 2015 at 10:32

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It took a while, but I did some testing in Deeper Dungeons as well. In my 
version of Deeper Dungeons the blue keeper didn’t do anything. However, in 
Deeper Dungeons gold which I managed to get running I can confirm the 
observations of Kevin: Blue ends up with a fully trained army.

For one thing, blue just seems to focus more on training. Other notable 
differences:
• The wizards are always attacked from the east
• Blue never runs out of gold. More focus on gems and Issue #192 seems not to 
be present in DDG.
• Many vampires are created, but they all die because of the warlocks. Only 
when left alone forever and blue breaks out to the center of the maps do so 
many vampires spawn to change the tide of battle.
• No issues with CTA, it is present much shorter, but it is cast on 
lair-fights.

I don’t think there is any real difference in decision making to affect a 
different outcome between KFX with imprisonment off and DDG. However at the 
second payday both keepers have around 28 creatures, with DDG averaging about 
level 6 and KFX having just a handful of trained creatures and mostly level 1 
and 2 creatures.

Huge difference.

Original comment by Loobinex on 2 Jan 2015 at 12:14

GoogleCodeExporter commented 9 years ago
Computer player stops training creatures when he's low on money - it's that 
simple.

So to make him train faster, we must do changes which will ensure him having 
enough money.

Now, gold is increased by either imps putting it into treasure room, or by 
computer players "check for low gold" - which does several actions trying to 
get more gold in case it's low (sell traps, pick gold pots laying around, pick 
creatures from expensive rooms, increase priority of gold veins digging).

Gold is decreased by using expensive rooms or building new rooms. There are 
also spells which cost gold, but they're only used if we have enough of it.

To make sure creatures are training, we have to keep the gold amount always 
above payday cost. At the beginning of the level payday cost is quite low, so 
this is the same as getting completely out of gold.

The possible improvements which I can think of are:
- Make sure there are always some imps which are digging for gold/gems. In 
other words, make dependency between what job an imp gets and what other imps 
are doing. This would allow to make a few imps focus on digging gems, but it 
also doesn't seem to represent what imps are - I mean, that would mean imps 
have kind of mental link and are always aware what other imps are doing.
- Slow down building of new rooms if the gold is going to be depleted by 
building. I think it would be nice if, after digging the whole new area, room 
was built to 3x3 size at center, and then expanded only when gold allows that.

Original comment by mefistotelis on 2 Jan 2015 at 11:06

GoogleCodeExporter commented 9 years ago
Sorry, but not true. If you give blue 500000 gold to start the level with and 
wait two pay days his creatures will average around level 3 or 4. So it is not 
gold related.

In DDG waiting two paydays - without giving blue gold - the creatures will 
average around level 6.

Original comment by Loobinex on 2 Jan 2015 at 11:18

GoogleCodeExporter commented 9 years ago
Gold is still an issue, it's just not the only issue. However, fixing Issue 
#192 alone might go a long way for that, as the imps mining the gems will have 
a lot less down time to put it in the treasure room. 

I had noticed the gold piles were always on the furthest end of the treasure 
room, but I hadn't paid it any mind.

Original comment by kevi...@gmail.com on 2 Jan 2015 at 11:49

GoogleCodeExporter commented 9 years ago
Yes, I didn't mean to say gold mining isn't an issue at all, just that it isn't 
the main one effecting this map. Even with imprisonment off and blue having 
more money than it can use it still trains significantly slower than it did in 
DDG.

I don't think it is just this map,... a while ago more focus was put on 
training and it made a big positive difference but since then somehow keepers 
seemed to have gotten weaker again.

Original comment by Loobinex on 2 Jan 2015 at 11:59

GoogleCodeExporter commented 9 years ago
This is quite surprising.

Are we able to determine what is the second difference which made DD creatures 
train faster?

Original comment by mefistotelis on 3 Jan 2015 at 12:49

GoogleCodeExporter commented 9 years ago
It is hard to tell exactly, but it seems to me the CP keeps picking up 
creatures not giving focus on training.

Load the attached save and notice the computer player continues to drop in all 
creatures into the library which are then kicked out again by the warlocks.
On other maps I have also noticed many libraries with all creatures in it.

Original comment by Loobinex on 3 Jan 2015 at 1:03

Attachments:

GoogleCodeExporter commented 9 years ago
From what I see is this save computer player plays everything perfectly.

It keeps training room over 2/3 capacity occupied, and all 3 work rooms are 
used.
It would probably train more creatures if his training room was bigger, but 
then he wouldn't have other room types that fast.

I will think about how to implement job optimization based on creature stats. 
Besides that, I can't see much to improve in this save.

Original comment by mefistotelis on 3 Jan 2015 at 1:25

GoogleCodeExporter commented 9 years ago
Looking at it again, I overestimated the training level of the DDG map,... it 
is not 6 at payday two, it comes in at around the same level of KFX at payday 2 
with inf. gold.

Perhaps gold is the primary issue on why KFX ends up so under-powered compared 
to DDG. Load attached save where blue has no inf.gold and here he has no gold 
left and no imps mining.

Or max out the use of the library,... it is good to rush to research rooms, but 
having your level 1 bile demons and hounds research destroy walls is just a 
waste. 4 Researchers have the rooms researched in no time, no need to have 15 
researchers ever.

Original comment by Loobinex on 3 Jan 2015 at 2:12

Attachments:

GoogleCodeExporter commented 9 years ago
Did you make changes to this already? r1563 seems to play out differently to 
me: 

* Mistresses and Orcs now train
* Bile_demons and Trolls now work, never train
* Warlocks, dragons and vampires now do research, never assigned to train. 
(Dragons do train when research is complete).

A good basis, but training is more important then this. See the attached save.

* Workshop is not that important - bile demons and trolls should train more.
* Non-magic level 10 creatures(Orcs, Misstresses) are left idle. They should be 
assigned to the workshop or scavenger room. 
* When research is complete, magic creatures should train. Having a magic 
creature sometimes train before that time also doesn't hurt as they will 
research faster with a few levels under their belt.

Original comment by Loobinex on 3 Jan 2015 at 10:56

Attachments:

GoogleCodeExporter commented 9 years ago
No, I haven't made any changes regarding job assignment using job preferences 
yet. Your observations must've been just a coincidence.

Original comment by mefistotelis on 3 Jan 2015 at 11:17

GoogleCodeExporter commented 9 years ago
I ran it 5 times, no coincidence.

It must be a bug: CP simply does no pickup anymore. This causes creatures to 
only do their primary job, which matches my observations perfectly.

Original comment by Loobinex on 3 Jan 2015 at 11:27

GoogleCodeExporter commented 9 years ago
Checked it today, computer assistant seem to move creatures just fine.

Maybe I fixed it already - I did some changes to this area today.

Original comment by mefistotelis on 3 Jan 2015 at 7:21

GoogleCodeExporter commented 9 years ago
In r1567 the same thing happens. The computer assistant moves creatures just 
fine, but the blue keeper never does.
Load to attached save to see the the blue keeper never drop a creature 
anywhere, not even on fights.

Also notice this means some creature types are very well trained and others are 
level one.

Original comment by Loobinex on 4 Jan 2015 at 9:58

Attachments:

GoogleCodeExporter commented 9 years ago
Now I found it. What a stupid mistake that was.. fixed.

Original comment by mefistotelis on 4 Jan 2015 at 10:49

GoogleCodeExporter commented 9 years ago
I've triggered an unscheduled nightly build to allow testing this faster.

Original comment by mefistotelis on 4 Jan 2015 at 12:02

GoogleCodeExporter commented 9 years ago
Ok, I've tested it and this issue is solved. Although this has an adverse 
effect on the performance of blue in this level, meaning the CP does more harm 
than good.

Original comment by Loobinex on 4 Jan 2015 at 12:46

GoogleCodeExporter commented 9 years ago
Played the map today with latest nightly and it works well now.

Original comment by Krizzi...@gmail.com on 4 Jan 2015 at 9:04

GoogleCodeExporter commented 9 years ago
You mean you faced a fully trained army when you fought blue?

Original comment by Loobinex on 4 Jan 2015 at 10:40

GoogleCodeExporter commented 9 years ago
Yep, he had three training rooms fully filled the whole time. 

The only problem there was, was the CTA spell which he never turned off, so 
that slowed him down quite a lot at the end. "Luckily" he casted it at the edge 
of the map, so most of his creatures weren't affected. (unless he dropped them 
there)

Original comment by Krizzi...@gmail.com on 5 Jan 2015 at 7:29

GoogleCodeExporter commented 9 years ago
While testing the changes to CTA in issue #500 I really must insist the problem 
is still there.

I even had a playthrough where the blue army was so weak - combined with the 
fact that he lost his imps - the wizard managed to kill the dungeon heart. So I 
won the map without making a single move.

Original comment by Loobinex on 22 Feb 2015 at 3:53

GoogleCodeExporter commented 9 years ago
You mean the problem with comp. player going out of gold? This issue become 
quite long...

Original comment by mefistotelis on 25 Feb 2015 at 9:39

GoogleCodeExporter commented 9 years ago
I meant the issue of the blue keeper staying much weaker than he was in the 
original game.
Krizzy said blue is strong enough here, I disagreed. Some creatures train, but 
blue trains up far slower than he used to (even with gold), and I even had a 
play through where he was so weak as to die to a single Wizard.

So the update to CTA is not enough.

Original comment by Loobinex on 25 Feb 2015 at 10:58

GoogleCodeExporter commented 9 years ago
I will play it again this evening with n1613. Will let you know how it plays 
out. :)

Original comment by Krizzi...@gmail.com on 28 Feb 2015 at 9:24

GoogleCodeExporter commented 9 years ago
Note that when you face blue, he should have an army of level8-10 creatures, 
many of the mistresses.

Original comment by Loobinex on 28 Feb 2015 at 9:29

GoogleCodeExporter commented 9 years ago
Just played the map,

He started out fine, dug out the gold quite fast and kept mining the gems. But 
somehow he kept his money low by making a lot of workshops and not by training 
his creatures. 

After 45 minutes he had an average creature level of 5 or 6. Orcs were the 
highest at level 8 through 10 and then came the warlocks which he kept in the 
Barracks(?) ranging from level 4 to 9. His mistresses were level 7 max, most of 
them lower. The rest of his creatures were level 4 or lower.. 
As said he kept favoring the workshop instead of the training room. Only his 
Orcs got some training when his Workshops were full. After 3 or so rounds they 
would be picked up and put back on Workshop duty.

He captured the Wizards quite easily early on. But not with high level 
creatures, more with lots of low level ones instead.

He dug around his land, but did not go for the small hero village. Only 40 
minutes in or so he decided to put his CTA flag in my prison and start an 
attack. At this time I had claimed the hero village and had 13 vampires of 
level 7 and higher, a level 10 reaper. The rest of my creatures didn't really 
matter cause they alone would trash his army easily..

From DDG I know that he was a lot faster with attacking. You could barely 
capture the Hero village before he would.
Getting vampires was out of the question too, then cause he would scavenge them 
away almost instantly. Now he only got one, which I grabbed from him soon after 
it spawned from his graveyard.. 

Original comment by Krizzi...@gmail.com on 28 Feb 2015 at 10:00