PDA

View Full Version : AI thoughts


Bhruic
11-09-2012, 06:37 PM
Going to start off with a request - if we could please discuss this without blame or attacks, that would be appreciated.

With that said, I'm curious as to get people's feedback on the current state of the game's combat AI. As an example, I'm going to use the Soothsayer's "Loki's Touch" ability - the ability that allows them to "enrage" an enemy stack. There are other equally illustrative examples, but this one will suffice.

First, an analysis of how that currently works in the game: The unit that gets enraged is considered by all enemy units to be a hostile unit. So not only will the unit that receives this ability attack previously friendly units, those same units will actively attack it as well. Furthermore, units seem to prioritize attacking that unit over attacking your own units. Now, if the same ability is used on a unit in your army, I believe that most players would agree that they would not actually attack their unit that got hit with the ability. Indeed, they would likely do their best to minimize the damage that the unit both takes and inflicts.

The question, then, becomes, "Should the AI behave in a similar fashion?" There are two ways to approach the question. The first is from a humanistic point of view - do we want the AI to try and behave as a human would behave? Humans are capable of coming up with lots of creative ways to handle situations that the AI will never be capable of, but in situations like this, it certainly can approach the situation from the same viewpoint. And that viewpoint would simply be "try and minimize the damage of the situation". The AI won't be as good as you or I would be at it, but it definitely could be better.

The second viewpoint would be from a gameplay perspective. And that would simply state that the whole point of having such an ability is to cause problems like that for the AI. The skill as a whole would be substantially weaker if all the AI units completely ignored the enraged unit and went about attacking your units as usual. The AI shouldn't react as a human would react because that removes a great deal of the power of such abilities.

Personally, I'm rather on the fence between the two arguments, as I can see the appeal of both. So I'm trying to get feedback on what people believe the AI should do in this or similar situations.

Again, please keep answers constructive and on-topic. Posts such as "The AI just sucks" aren't going to be helpful.

Thanks!

Loopy
11-09-2012, 07:43 PM
The game is basically based around making the AI not behave the same. Certain abilities (like target, or anything that uses runes) simply don't work for enemy units or against player units. Others would require a lot of in-depth thought to use.

The way things work now is that enemy units aren't being commanded by an overall AI, but instead work individually. This makes sense in that all of your non-hero battles wouldn't be against coordinated enemy forces, and non-coordinated enemy forces wouldn't understand the extent of your powers, thinking that the units you used Loki's Touch on were permanently mind controlled or defected or w/e. So in this respect I don't think it's unrealistic that it causes a lot of chaos and interfighting when you use Loki's Touch, that's how a smaller force in supposed to defeat a much larger one.

It would be really cool if there were two different AIs, with a special, stronger one for Hero vs. Hero combat. Normal fights would be you vs. an uncoordinated but much bigger horde and Hero fights being you vs a similar opponent with similar skills.

Zechnophobe
11-09-2012, 08:53 PM
First, I want to point out that predictable AI is actually a big part of what makes this game fun. Think of fights that involve more chaotic things such as heros with big single target nukes, or 'dispel'. These fights are generally less fun. I think having consistent AI will generally be for the best.

Second, the Ai behavior effects the quality of certain abilities. In KBAP, most enemies would avoid Mystic Eggs in favor of real units, making the spell particularly strong. If enemies prioritized it, it would be much weaker. We cannot evaluate AI behavior solely on what 'makes sense' for the unit, as much as how balanced it makes all abilities.

Another good example of that, is that in previous games, ranged units would occasionally not move and then shoot, to deal more damage with less risk. They'd just randomly decide to melee. This behavior made them a lot weaker than they otherwise could be.

Karlos
11-09-2012, 09:13 PM
I see it differently than Zechnophobe, for me the more unpredictable the AI is - in any game - the more fun it is. And I guess that's sort of a holy grail for videogame developers - to make the AI as close to a human behavior as possible. Whenever you see or read a review criticizing the AI it's almost always because it's too predictable.

So for me it'd be awesome if enemy units behaved as closely to a human player as possible. I.e. they wouldn't attack enraged stacks let alone prioritize them, AI dragons, archdemons, inquisitors and some others would behave more intelligently, enemy heroes would cast Target (then all other stacks would be greyed out for your lower level units) and so on.

Zechnophobe
11-09-2012, 09:45 PM
I see it differently than Zechnophobe, for me the more unpredictable the AI is - in any game - the more fun it is. And I guess that's sort of a holy grail for videogame developers - to make the AI as close to a human behavior as possible. Whenever you see or read a review criticizing the AI it's almost always because it's too predictable.

So for me it'd be awesome if enemy units behaved as closely to a human player as possible. I.e. they wouldn't attack enraged stacks let alone prioritize them, AI dragons, archdemons, inquisitors and some others would behave more intelligently, enemy heroes would cast Target (then all other stacks would be greyed out for your lower level units) and so on.

Except what you described is completely predictable behavior. If they never attack enraged stacks, that's predictable. What's unpredictable is if they SOMETIMES attack enraged stacks. Being intelligent is not the opposite of being predictable.

People only think they want unpredictable AI's. What they really want, is more intuitive, predictable, AI's.

Loopy
11-09-2012, 10:05 PM
The OP never said anything about the predictableness of the AI, only about the intelligence. They aren't one and the same. That said...

Any intelligent opponent must be predictable. The idea that unpredictableness = intelligence is the complete opposite of reality. Intelligence implies a plan of action and a plan of action implies predictability.

Disabling spells like Target, Fear, Sheep would be painfully unfun for players if enemy heroes actually utilized them to 100% efficiency. A lot of things would need a lot of balance changes if that were the case. The game would literally be impossible fighting a powerful mage hero with a non-mage otherwise.

Bhruic
11-09-2012, 10:57 PM
The OP never said anything about the predictableness of the AI, only about the intelligence. They aren't one and the same.

It's not necessarily about intelligence, per se, it's about what would make an AI "better". And by "better", I mean conform to what the player is looking for in an AI. I mean, it's nice that you could completely disrupt the enemy ranks by hitting them with Loki's Touch, but does that make for better combat? Is it preferrable that that happen? What about the AI's targeting of things like the Ice Spikes from Lord of the North? If the AI doesn't target them, they become somewhat worthless - unless you luck into one blocking the AI's path - but if they do target them, the AI tends to spend turns attacking them rather than moving towards your army to attack it. And suchforth.

Basically, do people prefer having spells and abilities that allow them to semi-exploit the AI's poor decision making, or would that make combat more difficult than they are hoping for?

camelotcrusade
11-10-2012, 03:45 AM
Interesting discussion here.

Personally, I think learning to exploit the AI is a large part of what a strategy game like KB is all about. Since the troop and spells are somewhat random or in limited supply, I find myself re-inventing or adjusting my tried-and-true methods several times each game. I like that about KB a lot and I appreciate that my experience learning the AI sticks with me even as my circumstances change.

tiberiu
11-10-2012, 05:29 AM
The question, then, becomes, "Should the AI behave in a similar fashion?" There are two ways to approach the question. The first is from a humanistic point of view - do we want the AI to try and behave as a human would behave?

It's not important to behave as human. It's important to have good performance, i.e, if it can be done to be even better then a human, perfect! I am 100% sure this can be done with king's bounty AI, because all that takes place on the battlefield is just mathematics.

Humans are capable of coming up with lots of creative ways to handle situations that the AI will never be capable of,

There was a time in history, not long ago, like 10 years or so, when few people dared to consider that there will come a time when a Chess AI would outclass the human worldchampion by 500 elo points. 500! this means being better by 25% ! A human worldchampion has 2800 elo performance. Houdini 1.5a and Houdini 2 currently play at 3300 elo performance. :D

Chess is more complex then a KB battle so to create a powerful AI of KB is walk in the park compared to making Grandmaster skill chess engine.. If this were to be done, you would enter the battle knowing that the AI will inflict the maximum damage on your units that it can possibly be done. (the results would vary a bit because of the element of chance in the game, of course)

The second viewpoint would be from a gameplay perspective. And that would simply state that the whole point of having such an ability is to cause problems like that for the AI. The skill as a whole would be substantially weaker if all the AI units completely ignored the enraged unit and went about attacking your units as usual. The AI shouldn't react as a human would react because that removes a great deal of the power of such abilities.

My viewpoint about this second viewpoint is that it's dumb. Basically, the motivation of it is " I want an easy game don't take away overpowered abilities and don't make AI smarter". Simply wrong.

Again, please keep answers constructive and on-topic. Posts such as "The AI just sucks" aren't going to be helpful.Thanks!

Ok, I won't say that the AI sucks, even if it does, but I don't see how saying that would be off topic or unhelpful. The road to progress is paved by heavy criticism. Those who praise everything rarely make the world a better place.

Bhruic
11-10-2012, 05:47 AM
Chess is more complex then a KB battle so to create a powerful AI of KB is walk in the park compared to making Grandmaster skill chess engine.

Chess is a much less complex game than KB - by far. In Chess, you are limited to 16 pieces total per side, with only 6 distinct movement methods. In KB, there are dozens of unit types, many having unique attack settings. You have dozens of spells that can be cast be either side. You have rage powers that can be used. You've got variable map types rather than a static 8x8 board. The sheer numerical variance of options makes any Chess-style brute force approach impossibly complex. And that's assuming you were willing to wait the amount of time it takes to calculate a move in Chess that's off-book.

There's no chance we'll see an AI that's anywhere near as good as you can get in a Chess program any time in the next decade - minimum.

My viewpoint about this second viewpoint is that it's dumb. Basically, the motivation of it is " I want an easy game don't take away overpowered abilities and don't make AI smarter". Simply wrong.

"Overpowered" as a concept is entirely subjective. The issue isn't whether abilities are too powerful, it's how the AI should react. Or, rather, an alternate way of looking at it is what tools the player should have to handle the AI. Using the Loki's Touch example, certainly it would be easy to make the AI not target the unit that got hit with the ability. And there's no doubt that would make AI armies more potent. But so would doubling all their army sizes. So would giving them all initiative bonuses. So would giving them all double attack/defense ratings.

What it comes down to is whether the AI is being overly hampered by the abilities, or whether they strike a decent balance, and give the player decent options for dealing with the AI.

[quote\Ok, I won't say that the AI sucks, even if it does, but I don't see how saying that would be off topic or unhelpful. The road to progress is paved by heavy criticism. Those who praise everything rarely make the world a better place.[/QUOTE]

It's unhelpful because it's not constructive. You are welcome to say the AI sucks as long as you say why you think it sucks, and what would make it suck less.

tiberiu
11-10-2012, 08:57 AM
Chess is a much less complex game than KB - by far.

You're kidding, right? :)
Take note I said "battle" not game. Given that KB is single player, the AI wouldn't need to compose his army because it is pre-set. He would just need to choose the best action for his moves. Your assertion about complexity and time necessary for a competent AI is improbable, given that in KB often you only need to calculate 5-10 plies or less ahead and in chess 10-20 sometimes more. Also computers now are capable of playing GM level only in seconds. It is much more easy to determine the outcome of an action in KB then in chess, partly because there are less total actions available during a complete turn. We have the player with only 5 units instead of 16 at start, usually it is not hard to determine what is the best spell to be cast, the same with rage skills. What's required is basic pruning which is currently replaced by seed-based randomness.

Remember KB is single player. A good AI wouldn't need care about hero's spells or abilities, only about his own actions.

Take for example the average battle at start of game. The 40 enemy skeleton archers should only know that they have no chance of killing 1 Soothsayer before the battle ends, so it would be pointless to attack it. However, attacking the Slingers would result in 1 Slinger dying, which automatically becomes the best move.

At the moment, the AI is so weak that it often attacks where it doesn't do any damage to the player's forces.

AI should :
- differentiate between summons and real units. (he doesn't)
- use talents much logically, (for example all units with Running waste the ability on turn 1 needlessly, also 1 stack of 1000 necromancers should not cast Plague instead of attacking)
- attack where it hurts. A golden rule is to attack where you deal most damage. If you attack a stone skinned Ghost, in effect, you waste 1 turn.

PS. Some people already use chess engines to create smarter AI for games. A good example is eternal essence AI project mod for Heroes of Might and Magic 5 which uses Fritz Chess Engine to calculate Ai's move. I have seen here what a chess engine can do to a game AI and it's just ... beautiful.

Bhruic
11-10-2012, 05:11 PM
Take note I said "battle" not game. Given that KB is single player, the AI wouldn't need to compose his army because it is pre-set. He would just need to choose the best action for his moves. Your assertion about complexity and time necessary for a competent AI is improbable, given that in KB often you only need to calculate 5-10 plies or less ahead and in chess 10-20 sometimes more.

Without trying to be offensive, it's obvious you don't understand how coding an AI works. Your attempt at a distinction between "game" and "battle" is irrelevant, unless you are going to try and make an AI that only works in a single fight. Yes, each individual army is set ahead of time, but the composition of armies and the number of battles to be fought brings a level of complexity that Chess doesn't even come close to.

Remember KB is single player. A good AI wouldn't need care about hero's spells or abilities, only about his own actions.

That'd be as silly as me saying that a Chess AI doesn't have to care about what moves the other player makes, just its own moves. Of course the AI has to care about the here's spells and abilities, because the use of those abilities can greatly alter what options it has available. If, for example, the hero casts the "Target" spell on one of his units, the behaviour of the AI changes drastically.

AI should :
- differentiate between summons and real units. (he doesn't)
- use talents much logically, (for example all units with Running waste the ability on turn 1 needlessly, also 1 stack of 1000 necromancers should not cast Plague instead of attacking)
- attack where it hurts. A golden rule is to attack where you deal most damage. If you attack a stone skinned Ghost, in effect, you waste 1 turn.

Ok, now this is the sort of suggestions I was looking for. So let's go through them.

1) If the AI differentiates between summoned and real units, does that not make summoned units irrelevant? What is the point of having the ability to summon units if the AI is going to ignore them?

2) How do you determine what is a logical use of their talents? Running on the first turn, for example, doesn't it make sense to try and close on the enemy as fast as possible to try and limit the number of turns they can hit you with ranged units?

3) How do you determine what "most damage" is? The AI already does a decent job of trying to close on wearker/ranged units to prioritize them over melee, what beyond that should they do? Are you suggesting they should spend a turn not attacking to try and get closer to a weaker unit rather than spending that turn attacking a stronger one?