erikbroo / chengband

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

[AI] Spell frequency #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Ranged attacks and spells 

This is a failure of the AI, which tries to move towards you/attack you with 
the same probability regardless of whether you're meleeing or lobbing 
spells/missiles. 

Proposed solution:  Dynamically adjust the monster's strategy so that it will 
tend to lob spells at you if you lob spells at it, but that's one potential 
approach.  For example, if the monster normally casts a spell with 1 in X odds, 
then right after you hit the monster with a ranged attack, the odds of casting 
a spell increases to 3 in (X+2).

Original issue reported on code.google.com by caltech....@gmail.com on 1 Nov 2010 at 9:07

GoogleCodeExporter commented 9 years ago
Fixed in 0.0.3
==============

This is a tricky one.  We don't want to penalize Archers, so distance attacks 
from shooters are OK.  Basically, I can pick up most player initiated distance 
attacks from the project() function.  This definitely will handle Mana Storms 
and Rockets while excluding missiles, which is what we want.  If you attack a 
smart monster from a distance (> 1), he becomes "ticked off".  The next time he 
is processed for action, he is more likely to cast a spell.  

Getting the percentages correct is a bit tricky ... Any thoughts on the odds?  
In the end I went with an extra 1 in 2 chance of casting a spell for ticked off 
monsters.  The "ticked off" flag only clears once a spell has been cast.

I think The Serpent is now much more difficult for spell casters!

Original comment by ckou...@gmail.com on 4 Nov 2010 at 1:29

GoogleCodeExporter commented 9 years ago
I tweaked this a bit more.  I increased the likelihood of casting a bit more.  
But, when choosing spells, I decreased the likelihood of choosing a summoning 
spell when "ticked off".  If you are mad, you want to hit something, not go run 
for help ;)

Original comment by ckou...@gmail.com on 4 Nov 2010 at 2:01

GoogleCodeExporter commented 9 years ago
Wait, why do we want to apply spell revenge only to spells?  It seems like we 
should also apply it to archers, because monsters don't have an "archery" 
option vs. archers.  With an archer/ranger who's firing Seeker Arrows and 
blinking, casting more spells does seem like the right response for an 
intelligent monster, rather than continuing to charge at where the player 
currently is.

Original comment by caltech....@gmail.com on 4 Nov 2010 at 6:08

GoogleCodeExporter commented 9 years ago
The main issue was the summoning frequency.  When I first tried this change 
out, I had 100% spell choice for ticked off monsters.  Monsters with summoning 
spells choose that 40% of the time.  So the result was that the ticked off 
monster hangs back and completely surrounds you with summoners.  It was crazy!  
At that time, I had the thought that this would completely nerf archers, since 
they can't shoot thru summons, while mages can still lob Mana Storms.

Since then, I've toned down the spell choice frequency.  I'm currently at:
Monster rolls normally.  If that fails and they are ticked off, roll a 70% 
likelihood of casting.  Its often enough to be noticeable.  Plus, even if the 
monster doesn't spell this turn, he keeps the ticked off flag until he does.

Also, I tweaked the spell selection, but this is a dangerous path.  We don't 
want to make ticking off monsters advantageous to players.  But what I did was 
to make summoning half as likely (20%) since you are now probably getting 
double the spells lobbed your way.  On balance, it should be similar to before, 
but the result (I'm speaking with the J in mind here) is the other turns will 
be spent fielding big attacks and such.

Its hard to get a true feel for whether this is too hard now.  I have a wizard 
mode Chaos HM battling the Serpent, and with the Wizard restore all command 
(that doesn't consume energy!), I can handle the guy!  I still get nasty 
summons (Well, all other uniques are still alive too) and pretty much have to 
teleport every time that happens.  But often, the Serpent and I trade attack 
spells.

Anyway, I guess I'm willing to apply this to Archers too, since the summoning 
has been nerfed a bit.

Opening back up ...

Original comment by ckou...@gmail.com on 4 Nov 2010 at 2:01

GoogleCodeExporter commented 9 years ago

Original comment by ckou...@gmail.com on 12 Nov 2010 at 10:23

GoogleCodeExporter commented 9 years ago

Original comment by ckou...@gmail.com on 13 Nov 2010 at 10:50

GoogleCodeExporter commented 9 years ago
Currently (0.0.8), the new AI is only applied to monsters with the RF2_SMART 
flag.  Let's go ahead and make this more broadly available, and make it apply 
to any monster with a significant distance attack to offer.

Also, don't forget to make Archers share in the fun.  A good test monster is 
the Maulotaur (130), who is normally stupid and fires only 1 in 5.  Another 
good test monster is the Storm Wyrm (728), who breathes 1 in 6.

Both of these can be conjured by the Wizard command 'n'.

Original comment by ckou...@gmail.com on 14 Nov 2010 at 3:35

GoogleCodeExporter commented 9 years ago
Fixed for 0.0.9
===============

This really encourages my evil side ...  Maulotaur is 723, not 130 btw.

OK, any monster with a decent distance attack, or decent summoning can get 
ticked off.  The game currently prints messages when this happens, so you can 
know about it.  Another message is printed when the flag clears (sometimes this 
is omitted, so I have a bug someplace?)

Ticked off monsters do not "lose" their innate attacks randomly during spell 
selection the way normal monsters do (A Storm Wyrm tries to cast a spell 1 in 
6, and then, 4 in 6 times it is denied access to its breath, so it might only 
breathe 1 in 18 normally).

Ticked off monsters will always choose an offensive spell as a last resort, 
after attempts to pick other spells have failed.  Normally, monsters roll 70% 
for this ... I found that my ticked off Storm Wyrm would still march towards me 
even when it was supposed to "spell".  No more ...

Ticked off monsters have their spell lists culled to just attacks and high 
summoning.  If their hp are below a third, they can also use their "panic" 
abilities (heal, teleport, etc).

Ticked off monsters are more likely to spell (70% at the moment ... might need 
tweaking).

So, basically, you either get summoned upon, or blasted in response, until the 
monster is near death, where it will run away/heal.  Oh, and Archers are now 
affected.

This will require real playtesting and further adjustment, I am sure :)

Original comment by ckou...@gmail.com on 14 Nov 2010 at 4:05