Tactical AI Analyses and Discussion

All development conversation and discussion takes place here

Moderator: Moderator

Message
Author
grmblfzzz
Thalore
Posts: 133
Joined: Fri Nov 25, 2011 7:53 pm

Tactical AI Analyses and Discussion

#1 Post by grmblfzzz »

I've recently been playing a lot of Madness on the Git version, so have run across endless piles of rares/uniques/bosses. I'd like to discuss some of the issues relating to tactical AI, my impressions of where it's working well and where it's working... not so well. First I'll go into general concerns and recommendations, then into various class specific issues, and finally a discussion on some of the things that could be done to make AI's significantly superior to Tactical (Strategic? :wink: ).

General Tactical AI Issues

Pathing: The biggest general problem with the AI by far, is the horrific path-finding that it has (acquired somewhere near 1.0 if I'm not mistaken). Perhaps some of it was intentional such as not giving mobs map vision/automatically knowing where you are or some-such, or maybe it was intended to make them smarter about showing their faces around corners... but whatever the intent the end result is that the even Tactical AI's are so bad at finding you as to make them more or less helpless with even a little tactical awareness. Some examples:

A) There's a common tendency for mobs that are aware of you to just mill about around corners, out of LoS, but within range of innumerable AOE's you can throw around them. Sadly, The Master is a frequent victim of this. He can just be killed harmlessly with like any AOE most of the time. :(

B) Wall-walkers (Banshees/Dreads/Xorns/etc)... This is really flagrant if you use a track-like ability frequently. They often start/become aware of you, and try to get to you, but just amble about in the walls for hundreds of turns trying to path to you. Posted a pic of a particularly helpless Umber Hulk in the bugs forum a while ago as an example. http://forums.te4.org/viewtopic.php?f=4 ... wallwalker

C) In addition to the milling around when just out of LOS, unable to find you, this behavior is exacerbated by particularly complicated paths. For example, you can make a zigzag tunnel in the walls, and just safely rest although 10+ rares are aware of you and trying to get to you, they'll just never be able to path to you in any reasonable time.

Suggestion: I'm about 95% sure that I remember The Master of old chasing me down through level spanning zigzags prior to 1.0... so... give tactical AI back whatever pathing awareness existed for them then. Or, if I'm delusional, give the Tactical AI the appropriate pathing awareness.

Amusingly Dysfunctional Spawns: This can happen in a variety of ways, some of which just add some amusing flavor, but I suspect that some instances lead to related AI issues.

The amusing flavor of this is things like rares of immobile creature types spawning with pure melee skill-sets, or pure casters coming equipped with arcane disrupting gear. I suppose this can just be chocked up to those mobs making terrible life decisions :)

On the other hand, there are also lots of cases where rares+ will be in LOS and aware of you... but just dance around doing nothing at all. I'd guess this happens when mobs get inappropriate combinations of gear/skills/AI types. Archer/some melee combo's that have melee gear and try to act like ranged, perhaps (not really sure how it's all generated). Most frequently this can be seen with a creature just moving back and forth between 2 spaces, 1 in LOS and 1 around a corner out of LOS... and that's all they'll do as you plink them to death with whatever.

Suggestion: The first type probably doesn't necessitate any addressing, and can be kind of amusing. If the second type is actually caused by what I guess, then some more controls for appropriateness would probably be good. Even if it's not caused by something like this... it is definitively happening pretty frequently and severely lowers the AI's quality.


Class Specific Discussion:

Aside from the general issues raised above, there's some pretty big disparities in how good the AI is for different classes. While this also touches on class balance and interaction with the players class... the AI's are definitely not all equal at utilizing their tools. The tactical deficiencies tend to fall into a few categories: Poor/nonexistent use of gap closers, inappropriate target/range use, or just generally inappropriate and situationally harmless (thus wasted) actions. I'll go into each of the classes and give my thoughts and suggestions, which for most will just be small points that would significantly improve their effectiveness, but in some cases (Mindslayers/Summoners for instance) the AI is almost mind-bogglingly inefficient and there's some easy things that could be done to fix this.

Mindslayers: Mindslayer rares are certainly the most inefficiently played by the AI, judged by the disparity of how strong/utile the class is to how harmless the enemies are.

Issue 1) They don't ever spike their shields or auras. I remember them being able to at least spike auras when they were released, but it was probably taken out due to early game chars getting 1-shot. They should really be able to do this, however, as it's really the cornerstone of the class. I think that since it was removed the dmg has been toned down on them, not to mention that it's improbable (on non-Madness!) to come across one before you have the tools/hp pool to deal with it. They should certainly spike shields that would be appropriate to the chars dmg type as well.

Issue 2) They don't ever seem to use any of their gap closers, so they're like the easiest class to kite around without taking any risk. Perhaps they're rarely given the Augmented mobility tree or something, but if they do they really need to prioritize Telekinetic Leap/Shattering charge/Quick as Thought usage.

Summoner: Summoners problem is that they'll seemingly only summon things via targeting them directly on top of you, which has a range of 5. If you stay outside of range 5 of them... they just sit there and soak up hits harmlessly, just kind of move back when they get to range 6 and you're good. I suggest that they start summoning at towards you at range 10, which would both be fairly simple and the only possible way to really play a summoner :)

Alchemists: They generally do what they can... Their problem is really poor use of their golems, mostly. Its really easy to lure out/kill the golem, and they take forever to summon another and seem to only rarely if ever use supercharge golemn to summon another one while fighting. Giving them/having them use such would make them a lot less harmless.

Anorithils: ... Well, don't have extensive experience playing them because I think they're generally lacking in tools/survivability, so it's possible they're doing what is possible but it's just the class that's at fault. Generally free kills anyway, as I'm pretty sure I've never died to one.

Archmages: Good, with one key exception. The ones with Stonewall cast it directly on you, which as a rule just gives you a snug little hidey hole to let cooldowns come up/regen health/etc. I'd suggest having them use it offensively by targeting the square behind your guy (thus cutting off your escape), or defensively on themselves (thus leaving you potentially open to whatever other mobs exist).

Wyrmics: Basically same problem as Archmages. Mostly fine, just they tend to occasionally waste a turn by casting their ice wall on top of you (which I don't think even damages you like stonewall)... I'm not even sure this is conceptually capable of being an effective move. Just gives you more stuff to hide behind if you so choose. Same suggestion: Have them either cast it 1 square in front of or behind you.

Berserkers: They should cast Unstoppable significantly earlier, as they generally don't get it off.

Solipsists: One of the best AI's. Only thing is that they tend to not ever re-summon thougthforged dudes that die when it's safe to do so.

Rogues: Fine if you don't see them until they're next to you... otherwise there's a few issues.

Issue 1) Traps. Same problem as Archmages/Wyrmics/Summoners here. They seem to only be able to summon traps right on top of you, which is the absolutely least efficient place they can put them. Have them throw them in front of you while they're wandering up, or basically just anywhere that's not on top of you so that there's some chance you'd step on them.

Issue 2) If in melee range, opening with things that aren't either Deadly Strikes or Dirty Fighting... or both. Really, if they have both Deadly Strikes -> Dirty fighting -> Whatever strongly dominates anything else they can do, because they are both instant (Dirty only if fail, but still dmgs you and stun is by far the most devastating thing if it can stick). One of the few instances where there's just a purely dominant opening strategy. I die a little inside every time a Grandmaster Assassin opens on me with Swap!

Issue 3) The common issue of not using gap closers well. If they have nimble step, should be using it if spotted from stealth.

Corruptors/Reavers: Generally good, a couple issues both related to efficient talent use.

Issue 1) Should use virulent disease on cooldown. It's instant, so can go ahead and do whatever else as well. See rogues and deadly strikes!

Issue 2) Blood Lock at 100% health... worst possible use of a turn in the entire game! :) First, they've already failed when they do it without casting virulent, but of course even then it doesn't make sense as it does literally nothing.

Cursed: Passive track + Blindside, they should be able to do this! They should be causing shit-in-your-pants moments as they appear next to you when you least expect it! :)

Doomed/Necromancers/Archer: Solid ranged

Arcane Blades/Sun Paladins: Solid hybrid

Bulwarks/Brawlers/Shadowblades/Marauders: Solid melee's, although I pity the ones that have no other closers that are generated without rush!

Paradox Mages/Temporal Wardens/Oozemancers: Highly sub-optimal, as all these classes have amazing gap closers/openers, that the AI doesn't really utilize. The infinite TP's of the temporal classes (Particularly dimensional step, as it's instant), and Oozewalk/Slime Roots for Oozemancers. Also, TW's should throw up damage smearing way earlier, possibly as first action.


Discussion of Further AI Possibilities

First I have a question for DarkGod or anyone else who can speak to his vision: Is the goal of Tactical AI to be as good as the devs have the energy to make it? Or is it purposefully inefficient in some instances (like mindslayers), so as not to upset people/balance concerns?

If the former, there's a whole bunch of fairly easy things that I can think of to do above and beyond the quick class based recommendations I threw out, and I'd actually be glad to do the coding for some burly AI shenanigans if it's something that's desired but just a low priority/not having the energy kind of situation. AI coding tends to be complicated and kind of a pain in the ass, but it's one of my personal favorites. If the latter... I consider this unfortunate! Would you perhaps be interested in a separate, improved AI above Tactical for use on higher difficulties? Again, I'm willing to do so if there's interest, and here's some of the easier things to do that would have a significant effect:

1) Ranged targeting for things with a travel time. Like the serious tactically minded player, in most instances it's vastly better to actually target a point far beyond your target, so that they still get hit if they just try to move back.

2) Abusing AOE's like players can. Namely, instead of just approaching corners with their face that they know the player is just around (such as just seeing him step that way last turn), blasting an AOE such that it hits a few squares out of LOS. Also just more effective AOE targeting such that it hits the player without friendlies.

3) Effective kiting for the particularly kitey classes. Always trying to stay at max range, and disengaging effectively to let cooldowns reset.

4) Better overall weighing of available skills for maximum effect. For instance, almost without exception from the mobs perspective it should go: Do I have a stun while he's not stun immune? Use stun! Similarly, if aware of the player but out of LOS, could more effectively use recuperative/buffing talents.

SageAcrin
Sher'Tul Godslayer
Posts: 1884
Joined: Tue Apr 10, 2012 6:52 pm

Re: Tactical AI Analyses and Discussion

#2 Post by SageAcrin »

A lot of the AI sight issues came around due to some AI changes in the release candidates.

Which ones are hard to say-the problem is that symmetrical LoS interacting with older AI may cause problems, or it may have been one of the many minor changes to AI, or it may have been one of the fixes to the AI in that time that prevented it from target passing your location worse than a Hunted character and mobbing you with 90% of the map.

Basically, reverting all the way back to the AI pre-1.0 is actually more of a job than it sounds, and may not actually fix the issue without reverting LoS, and the previous AI had some issues like perfectly tracking a teleporting target that aren't desireable to bring back, either.

So basically, a direct revert isn't something I support, due to all of that. It's better to fix up these problems, which aren't too awfully hard. For some reason, tactical AI is trying to kite you despite you not being in its true LoS and this is causing an issue there. Enemies in walls clearly need to randomly get an idea of your general location, with a fuzz radius, every so often, unless they're In Vault. And C is, again, I believe, an element of A-tactical AI for some reason is trying to kite you from the highest range it can attack from, regardless of if there's walls in the way. A couple of fixes that shouldn't be that hard, I'd hope.

For the rares...I think that what needs to be done is that a melee skillset character should always have a melee oriented tactical AI instead of a ranged one. That seems like it wouldn't be too hard to hardcode, though it'd be annoying to make a flexible version of.

For the class stuff...

A: Classes do not consistently get talents out of unlockable skillsets. They probably shouldn't, either, lest you get annoying Archmages that have six unlock categories. Mindslayer has a lot of category point skillsets, and Mobility isn't one that every player consistently unlocks-why should enemies do so?

B: Some classes function off synergy and key skills that require human intelligence to use properly. An Anorithil, for instance, at high levels relies on Corona-a skill that constantly produces energy bolts on critical hits(enemies aren't good at critical hits, and they'd need Blood Red Moon to get a decent crit rate). Said bolts take Positive and Negative, so they'd have to have stored Pos/Neg or else they wouldn't produce the bolts. And with all of that, they still don't have the equipment optimization, even if they used it perfectly(very hard to hardcode!), to really leverage this.

Many of the weaker Rares suffer from this issue. Archmages almost never get fully synergistic sets, because that requires heavy invests in two skillsets, and more-and they'll never be as good as the PC, because they can't pick and choose their Shielding Runes. Nor should they be. That sort. Within that, I think you're worrying too much about the details on many of their inefficiencies(and not fully appreciating how unbelievably hard they'd be if they optimized equipment/skillsets to a PC's levels, even off ego gear. A properly PC-killing Archmage would always Arcane Eye and controlled Teleport after escapees, chasing them down with heavy damage skillsets like Earth/Stone at a high rate and utilizing strong Shielding runes...it would be nearly impossible to deal with if you drew two enemies like that.).

Having said all of that, though, yeah, there are some issues with the AI in areas. Traps/Glyphs landing straight on you is an issue. Some teleports don't have the close-in flag set high enough or at all, presumably, and Stone Wall's AI setting is...goofy. And the AI has to actually turn off sustains to use Spikes, which I'm not sure it really understands why it should be doing.

Some suggestions that might help out the easier stuff...

Dimension Step: Increase Close-In value from 2 to 3(same as Rush, which has no problems here).
Mindhook, Telekinetic Leap, Shattering Charge: Change Close-In value from 2 to 3.
Phase Door: Give a Close-In value of 2 if TL>5. (Should be lower than other closing options because it's not optimal)
Stone Wall: This has five AI settings(with high values on some, like Disable = 4) that, on balance, means it will choose this almost always over any other option, which isn't really great. I'd change this to just Escape = 5, so that any time it's looking to flee, it will almost always use this over other options. Which, for the AI, is smart.
Unstoppable: Has an extremely high AI rigging, actually. The problem is that the AI's smart enough to use Rush over it, because it has a higher Close-In value...then you likely fatally disable or kill the AI afterwards. Using it as a superior close-in doesn't help, though, because that gives you a turn to disable the enemy at range, instead. I'd set this to have its current two factors, along with Escape = 5; This would mean that it's likely to use this as a near death option, if it gets a chance, as well, rather than a less effective escape option. But there's only so much you can do here; Enemy design vs PC design.
Deadly Strikes: Raise the priority to 5, from 2; This should mean they use it a ton whenever in melee range. Not actually sure this is a great thing, though; Rogues do a ton of damage at melee range already. Still...better to be consistent and find a way to balance it, if it's a problem, then to be balanced by rarity and randomly blow people up.
Dirty Fighting: Raise it to 4 Stun/1 Weapon. Still shouldn't be using it much if you can't be stunned.
Ice Wall: This needs to be fixed not to land on you, or to form the wall around targets rather than try to make it through them...regardless, Disable's probably the wrong option and it should be Escape = 3 or something.
Virulent Disease, Epidemic: Should be Disable "disease" = 4 and 3 respectively, probably. As it stands, I think the AI will actually use them against the Disease immune(they just check for Blight element), and won't use them much. Disease is disabling enough vs a Corruptor to be counted.
Slime Roots: Should be Close-In and Escape = 3, not Close-In 2.

On the final notes, remember; Melee classes exist and every single mage kiting from out of LoS gets really annoying, really fast, particularly if they don't do it within the rules-and how do they intelligently use non-radial search skills? Heck, if they don't have insane regens, they can easily run themselves out of resources with those! A human has to use sense to gain those advantages, and enemies have enough advantages without cheating their way to high level human play.

Similarly, I like that the AI has flaws like screwing up targetting to not be perfectly optimal; Leading a target is something that AIs should only do situationally at best, both because it's hard to make an AI that won't screw it up, and because it's improper. The AI has advantages you don't, to compensate for the fact that you are smarter, and trying to make the AI match a player with complicated and finicky to create code isn't really desireable to me, even if it was easy.

I'd also say the AI, outside of its recent mentioned tendency to see through walls in a bad way, has pretty good kiting AI.

For the last, though, the AI does have that weighting, and it's often pretty good about it. If it was 100% consistent, though, you could totally read it every time, which is bad in its own way. "Oh, he'll lead off with a Stun, free counterstrike since his stun move's way less damaging than other options, and I can just heal it off." Leads to some degenerate reading of the AI. It's better to keep the AI unstable, so that people have to react to the situation, rather than making it fully optimal and easy to predict.

grmblfzzz
Thalore
Posts: 133
Joined: Fri Nov 25, 2011 7:53 pm

Re: Tactical AI Analyses and Discussion

#3 Post by grmblfzzz »

SageAcrin, excellent analyses and suggestions overall, and we more or less seem to agree on the important issues. A few things, though:

For the general AI issues (pathing and inappropriate kiting AI's), I'll go ahead and trust you that things were changed overall such that it'd be undesirable to revert the enemy path-finding. It should still definitely be addressed though, as these problems are a huge and likely unintended hindrance to the enemy AI, and are just too open to abuse if you bother being tactical.

For your points on the class specific stuff:
A: Classes do not consistently get talents out of unlockable skillsets. They probably shouldn't, either, lest you get annoying Archmages that have six unlock categories. Mindslayer has a lot of category point skillsets, and Mobility isn't one that every player consistently unlocks-why should enemies do so?
Agreed completely. It's kind of unfortunate for certain classes when they happen to not get critical things like Rush, but that's totally fine. I was mostly pointing out that they don't even try to use some skills effectively (like the mindslayer gap closers) even when they do happen to have them. You basically addressed this with your specific class related suggestions though, so pretty sure we're in agreement here :)
B: Some classes function off synergy and key skills that require human intelligence to use properly. An Anorithil, for instance, at...
Again, I know that you could never really make an AI that was comparable to human intelligence with any remotely reasonable effort. I really just don't know much about Anorithils, so didn't have any specific recommendations, but I get your drift. I'm not even trying to say that any effort needs to be made to try to do so, I was just pointing out some instances where there was flagrant, generally easily fixed inefficiency. This is perfectly understandable, mind you, as AI coding is complicated, and moreover it would have to be updated with every major game change to be current which is obviously a giant pain in the ass, heh.

Anyway, take Archmages. They are of course super inefficient, but they're actually still one of the stronger AI's overall (presumably because they don't have to worry so much about gap closing/positioning). They seem to do fairly well with whatever they're rolled with, with the exception of the stonewall stuff which you addressed.

All of your specific recommendations for changes look pretty good to me, with the exception that you didn't touch on Summoners, and Mindslayers spiking stuff. They are by far the two weakest AI's in proportion to what they could be doing, and those seem like easy enough things to fix. Summoners not summoning until you're in range 5 is just... incredibly silly and inefficient. And for the spikes, it'd probably require some specific attention to make the AI realise how it works and should, it's a huge part of the class and what makes it effective. I also suspect it wouldn't be too hard to do, as I am 100% sure I remember being killed by spiked kinetic aura's from Spire Worms back in the day :)
On the final notes...
Yes, it would be hard to make really significant improvements to the AI, as some of the tactics and targeting would have to be subtle. You'd also have to avoid, as you mentioned, making them unnecessarily predictable while nontheless improving their overall effectiveness. There's still plenty that could be done without risking coming accross that, though, or being a giant pain. For instance, make a check on Corrupter/Reavers use of Blood Lock so that if you're at 100% they choose something else (should probably be more like 70% or so, honestly). Opening with blood lock does not maintain tactical surprise via unpredictability so much as being just a flagrantly inefficient choice :)
Similarly, I like that the AI has flaws like screwing up targetting to not be perfectly optimal...
Lastly, this was basically the whole point of my question at the beginning of the bottom portion of the initial post. I can see not desiring to make the AI super, I just want to know if that's the designers intent. Ideally, I would say, you could pack fancy advanced features into an AI separate from Tactical. One of the fundamental ways that I've learned that we differ, SageAcrin, is that you're not nearly as masochistic as I am! I'd revel in AI's that lead every shot against me, and blasted me around corners/kited me to kingdom come. I just kind of want to know the limits of what the devs think the AI should be able to do, as if they were interested in significant improvements I'd be all over trying to do so.

SageAcrin
Sher'Tul Godslayer
Posts: 1884
Joined: Tue Apr 10, 2012 6:52 pm

Re: Tactical AI Analyses and Discussion

#4 Post by SageAcrin »

Well, I think some classes-like Anorithil and Paradox Mage, two of the weaker rares in general-need some extra categories just to enable more playstyles.

This would, in passing, buff them up for the dumber AI-since some of them would actually get talents they can understand more easily.

As to Summoner and Mindslayer... I didn't touch on them because I don't have good answers there. :)

Mindslayer needs some special AI injunction specifically to actually spike its stuff, while Summoner needs to understand that it can summon things onto its self as well as others, which sounds like it'd need some weird form of AI jury-rigging to get it to understand. Regardless, I don't feel comfortable giving suggestions when I'm not sure what the right answer is-both of those may be far harder than I realize, I just don't really know how difficult it'd be to make the AI do that without bugging out.

Blood Lock's similar; It needs to do a Disable check that somehow checks the target's CHP vs MHP and reacts accordingly for assigning an AI value to it, and while I think that's possible(There's some surprisingly complicated AI checks for when to use something sometimes), I don't know how one would go about it.
One of the fundamental ways that I've learned that we differ, SageAcrin, is that you're not nearly as masochistic as I am!
Heh, that probably is true. I love challenge, but only up to a point. :)

I like to think that makes me good at thinking of ways to improve the game's challenge without it smashing up all of the new players, though. Hopefully. :)

grmblfzzz
Thalore
Posts: 133
Joined: Fri Nov 25, 2011 7:53 pm

Re: Tactical AI Analyses and Discussion

#5 Post by grmblfzzz »

I was messing around with Anorithils, and I'm pretty sure a big reason why their AI is so weak is that they start with 0 pos/neg energy most of the time, and won't be able to intelligently generate it. Particularly the negative energy, which has many of their better spells. I bet one relatively easy way to make them considerably better would be to mess with the energy generating spells priority, or always generate them with the talent that gives them some positive min value by default for it.

As for Paradox mages... I suspect it's largely the crazy nature of the time spells. Temporal Clone can't be used on elites, which includes the player (On normal anyway, but not even sure they can get it). The future self spell, and all the other time manip would probably just break the game if enemies tried to use them (already plenty buggy! :) ). So... just leaves them with some beams, mostly. Not sure much can be done about that.

Kaja Rainbow
Thalore
Posts: 145
Joined: Sun Dec 18, 2011 1:41 pm

Re: Tactical AI Analyses and Discussion

#6 Post by Kaja Rainbow »

I'd also give Dimension Step a high escape value in addition to approach value, if it doesn't have one already. Many mobs won't survive long enough to use it and might not have the cooldown reducing passive anyway, but frequent abuse of 5-cooldown Dimension Step is one of the best features of Chronomancers. And many of Paradox Mages' spells have a radius of 4-6.

Hachem_Muche
Uruivellas
Posts: 744
Joined: Thu Nov 18, 2010 6:42 pm

Re: Tactical AI Analyses and Discussion

#7 Post by Hachem_Muche »

grmblfzzz wrote: Pathing: The biggest general problem with the AI by far, is the horrific path-finding that it has (acquired somewhere near 1.0 if I'm not mistaken). Perhaps some of it was intentional such as not giving mobs map vision/automatically knowing where you are or some-such, or maybe it was intended to make them smarter about showing their faces around corners... but whatever the intent the end result is that the even Tactical AI's are so bad at finding you as to make them more or less helpless with even a little tactical awareness. Some examples:

A) There's a common tendency for mobs that are aware of you to just mill about around corners, out of LoS, but within range of innumerable AOE's you can throw around them. Sadly, The Master is a frequent victim of this. He can just be killed harmlessly with like any AOE most of the time. :(

B) Wall-walkers (Banshees/Dreads/Xorns/etc)... This is really flagrant if you use a track-like ability frequently. They often start/become aware of you, and try to get to you, but just amble about in the walls for hundreds of turns trying to path to you. Posted a pic of a particularly helpless Umber Hulk in the bugs forum a while ago as an example. http://forums.te4.org/viewtopic.php?f=4 ... wallwalker

C) In addition to the milling around when just out of LOS, unable to find you, this behavior is exacerbated by particularly complicated paths. For example, you can make a zigzag tunnel in the walls, and just safely rest although 10+ rares are aware of you and trying to get to you, they'll just never be able to path to you in any reasonable time.
While putting in the scaling code for stealth, I noticed that NPC's were getting terrible estimates for the player's position, often 20+ tiles off in random directions. The problem is that NPC targetting includes an error estimate that increases without limit based on the time since they've had a view of the player. Also, the guess of where the player is changes with each call to the appropriate routines. As a result, the NPC might target one tile with one ability and then another tile (randomly determined within the accumulated error margin) for a second ability, even within the same turn. This applies to movement as well, resulting in Brownian-like motion from turn to turn.
To fix this, I revised the NPC targeting code to keep better track of the player by limiting the error to 10 tiles, have persistent targeting within the same turn, and to average their estimates from turn to turn so that they are (at least statistically) guaranteed to eventually find the player if there is a path.

I have uploaded an addon that includes these changes here:
http://te4.org/games/addons/tome/npc-ta ... provements

I know these changes are effective at eliminating aggressive NPC's wandering around, but I'd like to know how big of an effect it has on other aspects of the AI.
Author of the Infinite 500 and PlenumTooltip addons, and the joys of Scaling in ToME.

grmblfzzz
Thalore
Posts: 133
Joined: Fri Nov 25, 2011 7:53 pm

Re: Tactical AI Analyses and Discussion

#8 Post by grmblfzzz »

@Hachem_Muche: Amazing! That does seem to explain the curious aimlessly wandering behavior. I'll go about play-testing your addon through today and keep a look out for any shenanigans.

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: Tactical AI Analyses and Discussion

#9 Post by jenx »

I'm not sure if this has been discussed, but another major shortcoming of the AI is that mages, corruptors, etc, will typically take a step toward you, sometimes two or even three, even though you are within range of their spells. I notice this a lot playing as a solipsist, where mostly my range is 7. I often thank the AI for stepping toward me, as I can close the gap in 1-2 turns. If it was smarter, it would just start shooting me asap.

btw, where is the ai code, so that I could have a go at tweaking it? How complex is it?
MADNESS rocks

Hachem_Muche
Uruivellas
Posts: 744
Joined: Thu Nov 18, 2010 6:42 pm

Re: Tactical AI Analyses and Discussion

#10 Post by Hachem_Muche »

The AI code is a bit spread out. The basic functions are in engine.interface.ActorAI, and individual AI types are each defined in individual files in mod.ai.

Modifying and testing AI code can be a bit of a complex affair, since the ai definitions also rely on extra code (outside of the ai routines themselves) that manage line of sight, targeting, actor energy, lower level movement routines, and because of the rng-based character of most of the methods.
Author of the Infinite 500 and PlenumTooltip addons, and the joys of Scaling in ToME.

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: Tactical AI Analyses and Discussion

#11 Post by jenx »

Hachem_Muche wrote:The AI code is a bit spread out. The basic functions are in engine.interface.ActorAI, and individual AI types are each defined in individual files in mod.ai.

Modifying and testing AI code can be a bit of a complex affair, since the ai definitions also rely on extra code (outside of the ai routines themselves) that manage line of sight, targeting, actor energy, lower level movement routines, and because of the rng-based character of most of the methods.
the main code seems to be in tactical.lua, where options for action are assessed and ranked, for example, if an actor wants/needs stamina:

Code: Select all

		-- Need stamina
		if avail.stamina then
			want.stamina = 0
			local stamina = 100 * self.stamina / self.max_stamina
			if stamina < 20 then want.stamina = want.stamina + 4
			elseif stamina < 30 then want.stamina = want.stamina + 3
			elseif stamina < 40 then want.stamina = want.stamina + 2
			elseif stamina < 60 then want.stamina = want.stamina + 2
			elseif stamina < 80 then want.stamina = want.stamina + 1
			elseif stamina < 100 then want.stamina = want.stamina + 0.5
			end
		end
The problem is, this and many others are using percentages. But at lvl 50, 30% stamina goes a lot further than at lvl 10. So this section of the code could be improved by more complex evaluation of wants and needs.

I can also see in here how various types of actions are weighed and then chosen. I'm going to play around with these numbers and see what happens!!!!
MADNESS rocks

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: Tactical AI Analyses and Discussion

#12 Post by jenx »

ok - I've been studying this more.

Most npcs use the dumb ai, and boy, is it dumb. For example, an orc archer typically has two talents, shoot and reload. It just randomly chooses one or the other !

So I think improving dumb ai, in talented.lua, would be a good first place to start, rather than tactical.lua.

What would it mean though if the dumb ai was not so dumb?
MADNESS rocks

Zireael
Archmage
Posts: 449
Joined: Tue Jun 18, 2013 7:24 pm

Re: Tactical AI Analyses and Discussion

#13 Post by Zireael »

jenx wrote:ok - I've been studying this more.

Most npcs use the dumb ai, and boy, is it dumb. For example, an orc archer typically has two talents, shoot and reload. It just randomly chooses one or the other !

So I think improving dumb ai, in talented.lua, would be a good first place to start, rather than tactical.lua.

What would it mean though if the dumb ai was not so dumb?
For me, it would mean a better game :)

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: Tactical AI Analyses and Discussion

#14 Post by jenx »

Ok - I've made a simple addon and tried it out. Lots of interesting gameplay changes.

New topic here: http://forums.te4.org/viewtopic.php?f=36&t=38707
MADNESS rocks

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: Tactical AI Analyses and Discussion

#15 Post by jenx »

Hachem_Muche wrote:
grmblfzzz wrote: Pathing: The biggest general problem with the AI by far, is the horrific path-finding that it has (acquired somewhere near 1.0 if I'm not mistaken). Perhaps some of it was intentional such as not giving mobs map vision/automatically knowing where you are or some-such, or maybe it was intended to make them smarter about showing their faces around corners... but whatever the intent the end result is that the even Tactical AI's are so bad at finding you as to make them more or less helpless with even a little tactical awareness. Some examples:

A) There's a common tendency for mobs that are aware of you to just mill about around corners, out of LoS, but within range of innumerable AOE's you can throw around them. Sadly, The Master is a frequent victim of this. He can just be killed harmlessly with like any AOE most of the time. :(

B) Wall-walkers (Banshees/Dreads/Xorns/etc)... This is really flagrant if you use a track-like ability frequently. They often start/become aware of you, and try to get to you, but just amble about in the walls for hundreds of turns trying to path to you. Posted a pic of a particularly helpless Umber Hulk in the bugs forum a while ago as an example. http://forums.te4.org/viewtopic.php?f=4 ... wallwalker

C) In addition to the milling around when just out of LOS, unable to find you, this behavior is exacerbated by particularly complicated paths. For example, you can make a zigzag tunnel in the walls, and just safely rest although 10+ rares are aware of you and trying to get to you, they'll just never be able to path to you in any reasonable time.

While putting in the scaling code for stealth, I noticed that NPC's were getting terrible estimates for the player's position, often 20+ tiles off in random directions. The problem is that NPC targetting includes an error estimate that increases without limit based on the time since they've had a view of the player. Also, the guess of where the player is changes with each call to the appropriate routines. As a result, the NPC might target one tile with one ability and then another tile (randomly determined within the accumulated error margin) for a second ability, even within the same turn. This applies to movement as well, resulting in Brownian-like motion from turn to turn.
To fix this, I revised the NPC targeting code to keep better track of the player by limiting the error to 10 tiles, have persistent targeting within the same turn, and to average their estimates from turn to turn so that they are (at least statistically) guaranteed to eventually find the player if there is a path.

I have uploaded an addon that includes these changes here:
http://te4.org/games/addons/tome/npc-ta ... provements

I know these changes are effective at eliminating aggressive NPC's wandering around, but I'd like to know how big of an effect it has on other aspects of the AI.
This addon generates endless lua errors:

Code: Select all

error = "Lua Error: .../addons/NPCTarget/superload/engine/interface/ActorAI.lua:39: attempt to call method 'clearAITarget' (a nil value)\
  At [C]:-1 clearAITarget\
  At .../addons/NPCTarget/superload/engine/interface/ActorAI.lua:39 doAI\
  At /mod/class/NPC.lua:61 act\
  At /engine/GameEnergyBased.lua:126 tickLevel\
  At /engine/GameEnergyBased.lua:62 tick\
  At /engine/GameTurnBased.lua:46 tick\
  At /mod/class/Game.lua:1054 "
seen = true
reported = true
MADNESS rocks

Post Reply