Improving tactical information for AI
Moderator: Moderator
Improving tactical information for AI
I'm in the process of making an addon that will try to improve the tactical AI talent weights, so that enemies are deadlier, without increasing their power level.
Goals:
- Change most attack = X (or attackarea, or disable) checks to the proper types, add them where required.
- add and remove relevant types (eg, "defend" on Bellowing Roar replaced by "attackarea")
Standards:
- Attack/Attackarea values, at 1 = 100 damage or 100% weapon damage at 100 (mind/spell/phys)power, talent level 5. (approximately) EDIT: Halved for DoT effects?
- buff = ???
- Disable 1 = 1 turns of complete incapacitation (or 2 turns of 50% effectiveness, or 3 turns of 1/3 reduced effectiveness etc...)
- Cure 1 = 1 effect cured.
- Heal 1 = 100 HP (talent level 5, 100 power)
- resources = ??
- closein = 6 / (average number of turns to reach)?
- escape = ??
- defend = ??
Done:
- Changed DISABLE's weight, to disable + 1/2 attack
- Changed CURE to 3 + (# of detrimental effects)
- status effects are not a straight pass/fail for checks, they have 10 chances and are weighted based on successes.
- Fixed resistance calculation.
- added more resources for AI.
To Do:
- look at changing ESCAPE's weight to consider CURE?
- look at BUFF
- add +damage% to the resistance calculation section.
- fix the weapon damage type (also, armour? defense?)
- Look at splitting cure into mental/mind/physical types.
- tactically unsustaining talents? (eg. invisibility, stamina drains, mindslayer spikes) (EDIT: maybe create NPC only talents like "spike thermal aura")
- Do something about mutually exclusive sustains.
- look at immobile actors.
Ideas that are too much work:
- move all of the talents' damage calculations(etc) to a standard place in the talent, and access that from the AI, getting the best damage.
-- make "fake" damage projections, so that damage affinity, AM shield, psi shields, and everything else is calculated properly.
- Allow actors to read their target's tactical AI info, so (for example) they would use mana clash when the enemy wants mana, or a pin when the enemy wants to escape/close in.
- allow AI to consider multiple weights and add them up (eg, attack AND disable)
- add another line to check resist, "target" that counts if the target enemy is hit (and then remove attackarea, and have it reference target/foe hits instead)
- make special checks for a bunch of stuff, like silence counting the number of spells vs other talents to determine power, and something for disarm.
Anyone have thoughts on this?
Current bugs:
- bump attacks are default if no other choice, even if it has 0 value. May not be a bug.
- an enemy used Bone Nova on me, when I had >100% physical resist. Also, when out of range. Pyrokinesis used out of range. And repulsion. Also, make leeches only work with a target.
- Ice wall, probability travel not used well.
- enemies suck at escaping.
- Shadow Tunnel should require minions.
- Highborn's bloom with full resources, nothing in sight.
- Wild infusion is "better" defense than Shield rune
EDIT: jenx has taken over this project after I abandoned it.
Goals:
- Change most attack = X (or attackarea, or disable) checks to the proper types, add them where required.
- add and remove relevant types (eg, "defend" on Bellowing Roar replaced by "attackarea")
Standards:
- Attack/Attackarea values, at 1 = 100 damage or 100% weapon damage at 100 (mind/spell/phys)power, talent level 5. (approximately) EDIT: Halved for DoT effects?
- buff = ???
- Disable 1 = 1 turns of complete incapacitation (or 2 turns of 50% effectiveness, or 3 turns of 1/3 reduced effectiveness etc...)
- Cure 1 = 1 effect cured.
- Heal 1 = 100 HP (talent level 5, 100 power)
- resources = ??
- closein = 6 / (average number of turns to reach)?
- escape = ??
- defend = ??
Done:
- Changed DISABLE's weight, to disable + 1/2 attack
- Changed CURE to 3 + (# of detrimental effects)
- status effects are not a straight pass/fail for checks, they have 10 chances and are weighted based on successes.
- Fixed resistance calculation.
- added more resources for AI.
To Do:
- look at changing ESCAPE's weight to consider CURE?
- look at BUFF
- add +damage% to the resistance calculation section.
- fix the weapon damage type (also, armour? defense?)
- Look at splitting cure into mental/mind/physical types.
- tactically unsustaining talents? (eg. invisibility, stamina drains, mindslayer spikes) (EDIT: maybe create NPC only talents like "spike thermal aura")
- Do something about mutually exclusive sustains.
- look at immobile actors.
Ideas that are too much work:
- move all of the talents' damage calculations(etc) to a standard place in the talent, and access that from the AI, getting the best damage.
-- make "fake" damage projections, so that damage affinity, AM shield, psi shields, and everything else is calculated properly.
- Allow actors to read their target's tactical AI info, so (for example) they would use mana clash when the enemy wants mana, or a pin when the enemy wants to escape/close in.
- allow AI to consider multiple weights and add them up (eg, attack AND disable)
- add another line to check resist, "target" that counts if the target enemy is hit (and then remove attackarea, and have it reference target/foe hits instead)
- make special checks for a bunch of stuff, like silence counting the number of spells vs other talents to determine power, and something for disarm.
Anyone have thoughts on this?
Current bugs:
- bump attacks are default if no other choice, even if it has 0 value. May not be a bug.
- an enemy used Bone Nova on me, when I had >100% physical resist. Also, when out of range. Pyrokinesis used out of range. And repulsion. Also, make leeches only work with a target.
- Ice wall, probability travel not used well.
- enemies suck at escaping.
- Shadow Tunnel should require minions.
- Highborn's bloom with full resources, nothing in sight.
- Wild infusion is "better" defense than Shield rune
EDIT: jenx has taken over this project after I abandoned it.
Last edited by lukep on Tue Sep 10, 2013 12:23 am, edited 24 times in total.
Re: Improving tactical information for AI
The only thing here I really have a strong statement on. You want the AI to spam these as hard as it can. Don't bother with unsustaining.- tactically unsustaining talents? (eg. invisibility, stamina drains)
For the AI, it can die thousands of times, but if it kills you once, it's a victory. Invisible enemies are usually weaker, but much harder to kill and can be a horribly damaging distraction in dangerous areas-which is where you usually find them. And Stamina drains give the AI that much more of a chance to kill you.
The amount of times these are actually humorously negative can be counted on one hand, and the amount of times they're dangerous is quite high, to me. Basically, it's better off leaving them on, even if it's occasionally suicidal for it.
Besides that, and the too much work idea (Which, besides being too much work, might make the AI really gameable if you know what you're doing.), I don't really feel like I know enough about the AI handling in ToME to comment.
Re: Improving tactical information for AI
I've started coding this up, and it's going quite quickly (celestial, chronomancy, and most of gifts done already), some observations so far:
- many talents needed to have more information added, such as the fact that they check a certain status immunity, or that they deal a certain type of damage.
- I'm increasing the numbers on most attack talents by ~50% (a few stayed the same or decreased, a few got x4 or x5).
- most heals got doubled, Sudden growth got 1/100 the weight.
- 84 lines of code (including comments and blank lines) isn't bad at all for three trees of talents. Not too much typing at least.
Quick WIP addon attached, rename as .teaa to use. It loads to the character creation screen, but I have not tested it further.
EDIT: working on Corruptions, Blood Lock will be deadly. (Its weight scales with HP missing now)
- many talents needed to have more information added, such as the fact that they check a certain status immunity, or that they deal a certain type of damage.
- I'm increasing the numbers on most attack talents by ~50% (a few stayed the same or decreased, a few got x4 or x5).
- most heals got doubled, Sudden growth got 1/100 the weight.
- 84 lines of code (including comments and blank lines) isn't bad at all for three trees of talents. Not too much typing at least.
Quick WIP addon attached, rename as .teaa to use. It loads to the character creation screen, but I have not tested it further.
EDIT: working on Corruptions, Blood Lock will be deadly. (Its weight scales with HP missing now)
Last edited by lukep on Sun Feb 24, 2013 6:30 am, edited 1 time in total.
Re: Improving tactical information for AI
Yeah, I would think that mobs capable of Invisibility would benefit less from turning it off than they would by adjusting their tactics around their invisibility. A hit-and-run AI for invisible mobs could be devastating. Especially for mobs that are also incorporeal.SageAcrin wrote:Invisible enemies are usually weaker, but much harder to kill and can be a horribly damaging distraction in dangerous areas-which is where you usually find them.
Anyhow, really cool idea lukep, I'll check out what you've done, and I look forward to seeing more.
Last edited by nate on Sun Feb 24, 2013 7:11 am, edited 1 time in total.
Re: Improving tactical information for AI
New version, now with celestial, chronomancy, cunning, corruptions, cursed, and gifts trees (6/9 main types, woot)
- Attachments
-
- tome-betterai.zip
- (8.2 KiB) Downloaded 198 times
Re: Improving tactical information for AI
Hey haven't tried the new add-on yet to see if you've accounted for it, was just wondering if you've considered immobile creatures. I'm looking at a black jelly moving at lightning speed at the moment, guess it at least gives it some resistance.
-
- Uruivellas
- Posts: 744
- Joined: Thu Nov 18, 2010 6:42 pm
Re: Improving tactical information for AI
This is certainly an area of the game that can benefit from some improvements.
A simple way get take into account the effectiveness of a talent without actually trying to calculate damage or other things, would be to take the talent level into account when computing the tactical weights. This could probably be handled easily enough by a new resolver than includes something like in the newai definition.
You might also consider adding tactical weights to passive talents. The purpose is to allow the AI (particularly for random bosses) to consider them when determining its overall tactical strategy -- i.e. is this boss better at ranged or melee combat.
A simple way get take into account the effectiveness of a talent without actually trying to calculate damage or other things, would be to take the talent level into account when computing the tactical weights. This could probably be handled easily enough by a new resolver than includes something like
Code: Select all
ATTACK_FINAL = ATTACK * resolvers.talent_level
You might also consider adding tactical weights to passive talents. The purpose is to allow the AI (particularly for random bosses) to consider them when determining its overall tactical strategy -- i.e. is this boss better at ranged or melee combat.
Re: Improving tactical information for AI
Beta version out, all talents (other than misc, racial, and uber ones) done.
EDIT: the code already does calculate weights based on talent level, apparently.
If I have time/inclination, I'll try this out against some bosses, and see if they are deadlier or not.
If I were to do something like that, I would probably modify the talents to pass their damage (and disables) to the AI, instead of getting the AI to roughly calculate it for the talents.Hachem_Muche wrote: A simple way get take into account the effectiveness of a talent without actually trying to calculate damage or other things, would be to take the talent level into account when computing the tactical weights
EDIT: the code already does calculate weights based on talent level, apparently.
If I have time/inclination, I'll try this out against some bosses, and see if they are deadlier or not.
Last edited by lukep on Sat Mar 02, 2013 1:46 am, edited 2 times in total.
-
- Wyrmic
- Posts: 227
- Joined: Thu Mar 10, 2011 9:10 pm
Re: Improving tactical information for AI
Sounds interesting, trying it out.
-
- Wyrmic
- Posts: 227
- Joined: Thu Mar 10, 2011 9:10 pm
Re: Improving tactical information for AI
Whoops! Just moved into range of a Drem when this recurring lua error reared its ugly head:

Up til this point everything seemed fine.

Up til this point everything seemed fine.
Re: Improving tactical information for AI
Hmm, I might have made one of the tactical AI types a function, instead of just the value. I'll check it out tonight.
EDIT: yup, Phase Door was a function, it's fixed now. (not sure how you ran into that bug in the deep bellow though, were there rares around?)
EDIT 2: updated version attached, should work now.
EDIT: yup, Phase Door was a function, it's fixed now. (not sure how you ran into that bug in the deep bellow though, were there rares around?)
EDIT 2: updated version attached, should work now.
- Attachments
-
- tome-betterai.zip
- (10.66 KiB) Downloaded 181 times
Re: Improving tactical information for AI
OK, so I have a large majority of the player talents done, now I'm looking at the tactical.lua file itself, and will check it out more.
Changes:
- adjusted "want" values for paradox and equilibrium, cutting the failure threshold by about 1/2
- fixed resistance calculation, also, make sure that resist all does not apply to status effect types.
- Replaced the binary status immunity check with 10 checks, adding together the successes and dividing by 10. May be slow.
- closein gets escape's want subtracted from it. (should prevent rush/retreat situations?)
To do?:
- add range data to some talents, but don't use it for the talent (eg. Perfect Strikes, block)
Changes:
- adjusted "want" values for paradox and equilibrium, cutting the failure threshold by about 1/2
- fixed resistance calculation, also, make sure that resist all does not apply to status effect types.
- Replaced the binary status immunity check with 10 checks, adding together the successes and dividing by 10. May be slow.
- closein gets escape's want subtracted from it. (should prevent rush/retreat situations?)
To do?:
- add range data to some talents, but don't use it for the talent (eg. Perfect Strikes, block)
- Attachments
-
- tome-betterai.zip
- (21.48 KiB) Downloaded 190 times
Last edited by lukep on Sat Mar 02, 2013 1:24 am, edited 1 time in total.
-
- Wyrmic
- Posts: 227
- Joined: Thu Mar 10, 2011 9:10 pm
Re: Improving tactical information for AI
Hmm, I didn't see anything use Phase Door - the Drem used Stun directly before the error occurred.
Anyway, glad to hear you found the problem, I'll give it another shot.
Anyway, glad to hear you found the problem, I'll give it another shot.
Re: Improving tactical information for AI
New version coming, but a inscrutable bug first:
Why doesn't that work? (newai is my custom function that takes a talent and a table, and replaces the talent's tactical AI info with that table. It's much faster/easier than the normal way.)
Once I get that fixed, I'll package this up properly and move over to the addons side, as I think it is significant enough now, after I did a bit of testing and fixed a few bugs.
Coming:
- Counterstrikes now double the weight of "weapon" attacks.
- fixed my closein bug
- fixed my Flare bug
- added info on +damage% for calculations.
- Block no longer used as an attack at long range
- GWF only used at range 1
- Perfect strikes only used at range 1 (sorry archers...)
- Dominate different AI at range 1 and 2?
Anything that I missed (esp. regarding talents that use range incorrectly)?
Code: Select all
newai(Talents.T_BLOCK, { ATTACK = function(self, t, target) if target and core.fov.distance(self.x, self.y, target.x, target.y) > 1 then return 0 end return 4 end, DEFEND = 3 })
Once I get that fixed, I'll package this up properly and move over to the addons side, as I think it is significant enough now, after I did a bit of testing and fixed a few bugs.
Coming:
- Counterstrikes now double the weight of "weapon" attacks.
- fixed my closein bug
- fixed my Flare bug
- added info on +damage% for calculations.
- Block no longer used as an attack at long range
- GWF only used at range 1
- Perfect strikes only used at range 1 (sorry archers...)
- Dominate different AI at range 1 and 2?
Anything that I missed (esp. regarding talents that use range incorrectly)?
-
- Spiderkin
- Posts: 543
- Joined: Sat Feb 11, 2012 1:12 am
Re: Improving tactical information for AI
Might want to allow this if they have Wave of Power off cooldown.lukep wrote:- Block no longer used as an attack at long range