Improving tactical information for AI

All new ideas for the upcoming releases of ToME 4.x.x should be discussed here

Moderator: Moderator

Message
Author
lukep
Sher'Tul Godslayer
Posts: 1712
Joined: Mon Mar 14, 2011 10:32 am
Location: Canada

Re: Improving tactical information for AI

#16 Post by lukep »

stinkstink wrote:
lukep wrote:- Block no longer used as an attack at long range
Might want to allow this if they have Wave of Power off cooldown.
Slingers can also benefit from counterstrikes at long range, but I think it's too rare to have your target attack you (with the right damage type), then you attack your target when you are far apart from each other. I may have it check riposte though...
Some of my tools for helping make talents:
Melee Talent Creator
Annotated Talent Code (incomplete)

aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Re: Improving tactical information for AI

#17 Post by aardvark »

lukep wrote:New version coming, but a inscrutable bug first:

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 })
Why doesn't that work?
The only possible problem I can see is missing checks for target.x and target.y. Try

Code: Select all

newai(Talents.T_BLOCK, { ATTACK = function(self, t, target) if target and target.x and target.y and core.fov.distance(self.x, self.y, target.x, target.y) <= 1 then return 4 end return 0 end, DEFEND = 3 })
and see what happens. This way it returns 0 if there's no viable target or the target is out of range.

lukep
Sher'Tul Godslayer
Posts: 1712
Joined: Mon Mar 14, 2011 10:32 am
Location: Canada

Re: Improving tactical information for AI

#18 Post by lukep »

HUGE bug fixed: I was preventing anything from being calculated properly. Replaced all uppercase types (eg. ATTACK, BUFF) with lowercase ones (eg. attack, buff). This also seems to fix the block issue, which was just the same bug, but I noticed it sooner.

Also, Rush is now only used from range 2, and disable's weight reduced to (attack weight/2 + best disable value), from (attack weight + best disable value).
Attachments
tome-betterai.zip
(22.01 KiB) Downloaded 217 times
Some of my tools for helping make talents:
Melee Talent Creator
Annotated Talent Code (incomplete)

aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Re: Improving tactical information for AI

#19 Post by aardvark »

lukep wrote:HUGE bug fixed: I was preventing anything from being calculated properly. Replaced all uppercase types (eg. ATTACK, BUFF) with lowercase ones (eg. attack, buff). This also seems to fix the block issue, which was just the same bug, but I noticed it sooner.
That is huge! And a quick check shows that the tactical AI in 1.0 and current svn has the same bug. I wonder if how much smarter the native AI would get even without your tweaks if this was fixed.

lukep
Sher'Tul Godslayer
Posts: 1712
Joined: Mon Mar 14, 2011 10:32 am
Location: Canada

Re: Improving tactical information for AI

#20 Post by lukep »

aardvark wrote:That is huge! And a quick check shows that the tactical AI in 1.0 and current svn has the same bug. I wonder if how much smarter the native AI would get even without your tweaks if this was fixed.
Not a bug in the main version. IIRC, it runs the talents through function that does that automatically.

In my bugged version,

Code: Select all

=game.player:getTalentFromId(game.player.T_BLOCK).tactical
(changed in my addon) returned (...) ATTACK (...) , while

Code: Select all

=game.player:getTalentFromId(game.player.T_SPIT_POISON).tactical
(unchanged) returned (...) "attack" (...)

EDIT: and, after a bit of preliminary testing, rares seem smarter, deadlier, and more aggressive. Of course, it still doesn't help when they spawn with mis-matched talents and weapons.
Some of my tools for helping make talents:
Melee Talent Creator
Annotated Talent Code (incomplete)

aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Re: Improving tactical information for AI

#21 Post by aardvark »

You're right. It's in data/talents.lua. It looks like you could use the "ToME:load" hook to "superload" the newTalent() function with one that changes your tactical tables to lowercase, just like data/talents.lua does for the current tables. That would make your changes easier for darkgod to pull into trunk, if he decides to do that.

stinkstink
Spiderkin
Posts: 543
Joined: Sat Feb 11, 2012 1:12 am

Re: Improving tactical information for AI

#22 Post by stinkstink »

How are you handling Fearscape? Because the priority should be dialed way down if the user isn't a demon somehow, or the target is.

lukep
Sher'Tul Godslayer
Posts: 1712
Joined: Mon Mar 14, 2011 10:32 am
Location: Canada

Re: Improving tactical information for AI

#23 Post by lukep »

I've left it as-is, which is to say, that it should only be used against targets that have finished the game, if I'm reading it right. (same for Dreamscape).

Also, I just added a lower-casing part to my function, so I can keep it looking the same as it is in the talents files.

Idea: add/remove parts of this addon, and make the final bosses fight each other to objectively see if it is helping them be deadlier. I'm thinking 1v1 sun paladin vs. reaver.
Some of my tools for helping make talents:
Melee Talent Creator
Annotated Talent Code (incomplete)

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Improving tactical information for AI

#24 Post by darkgod »

Interesting; know that my eye is on you ! :)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: Improving tactical information for AI

#25 Post by HousePet »

The Evil Eye!

Hmmm that could be a nice artifact name...
My feedback meter decays into coding. Give me feedback and I make mods.

Amphouse
Thalore
Posts: 186
Joined: Mon Feb 04, 2013 9:31 pm

Re: Improving tactical information for AI

#26 Post by Amphouse »

Haven't tried this yet, but I was wondering if you have done anything about how enemies use traps and other trap-like talents, because right now they are really stupid about it; they tend to use them on the space you are currently standing, which doesn't trigger them. They should try to place them in front of you to block your advance, or perhaps behind you to block your escape.

lukep
Sher'Tul Godslayer
Posts: 1712
Joined: Mon Mar 14, 2011 10:32 am
Location: Canada

Re: Improving tactical information for AI

#27 Post by lukep »

Amphouse wrote:Haven't tried this yet, but I was wondering if you have done anything about how enemies use traps and other trap-like talents, because right now they are really stupid about it; they tend to use them on the space you are currently standing, which doesn't trigger them. They should try to place them in front of you to block your advance, or perhaps behind you to block your escape.
I haven't done anything with traps, or glyphs, or aether beam/breach, or aiming summons, or manually aiming to hit/miss different targets. All of those changes would be good, but quite difficult to do, and (necessarily) have very small niches. I probably won't do anything about them, and if I do, it would be after all of the easier work is done.
Some of my tools for helping make talents:
Melee Talent Creator
Annotated Talent Code (incomplete)

lukep
Sher'Tul Godslayer
Posts: 1712
Joined: Mon Mar 14, 2011 10:32 am
Location: Canada

Re: Improving tactical information for AI

#28 Post by lukep »

I got through the rest of the talents (total number of talents altered: 261).

Next up:
- better, universal damage estimator (and using it in stuff), also, a effect application chance calculator like "_M:canBe("foo")", but returning a percentage instead.
- new (NPC-exclusive) talents like "switch to fire infusion" and "spike physical psionic shield".
- look at making CURE into mental, physical, and magical, at least.
- bug testing

Maybe:
- Silence is better on spellcasters, disable is better on melee/archer, removing buffs is better when they have buffs,
Attachments
tome-betterai.zip
(22.15 KiB) Downloaded 191 times
Some of my tools for helping make talents:
Melee Talent Creator
Annotated Talent Code (incomplete)

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Improving tactical information for AI

#29 Post by darkgod »

Why dont you upload it to te4.org :)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

lukep
Sher'Tul Godslayer
Posts: 1712
Joined: Mon Mar 14, 2011 10:32 am
Location: Canada

Re: Improving tactical information for AI

#30 Post by lukep »

Some of my tools for helping make talents:
Melee Talent Creator
Annotated Talent Code (incomplete)

Post Reply