Post by kalbaern on Sept 30, 2019 17:57:11 GMT -5
I get a lot of comments here, both good and bad, about how our Creature AIs are both great and frustrating at times. While I won't go into lengthy details that list all of the calculations made combat rounds and why or why not a creature selects you as their primary target, I will offer a few insights on how our AIs work and possible tactics to use while playing here. Of course, if you are just out adventuring alone, with no summons or other followers, targeting is a moot point ... "Tag, you're it".
Below, "Party" refers to any group you are in even if out "soloing". Summons, familiars, companions and other "followers" are a part of your "Party".
NPCs prepare for battle, often before you see them:
As your party closes in on a hostile spawn, several things begin to happen even before you can see them.
1 - Hostile Casters will buff with select spells/protections in preparation for the coming fight. They do not usually employ ever possible buffing spell though, just a few basics. If you wonder why, it's because just like adventurers, IE "you", they either know a threat is near (damned clanky meatshields) or they wake up, buff up, then go have breakfast because being a goblin/orc/zhent wizard is dangerous business and you never go out unprepared. It's a short list of "buffs" they employ initially. If they didn't, then hostile casters would be too easy of a target for most players. You can still "round the corner running" and catch most casters still not fully prepared, but their initial buffs often buy them a few precious seconds to finish preparing and make them more challenging.
2 - Hostile creatures will equip and ready their weapons if they were issued randomly. Creatures spawning in with missile weapons are given a command to use the weapon until out of ammunition or forced into melee combat. Those lacking a missile weapon will equip their melee weapon(s) and a shield if they have one and are not using a two-handed weapon. Though it's rare, some of our NPCs can dual wield melee weapons and more are in the works.
3 - Hostile creatures will begin to randomly wander or spread out. Wandering adds to the challenge here. Sometimes NPCs will move towards each other, sometimes they'll spread out. If no combat has begun, they'll randomly speak or emote "things" that you might "overhear".
NPCs choose their initial targets:
As your party moves into range of hostile NPCs, perception checks are made by them to determine if you can actually be seen or heard. If either case is true, combat rounds begin. If you're a sneaky character and remain undetected, NPCs will continue their random wandering and emoting.
1 - When two or more of your party are seen/heard and the distance between the detected party members and the hostile NPCs is roughly close, the party member with the highest "CR" (creature difficulty rating) will be the likely target of attacks. If two or more party members have near equal CRs, then who is targeted is random. CR values assigned to party members are not exacting. They calculate a threat number based not just on class(es) and level(s), but on "buffs", equipped weapons and armors and other things. EX: If "Gilbert" and "Meg" are both 10th level Dwarven Fighters, but Gilbert only has unenchanted weapons and armor and Meg has a +2 Large Shield and a +1 Axe, Meg more often than not is the higher threat for the hostile NPCs to target initially. If later, Gilbert quaffs a potion of mage armor, barkskin, bull's strength and endurance, he might find the next few encounters with foes charging at him first instead.
2 - Hostile magic users will now begin to either cast additional protections or cast offensive spells. Most NPC casters consider what they'll do based on their distance to hostile targets, spells available and other things. If a caster can employ an offensive spell at long range, this is often their first choice. If party members are within closer ranges, they may instead cast more buffs if they have them available.
NPC targeting during active combat:
Once combat has begun, additional checks are made both during each round and at the end of each round (a round is roughly 6 seconds in length and why party members and hostile NPCs with few attacks per round seem to fight slowly). NPCs will evaluate targets based on several things. Who hit them (damage from weapons or spells), how hard were they hit (how much damage they took), is a party member casting buffs or healing others and lastly ... who hit them last. Unlike most AIs whether the default Bioware ones or other packages made over the years, our AIs check each time a spell is cast, damage is taken, an attack is made (even if you swing and miss) just like they do .... they just don't change a creature's target as often.
As an example: Normally, every time a creature takes damage in NWN, their AIs make the damager their new target. This often results in "ping ponging" of the NPC from one target to the other, often resulting in them missing chances to actually attack. On many PWs, a pair of elves with bows and rapid shot can cause a foe to run back and forth between them until finally the creature dies a blood soaked pin cushion. Here, while each time a creature is damaged fires an "event", whether or not they actually act on it is random. So while two or more archers can at times create a "ping pong" effect, often it fails instead and the creature remains focused on its current target. This keeps things a little more realistic and challenging.
"But, but ... I was in the back and they kept running past others to get to me!":
Your over all CR and actions caused this. If you are of a significantly higher level than others in your party, you could very well become a target just based on that along with your proximity to others fighting. The chance is lower, but it can happen. If you are behind a handful of party members in melee and you are trying to stand back and use a missile weapon, every attack attempted and damaging hit landed adds to the chance a creature will target you instead. Because "who hit me last" is part of the equations, party members using things like rapid shot of whirlwind or flurry of blows and cleave have more chances to become a hostile NPC's target.
Wait! So you're just a squishy mage and are just plinking away with a mere two attacks per round with a ranged weapon? Though lower, there is still a small chance the hostile NPCs will decide you are annoying them and attempt to break off and get to you. Oh! You buffed your arrows with flame weapon? Now the NPCs see you as a higher threat because of the extra damage taken when you do manage to hit one. It doesn't mean a pair of orcs will now ignore the meatshield's they are facing, but ... it has increased the odds that they just might.
NPCs that learn from their mistakes:
OK, they don't actually "learn". They do stop doing things that they fail at though. NPCs here are scripted to actually use combat feats and skills. When they use them and they fail to succeed, then each failure makes them less and less prone to attempt it again and try a new tactic. IE, if an NPC attempts a knock down attack and succeeds, they are more likely to try it again when you get back up. Conversely, if the NPC fails, they are less likely to try it again. If they attempt a knockdown more than once, each attempt that fails adds to the chance they'll give up and just straight up fight ... OR ... use another tactic instead. If they have points in Taunt, they may attempt that now. If they succeed with their taunt, they might again try a knockdown or just fight. What our NPCs rarely do though is keep doing something that they just can't succeed at. This also applies at times to them trying and failing miserably. An example would be an NPC who tries to knock you down and fails. If your character's discipline is high enough that the NPC can only succeed if he tries again and crits or your opposed roll is a critical failure, they'll switch tactics just like most players do.
NPCs that mimic Players:
I can always tell when someone hasn't put effort into the little details, especially when designing NPCs. On many PWs, putting 10 or so skill points in Hide and Move Silently means you can slip past even many epic NPCs. Not here. We've striven to use creature bonuses and skill allotments as per any number of PnP sources. Bugbears, goblins and kobolds along with various bandits and rogues are often decent sneaks here. Orcs and gnolls have decent spot, listen and discipline skill points and can often spot a sneak who hasn't maxed out their hide/move silently skills or brush off knock down attempts.. Giants due to their size and spiders due to having eight legs to stand on are hard and all but impossible to knock down here. Creatures that have character classes added to themselves will have matching feats and skill adjustments using guidelines from the DMG and various MMs. Whenever NWN is unable to meet one or more source stats, we do fudge a little. In a few cases, NPCs here are nerfed from what is found in source materials. A good example is no devastating critical feat for creatures here. Sure, improved critical and other things still apply, but if we disallow it for players then NPCs can't do it either.
Often times combat is so quickly finished that the NPCs didn't get a chance to show off some of their tricks. When they do though, it's usually a "Wow!" moment. NPC clerics, depending on their spell selections will at times heal an ally or even raise/resurrect them in the midst of a battle. NPC wizard types will often cast buffs on nearby allies after they've finished buffing themselves. If an NPC wizard's 4th level summons is dispatched and he has the choice of a 3rd level summons or a fireball, he'll lean towards casting the fireball since you so easily killed a tougher summons already. Its these kind of little "logic switches" that are a part of our AIs that makes them better than most.
Below, "Party" refers to any group you are in even if out "soloing". Summons, familiars, companions and other "followers" are a part of your "Party".
NPCs prepare for battle, often before you see them:
As your party closes in on a hostile spawn, several things begin to happen even before you can see them.
1 - Hostile Casters will buff with select spells/protections in preparation for the coming fight. They do not usually employ ever possible buffing spell though, just a few basics. If you wonder why, it's because just like adventurers, IE "you", they either know a threat is near (damned clanky meatshields) or they wake up, buff up, then go have breakfast because being a goblin/orc/zhent wizard is dangerous business and you never go out unprepared. It's a short list of "buffs" they employ initially. If they didn't, then hostile casters would be too easy of a target for most players. You can still "round the corner running" and catch most casters still not fully prepared, but their initial buffs often buy them a few precious seconds to finish preparing and make them more challenging.
2 - Hostile creatures will equip and ready their weapons if they were issued randomly. Creatures spawning in with missile weapons are given a command to use the weapon until out of ammunition or forced into melee combat. Those lacking a missile weapon will equip their melee weapon(s) and a shield if they have one and are not using a two-handed weapon. Though it's rare, some of our NPCs can dual wield melee weapons and more are in the works.
3 - Hostile creatures will begin to randomly wander or spread out. Wandering adds to the challenge here. Sometimes NPCs will move towards each other, sometimes they'll spread out. If no combat has begun, they'll randomly speak or emote "things" that you might "overhear".
NPCs choose their initial targets:
As your party moves into range of hostile NPCs, perception checks are made by them to determine if you can actually be seen or heard. If either case is true, combat rounds begin. If you're a sneaky character and remain undetected, NPCs will continue their random wandering and emoting.
1 - When two or more of your party are seen/heard and the distance between the detected party members and the hostile NPCs is roughly close, the party member with the highest "CR" (creature difficulty rating) will be the likely target of attacks. If two or more party members have near equal CRs, then who is targeted is random. CR values assigned to party members are not exacting. They calculate a threat number based not just on class(es) and level(s), but on "buffs", equipped weapons and armors and other things. EX: If "Gilbert" and "Meg" are both 10th level Dwarven Fighters, but Gilbert only has unenchanted weapons and armor and Meg has a +2 Large Shield and a +1 Axe, Meg more often than not is the higher threat for the hostile NPCs to target initially. If later, Gilbert quaffs a potion of mage armor, barkskin, bull's strength and endurance, he might find the next few encounters with foes charging at him first instead.
2 - Hostile magic users will now begin to either cast additional protections or cast offensive spells. Most NPC casters consider what they'll do based on their distance to hostile targets, spells available and other things. If a caster can employ an offensive spell at long range, this is often their first choice. If party members are within closer ranges, they may instead cast more buffs if they have them available.
NPC targeting during active combat:
Once combat has begun, additional checks are made both during each round and at the end of each round (a round is roughly 6 seconds in length and why party members and hostile NPCs with few attacks per round seem to fight slowly). NPCs will evaluate targets based on several things. Who hit them (damage from weapons or spells), how hard were they hit (how much damage they took), is a party member casting buffs or healing others and lastly ... who hit them last. Unlike most AIs whether the default Bioware ones or other packages made over the years, our AIs check each time a spell is cast, damage is taken, an attack is made (even if you swing and miss) just like they do .... they just don't change a creature's target as often.
As an example: Normally, every time a creature takes damage in NWN, their AIs make the damager their new target. This often results in "ping ponging" of the NPC from one target to the other, often resulting in them missing chances to actually attack. On many PWs, a pair of elves with bows and rapid shot can cause a foe to run back and forth between them until finally the creature dies a blood soaked pin cushion. Here, while each time a creature is damaged fires an "event", whether or not they actually act on it is random. So while two or more archers can at times create a "ping pong" effect, often it fails instead and the creature remains focused on its current target. This keeps things a little more realistic and challenging.
"But, but ... I was in the back and they kept running past others to get to me!":
Your over all CR and actions caused this. If you are of a significantly higher level than others in your party, you could very well become a target just based on that along with your proximity to others fighting. The chance is lower, but it can happen. If you are behind a handful of party members in melee and you are trying to stand back and use a missile weapon, every attack attempted and damaging hit landed adds to the chance a creature will target you instead. Because "who hit me last" is part of the equations, party members using things like rapid shot of whirlwind or flurry of blows and cleave have more chances to become a hostile NPC's target.
Wait! So you're just a squishy mage and are just plinking away with a mere two attacks per round with a ranged weapon? Though lower, there is still a small chance the hostile NPCs will decide you are annoying them and attempt to break off and get to you. Oh! You buffed your arrows with flame weapon? Now the NPCs see you as a higher threat because of the extra damage taken when you do manage to hit one. It doesn't mean a pair of orcs will now ignore the meatshield's they are facing, but ... it has increased the odds that they just might.
NPCs that learn from their mistakes:
OK, they don't actually "learn". They do stop doing things that they fail at though. NPCs here are scripted to actually use combat feats and skills. When they use them and they fail to succeed, then each failure makes them less and less prone to attempt it again and try a new tactic. IE, if an NPC attempts a knock down attack and succeeds, they are more likely to try it again when you get back up. Conversely, if the NPC fails, they are less likely to try it again. If they attempt a knockdown more than once, each attempt that fails adds to the chance they'll give up and just straight up fight ... OR ... use another tactic instead. If they have points in Taunt, they may attempt that now. If they succeed with their taunt, they might again try a knockdown or just fight. What our NPCs rarely do though is keep doing something that they just can't succeed at. This also applies at times to them trying and failing miserably. An example would be an NPC who tries to knock you down and fails. If your character's discipline is high enough that the NPC can only succeed if he tries again and crits or your opposed roll is a critical failure, they'll switch tactics just like most players do.
NPCs that mimic Players:
I can always tell when someone hasn't put effort into the little details, especially when designing NPCs. On many PWs, putting 10 or so skill points in Hide and Move Silently means you can slip past even many epic NPCs. Not here. We've striven to use creature bonuses and skill allotments as per any number of PnP sources. Bugbears, goblins and kobolds along with various bandits and rogues are often decent sneaks here. Orcs and gnolls have decent spot, listen and discipline skill points and can often spot a sneak who hasn't maxed out their hide/move silently skills or brush off knock down attempts.. Giants due to their size and spiders due to having eight legs to stand on are hard and all but impossible to knock down here. Creatures that have character classes added to themselves will have matching feats and skill adjustments using guidelines from the DMG and various MMs. Whenever NWN is unable to meet one or more source stats, we do fudge a little. In a few cases, NPCs here are nerfed from what is found in source materials. A good example is no devastating critical feat for creatures here. Sure, improved critical and other things still apply, but if we disallow it for players then NPCs can't do it either.
Often times combat is so quickly finished that the NPCs didn't get a chance to show off some of their tricks. When they do though, it's usually a "Wow!" moment. NPC clerics, depending on their spell selections will at times heal an ally or even raise/resurrect them in the midst of a battle. NPC wizard types will often cast buffs on nearby allies after they've finished buffing themselves. If an NPC wizard's 4th level summons is dispatched and he has the choice of a 3rd level summons or a fireball, he'll lean towards casting the fireball since you so easily killed a tougher summons already. Its these kind of little "logic switches" that are a part of our AIs that makes them better than most.