Question about AI Quality

The new Heroes games produced by Ubisoft. Please specify which game you are referring to in your post.
User avatar
Humakt
Swordsman
Swordsman
Posts: 582
Joined: 06 Jan 2006

Unread postby Humakt » 15 Dec 2006, 02:07

If human player loses his main army in multiplayer, he or she usually concedes provided opponent didn't take heavy casualties as well. If AI loses his main army, he doesn't have that option. So of course it has to play very defensively afterwards (practically its already lost), without help it can't recover to complete. That was true with H3 as well, after major battle, rest was usually cleaning up. There's little to do with it, it is nature of the game.
Khelavaster wrote: See, that's unacceptable in my book. If a game requires that for me then it's unplayable (which HOMM IV was). Again this makes me understand more why you're so happy with HOMM V (whose AI is, for all its faults, a lot better than IV).

Khel.
H4 AI is not totally useless. It just needs "little" promotion and it could kick anyone's butt. It certainly has done so to me, though in my own maps mostly. I've currently been playtesting my latest map with AI players as test dolls, they seem to do ok with bonuses I've given to them.

Actually H4 AI could have been best of the series if it hadn't been so buggy in Adventure map, if it had good picking priorities (like which to take first) and it's skill selection wouldn't been so random (like in earlier heroes as well). I agree, that stamenet does contain lots of "if"'s. But hey, that happens when publisher (3DO) rushes things-> AI takes the major hit.

Khelavaster
Peasant
Peasant
Posts: 80
Joined: 06 Jan 2006

Unread postby Khelavaster » 15 Dec 2006, 02:38

Yes, it's good to remember that both HOMM IV and V shipped in a conspicuously unfinished state.

But I still don't see what you're basing on to say that HOMM IV's AI could've been the best of the series. Do check, if you haven't already, the post Elvin links to. It's entirely consistent with my experiences.

Someone should *really* do something like that with HOMM V... too bad they added the black curtain in the computer's turn, you know, for "strategy".

Khel.

User avatar
Jolly Joker
Round Table Hero
Round Table Hero
Posts: 3316
Joined: 06 Jan 2006

Unread postby Jolly Joker » 15 Dec 2006, 09:16

This is going to be a somewhat longer post.

The topic here is the H 5 AI (and maybe even any other HoMM AI as well). Many are not satisfied with H 5, but are with H 3. I think that people make the mistake to think you'd have to set up an AI the way a human player would play, so it might be a good idea to have a look at the AI the way you'd do it, when you would develop it.

1) The main and most important thing (and in H 5 this is even more true than in the HoMMs before because of the duel mode) is the way the AI behaves on the battlefield. Neutral behavior is important, but army behavior when fighting an opposing hero is the main thing here (I think for obvious reasons: if someone disagrees here we can bring them up).

Can the AI be allowed to "cheat" on the battlefield? For me the answer would be a clear NO, for certain reasons: since in the end the fights are the culmination points of any game, MP or SP, those fights should adhere to the same rules, always and no matter the difficulty; creatures should have the same stats and so on, hero skills and abilities should have the same effect, otherwise there was no way to compare things which would spoil the fun massively.

All Heroes games have been reasonably good here with the exception of Heroes 3 which was the biggest setback of the game, imo. The battles with everything else than pre-defined heroes were lame. Beating way better heroes that have way larger armies shouldn't be possible but is and was in H 3.

2) The "adventure" AI. Here it is important to realize that the goal for programming that cannot be to make the AI behave like a human. That would accomplish nothing. If you play on high or the highest difficulty level the aim is to produce opponents that will be a SERIOUS CHALLENGE ON EVERY KIND OF MAP AND AT ANY TIME (on day 2 just as well as on day 9 and day 87. The first obvious thing here is the fact that this is not possible, if you bother the AI with the same resource problems than the human player. The second thing to realize here as easily (mistake Nival, corrected in the meantime) is, you cannot give the AI money and resources completely without considering the map. You may set up a very resource poor map with only 3 mines or so and it would be folly to give the AI resources no matter what.
The next thing is that defense is always easier to do than attack.
The most basic AI would be one with a good battle behaviour that would get resources somehow, would get experience for the hero somehow would build its town up, would buy the creatures and keep always in one day-march vicinity of its town to retreat to it asap when a human comes.
In Heroes this kind of AI would fail miserably, due to 2 facts: a) the human could play undisturbed as long as he liked and pick a point of attack which would make things boring, b) on any map with more than one town for each player the AI had no chance anyway.

This means, a defensive AI is not enough. The game needs a more aggressive AI.

And that's exactly where it becomes interesting and difficult. Keep in mind that our AI must work on EVERY kind of map, so we must define goals.

I think we have already established, that if the AI is to be a challenge we cannot bother it with the same reource problems than a human. building should be easier for the AI to allow for less than optimal play; for the same reason it makes sense for the AI to see the whole map. If it does it can base its "considerations" on facts rather than "ifs" which is a big help and solves a problem: you cannot have the AI roam the countryside, getting artifacts, flagging mines and so on - and losing its town to a bold human player who catches it pants down. So for the AI roaming around is possible only with an eye on other heroes and how near they are. However, since you don't want the AI to paralyze themselves in a game with lots of AI players the heroes in question here are only those of the human players.

So here some strategy is forming already:
You need a way for the AI to handle neutral stacks effectively. If it was me I would handle it the way it in some kind of quick combat, but deduct a percentage of the creatures the higher the diff level. If there were 20 Hunters, on Heroic the AI would get the experience for them, but would have to quick-fight against 10 (or so) only.
If you have that way you can let a main hero roam around flagging, picking, making experience, conquering neutral towns and so on, all with an eye on defending its town, if humans are near. (Bevavior of AI against each others would have to be done separately).
Send scout(s) to the human player which is a good disruptive tactic. Be prepared to intercept human scouts as well, which means sort of having a second hero with SOME troops in town always to intercept "minor" threats.

However, there has to be some control check with the victory condition. You cannot have the AI roam the countryside and build a large army that could conquer a world when the victory condition is beating a stack of bold Sprites which wasp-swarm the vicinity and have to be eliminated (and this is something the H IV AI doesn't seem to have been able to). The AI has to check each turn whether it can try to start fulfilling victory conditions. That means, it must be able to identify conditional chains: VC is "CAPTURE TOWN"; to get there you have to find 4 keys in 4 tents and fulfill 2 quests. The AI must build something like a chain of small VCs and check whether it can fulfill them - all with an eye on human and other players.

Now this looks now like we have to redefine or goals, does it? When you play as a human you want to win. Does the AI want to win as well? At this point I think that it is very clear that the answer is no. The AI doesn't want to win, the AI's task is to make winning difficult for the human (and in some cases even impossible). Keep in mind that the AI has to be a challenge on every kind of map with every kind of VC and finding the best strategy to WIN may be a hell of a lot more difficult to find a working strategy to thwart the human. A very complex set of conditions to be fulfilled may not be managable for the AI as fast as a human could do it, and where would then be the challenge?

Because, thinking about it a few seconds, the best way to thwart a human is going after their (main) heroes, because, as a rule, no matter the VC you need a hero to win.

At this point I think that we come very close to the way the AI is set up in H 5, I think.

This is a long post and I have one thing to ask. If you answer to this, don't do it the way that you pick half a sentence or two and come up with a, "no, not so". If you find something you can't agree with, try to show an alternative way or something.

Khelavaster
Peasant
Peasant
Posts: 80
Joined: 06 Jan 2006

Unread postby Khelavaster » 15 Dec 2006, 09:45

No, not so.

(Just kidding.)

All the speculation about victory conditions chains is good and dandy, but the question remains as to why HOMM V's AI does such a bad job compared to the first three installments at acting competently (i.e., human-like) and STILL needs to cheat. At least HOMM IV had the excuse of sporting a completely new system for creature movement and army composition.

User avatar
DaemianLucifer
Round Table Hero
Round Table Hero
Posts: 11282
Joined: 06 Jan 2006
Location: City 17

Unread postby DaemianLucifer » 15 Dec 2006, 10:25

Jolly Joker wrote: The topic here is the H 5 AI (and maybe even any other HoMM AI as well). Many are not satisfied with H 5, but are with H 3.
Jolly Joker wrote:
Actually,thats not right.Many are not satisfied with HV AI,but were satisfied with HIII AI.The key word is were.Sure,its extremelly substandard now,but when it came out it was excelent.You simply cannot compare the AIs of games that are 10 years apart.And the fact that people are still playing a game that has an outdated AI says a lot about the game.
All Heroes games have been reasonably good here with the exception of Heroes 3 which was the biggest setback of the game, imo. The battles with everything else than pre-defined heroes were lame. Beating way better heroes that have way larger armies shouldn't be possible but is and was in H 3.
HIV had much worse AI.I managed to kill an army with 800 blackies,while I had just cca 200 bone dragons(and some other troops were involved on both sides).I also managed to kill an army of 400 bone dragons,400 devils and 400 dark champions using just two 20 level heroes.

And here is an extremelly simple function that significantly can improve HV AI:

If (my hero is level 10+) and (my opponents average damage before my next action>than my creatures total hit points) then retreat.Not that hard to script,aint it?

User avatar
Jolly Joker
Round Table Hero
Round Table Hero
Posts: 3316
Joined: 06 Jan 2006

Unread postby Jolly Joker » 15 Dec 2006, 11:04

DaemianLucifer wrote:
And here is an extremelly simple function that significantly can improve HV AI:

If (my hero is level 10+) and (my opponents average damage before my next action>than my creatures total hit points) then retreat.Not that hard to script,aint it?
But that would clearly be wrong. Example: If Myhero has 7 very small stacks (left) with 7x HP, while opponent has one stack that will act next and do more than 7x damage (albeit only to one of the stacks). In this case you would retreat even though there would be no need (your level 10+ hero might get in and be able to kill the remaining stack with a spell).

In that case everyone and their dog would complain about the inapt AI that choose to retreat even though the hero would have won the fight with his next action.

It's not all that easy.

User avatar
DaemianLucifer
Round Table Hero
Round Table Hero
Posts: 11282
Joined: 06 Jan 2006
Location: City 17

Unread postby DaemianLucifer » 15 Dec 2006, 11:16

Jolly Joker wrote: But that would clearly be wrong. Example: If Myhero has 7 very small stacks (left) with 7x HP, while opponent has one stack that will act next and do more than 7x damage (albeit only to one of the stacks). In this case you would retreat even though there would be no need (your level 10+ hero might get in and be able to kill the remaining stack with a spell).
Yes,it would be so hard to write a failsafe for this case.Oh woe is me for not realising that,how will I ever forgive myself? :rolleyes:

User avatar
Humakt
Swordsman
Swordsman
Posts: 582
Joined: 06 Jan 2006

Unread postby Humakt » 15 Dec 2006, 21:53

DaemianLucifer wrote: And here is an extremelly simple function that significantly can improve HV AI:

If (my hero is level 10+) and (my opponents average damage before my next action>than my creatures total hit points) then retreat.Not that hard to script,aint it?
Yeah, right. Whatever you say.

First that little script you made doesn't count or determine the possibility of reducing the enemy with YOUR current action before they have action, which could possibly mean they lack brawn to finish you off after YOUR action. You could Reanimate/Resurrect to increase hitpoints. It doesn't determine or count the distance the troop has to travel, that damage might not even reach you yet. It doesn't determine damage type (ranged or melee), doesn't count hero's spellpoints or keep track of what spells they've already cast. Like JJ said, total hitpoints is very vague, it might/will be divided into more than 1 slots, making killing them all harder. Average damage has to calculate defense and offense stats of hero and the troop, and the spells effecting that creature. Besides Maximum damage is way safer method than average.

I'm pretty sure I left stuff out of it.
Yes,it would be so hard to write a failsafe for this case.Oh woe is me for not realising that,how will I ever forgive myself?
You can keep on writing those failsafes.

User avatar
DaemianLucifer
Round Table Hero
Round Table Hero
Posts: 11282
Joined: 06 Jan 2006
Location: City 17

Unread postby DaemianLucifer » 16 Dec 2006, 01:04

Humakt wrote: Yeah, right. Whatever you say.

First that little script you made doesn't count or determine the possibility of reducing the enemy with YOUR current action before they have action, which could possibly mean they lack brawn to finish you off after YOUR action. You could Reanimate/Resurrect to increase hitpoints. It doesn't determine or count the distance the troop has to travel, that damage might not even reach you yet. It doesn't determine damage type (ranged or melee), doesn't count hero's spellpoints or keep track of what spells they've already cast. Like JJ said, total hitpoints is very vague, it might/will be divided into more than 1 slots, making killing them all harder. Average damage has to calculate defense and offense stats of hero and the troop, and the spells effecting that creature. Besides Maximum damage is way safer method than average.
Oh forgive my unconstrictiveness!I simply should admit that they did as uperb job and that its simply impossible to improve AI in any other way than by giving it free stuff :rolleyes:

User avatar
Shauku
Pixie
Pixie
Posts: 149
Joined: 15 Jul 2006
Location: Finland

Unread postby Shauku » 16 Dec 2006, 02:26

DL is right here. The AI doesn't have to get perfect in retreating immidiately (not even human is, there are always surprises when you prolong the battle..), but it can be improved. The best way simply isn't that it NEVER retreats.

So no need to make scripts for entirely all situations, but some general outlines can be made. The average damage can be one. Another is the relation of the AI army to the Human one. Seriously what does he intend to do with those 7 WarDancers against my 12 Deep Hydras?

User avatar
Alamar
Golem
Golem
Posts: 605
Joined: 06 Jan 2006

Unread postby Alamar » 16 Dec 2006, 04:54

Jolly Joker wrote:This is a long post and I have one thing to ask. If you answer to this, don't do it the way that you pick half a sentence or two and come up with a, "no, not so". If you find something you can't agree with, try to show an alternative way or something.
I was actually going to pick apart your post but out of respect I will try to respond to the spirit of your post instead of the individual points.

First lets start with what I consider to be THE core principal of developing an AI for a game: The AI should be an enjoyable opponnent on as large a variety of different conditions as possible. It is this core premise that should drive the design and implementation of the AI.

The key question is how do you define "an enjoyable opponnent"??? This is an inherently subjective issue so 5 reasonable people would likely give you 5 answers for this. My particular definition would be:

1. The AI provides a reasonable challenge to me... I.E. if I don't play reasonably well I should lose. However if I play "perfectly" I should win. Ideally the level of challenge should be easily configurable [like difficulty levels]. Also the AI should provide a reasonable challenge on as wide a variety of starting conditions / scenarios as possible [like maps].

2. The game experience, whether the opponnent is human or AI, should be as similar as is reasonably possible.

3. The AI should not give me excuses to be upset with its behaviour.

For me if an AI can hit the 3 above points I would call it a "great" AI.

Now how would I go about developing the AI????

IMHO the only way to achieve all 3 points would be to TRY to teach the AI [as best as possible] how to actually play the game on its own following all of the rules. The 2 primary areas that I'd concentrate on are:

A. Setting goals, prioritizing goals, and ordering those goals so you complete them quickly while having as little "cost" as possible. [Basic Adventure AI stuff]

B. Battle AI -- Because you can't do anything without having to fight in HoMM. Also to give the human a good contest you want to fight as well as possible against them AND also fight as well as possible against nuetrals to preserve your army strength.

Unfortunately I believe that the above 2 things [Battle AI && Plan making] are such hard problems that other things such as Castle Build Order, Hero Skill picking, etc. will only receive minimal attention even though they are obviously important. Fortunately these items are comparatively easy problems ....

--------------------------------------------------------------------------------

At this point in the process you will hopefully have a reasonable competent battle AI and adventure AI. Both will complement each other.

I have very few illusions though that any static AI that I craft will be competitive without bonuses of some sort against a good human opponnent.

What my job though is to come up with a set of bonuses that will result in an enjoyably competitive match without destroying the game experience or giving me excuses to feel cheesed-off at the AI.

[Note: I am not counting letting the AI see the whole map as a cheat per-se ..... I just don't believe that you can develope an AI that can compete with a human that's played a map before without letting it see everything .... Also note that because it sees everything it doesn't HAVE to act on it ....]

Because I didn't pay much attention to hero skill building one of the first cheats that I may do is to make sure that AI controlled heroes are allowed to PICK the skills they want / need instead of getting a random selection presented to them. This will insure that heroes are strong in all stages of the game [early, mid, late]. Also as long as I follow the rules of skill / perk prereqs it is not easy for an human to tell the difference between an AI created hero on one made by a good [but lucky] human.

Any economic bonuses that would be given would never be in the form of any lump sum [I.E. day 1 bonus] but would need to be small ongoing bonuses so that they would not overly affect the game experience [I.E. no human could generate something like that so quickly].

Other bonuses, amounts of bonuses, etc. would have to be refined through a lot of gameplay and testing.

As a final step once you have the base difficulties [newb through impossible] figured out you also should have a "custom" game setting which will allow the player to control a large variety of sliders to control fascets of AI behaviour to their liking.

If you have questions on how I would handle anything specific then please let me know.

-------------------------------------------------------------------------------

Now onto the problems that not adhering to these goals has given us with the current AI.

First the AI in no possible way emulates the experience that you get when playing a human. The graph of their army power vs. time in game is nothing like you'd see from a human.

Second the AI is not a good opponnent on a wide variety of maps -- esp. low resource maps. With the AI getting an effective 9-1 resource bonus on heroic difficulty maps means that if you intend all players to be poor then the only player that is really hurt is the human player ..... Note that on heroic the AI has enough money to totally build thier castle without ever having to send a hero out at all ....

Third AI behaviour [in terms of bonuses esp.] is not configurable enough. It seems obvious to me [possibly only me] that no one system will please everyone. So it makes sense to allow people to create a set of behaviours, bonuses, whatever that suits them and will allow them to enjoy the game as much as possible.

Fourth the AI gives me plenty of reasons to feel ripped off or that it's dumb. The resource bonuses contribute to this greatly. Mediocre adventure map management doesn't help when you finally invade the AI territory to see that it hasn't even fully secured its own borders.

User avatar
Mytical
Round Table Knight
Round Table Knight
Posts: 3780
Joined: 07 Aug 2006
Location: Mytical's Dimension

Unread postby Mytical » 16 Dec 2006, 05:41

How to develop a challenging AI without resorting to current level of cheating. Ok everybody else is weighing in on this subject so I will give my take.

Somebody mentioned the set skill tree. This is the first way to help make an AI that would be challenging. It gets about double the %chance (or more) for the more useful skills for a faction. Something like destruction for haven would only rarely rarely come up. If destruction % chance is 2% for human players, it would be about .25% chance for an AI player.

2nd primary stats. For AI heroes increase the chance for primary and secondary stats to increase (even both at the same time) by a small percent. If attack is 40% for human controlled haven, have it 45% for AI controlled haven, and also a 5% extra chance that 2 stats will increase instead of 1.

Agressiveness-increase AI agressiveness except in certain map conditions. (IE you have to defeat a certain town, the ai defends that town agressively more, and only when that town is in no jeopardy does it advance). If a certain hero is the target, and that hero is blocked off from most of the map, make sure that the script lets the human know that each set period of time he will recieve x ammount of reinforcements.

Battlefield AI should target the most dangerous stack in a given situation. Regardless if it is ranged/flyers in castle seiges or those 100 paladins in an open field, the AI should be able to recognize the biggest threat mathimatically and seek to limit or end the threat (box those paladins in so they can not get charge bonus, stop archers ranged attacks with other units, ect). It is a matter of mathmatical deduction, which is within the capability of the computer.

World AI should also use the knowledge of the areas that the human may not have to it's advantage. Send that lone scout out to flag the mines the human has by a back trail that the human may not even know exsists, set up ambushes, ect. Don't tell me this is not possible, there are plenty of game AI's that do just that.

One biggy is it should not fall for the bait and run tactic. If you have a town that it can destroy and a hero with a single unit, it should not chase that hero until the town is able to produce enough to destroy it on an open field. Prioritize towns over heros. After all without towns, the heroes are finished anyhow.

If the AI absolutely needs a boost then have its towns with a few buildings built at the beginning. Have some of the resource generators already flagged at the start. Thus it gets those resources, but if a human captures those resources they no longer get them. Even starting them with every resource flagged would be more acceptable then now.

Even if the AI can not complete certain objectives it should still play to win. One instant win for the AI is if the hero's armies is defeated, so it should focus on that (in cases where it knows it can not win in any other way).
Warning, may cause confusion, blindness, raising of eybrows, and insanity. Image

User avatar
Caradoc
Round Table Knight
Round Table Knight
Posts: 1780
Joined: 06 Jan 2006
Location: Marble Falls Texas

Unread postby Caradoc » 16 Dec 2006, 06:21

This discussion has become much more interesting as it has gone along. Would that it were always so.

For both the battlefield and adventure AI, the key is a good position evaluation engine which can provide direction to the goal setting algorithms. It is probably impractical to look-ahead more than one turn, so there also needs to be a process for setting and balancing strategic objectives.

For instance, an early-game objective is developing the starting castle. The algorithm for a give type would set the buildings to be constructed at each level and potential moves would take into account the resource requirements for those builds. Or the exploration algorithm would identify barriers to expansion and potential moves would aim to prepare the AI player to overcome them. This could be to find a Key or to assemble an army capable of overcoming a neutral blocker.

A simple but effective combat algorithm is to weigh the likely outcome of each potential attack and undertake the one with the best payoff for the odds. When no such attack exists, moves and defense measures would be considered.
Before you criticize someone, first walk a mile in their shoes. If they get mad, you'll be a mile away. And you'll have their shoes.

User avatar
Humakt
Swordsman
Swordsman
Posts: 582
Joined: 06 Jan 2006

Unread postby Humakt » 16 Dec 2006, 09:08

DaemianLucifer wrote: Oh forgive my unconstrictiveness!I simply should admit that they did as uperb job and that its simply impossible to improve AI in any other way than by giving it free stuff :rolleyes:
I'm not stating that. Of course, it would be GOOD thing if they improve the AI (and that is the thing I've heard they're actually trying to do?). But coming with incorrect bold claims and then snapbacking with sarcastic comments as above, is not helping any cause.

Khelavaster
Peasant
Peasant
Posts: 80
Joined: 06 Jan 2006

Unread postby Khelavaster » 16 Dec 2006, 12:18

Humakt wrote: (and that is the thing I've heard they're actually trying to do?)
What? When? How?? :-D

User avatar
Alamar
Golem
Golem
Posts: 605
Joined: 06 Jan 2006

Unread postby Alamar » 16 Dec 2006, 13:47

Khelavaster wrote:
Humakt wrote: (and that is the thing I've heard they're actually trying to do?)
What? When? How?? :-D
I for one don't want to "rush" Nival / Ubi.

If they are working on improvements, even if they are just tweaks, then great. The more improvements I see the more stuff I buy to reward them for [trying] to give me what I want. [Plus I want to play around with magmazilla[

Anyway anything more than superficial AI tweaks will take a LONG time to do properly so I wouldn't expect any results soon.

User avatar
Jolly Joker
Round Table Hero
Round Table Hero
Posts: 3316
Joined: 06 Jan 2006

Unread postby Jolly Joker » 16 Dec 2006, 14:24

This is all nice and well, but I read only the things the AI SHOULD be able to or do, but not HOW. I think we can safely forget the battle AI here and concentrate on the adventure AI. I’m furthermore against preset hero development because that would make opposing heroes too predictable, would really be an advantage if a human could hire a beaten AI hero and would lead ultimately to giving them the fitting spells for their abilities as well. I think that it is not necessary to actually direct hero development with one exception: there should simply be some check algorithm to make sure the heroes never fall behind a certain ratio of skill/ability picking.

Specifically reading Alamar’s post, I think he is definitely wrong when he says the goal should be to teach the AI to play the game like a human would. The reason for that is simply, that the goal of the AI is NOT winning ( at least not always; I thought that was clear now); the goal of the AI is making things difficult for the human player(s).

Let's try another way and check with a map in mind what task the AI (designer) is facing. Let's try the Heroic difficulty (the best the AI can do) and let's check the following rather simple Victory Conditions:
1) Find the Tear of Asha (and build it in any town) OR Beat all Opponents
2) Find the Tear of Asha (and build it in any town)
Let's further say that finding the Tear of Asha would involve visiting a fair number of monoliths all over the map with the Tear being somewhere on any one of 4 smaller islands in the middle of the map.

From a human point of view the first VC means that you don’t necessarily have to find the Tear of Asha if and when you can make sure that no opponent finds it (before you) or if so said opponent finds no town to build it in (perfectly possible that a player finds the Tear but will be beaten and has no town anymore to retreat to). The second VC means, that it’s actually a race and something like a draw would be possible (if the above mentioned would happen). That’s why the goal is a lot more straightforward.

As a human you’d probably do things the following way: you’d try to hire extra scouts to get to know as much of the map as possible AND you would try to visit at least one Monolith as soon as possible to get an idea of how many monoliths are there and to have the first hint where the Tear might be buried. Clearly, your strategy will depend on what you uncover there.

Finding the Tear of Asha is on the other hand no problem for the AI because the AI „knows“ where the Tear is buried AND knos the map. So here the AI must be „kept reasonably in check“. From a human point of view, finding the Tear of Asha is connected: a) with scouting out as much land as possible, and b) visiting as many monoliths as possible. A) is clearly more important, because even if you visited all monoliths you may not be able to dig if you have not uncovered the place, while one monolith may enough to start digging when you have uncovered enough or even all of the map to identify the region.

So on goal 2 it’s actually an easy job for the AI. Apart from doing the obvious it has to send out Scouts (note that this is in contradiction to the number of Heroes hired as listed in the diff levels); furthermore it has to visit monoliths. As soon as the AI would have scouted out the region of the puzzle map there could be probability checks for each monolith uncovered in the past and from then on, whether the AI would be allowed to start digging in the vicinity of the grail. with the probability getting better with each monolith uncovered.

However, there are opponents. There is a town to manage. There are troops needed to fight the guards of the monoliths and of crossroads for more scouting. There may be troops needed to defend the home town. The Tear not only must be dug out it must safely brought home. And so on. Which is a problem specifically under VC 1.

That means as a conclusion, actually NOT making a grab for the Tear of Asha might be much more easy to program in a challenging way. After scouting and identifying the region of the tear you’d program the AI to attack the human player once THE HUMAN tries to make a grab for it. An attack on the digging hero OR onto the town(s) of the hero would indeed make things challenging. The AI would NOT try to win the game (thus NOT play the game of the human) but it would appear in the most unfortunate moment to attack the player. IF (and that’s a big IF in my book) IF the AI has scouted out things.

Additionally you could allow the AI to try and go for the Tear, if it qualified to try digging and no one was in the vicinity.

However, I think that all of this shows that you cannot try to program the AI the way a human would play the game.

User avatar
DaemianLucifer
Round Table Hero
Round Table Hero
Posts: 11282
Joined: 06 Jan 2006
Location: City 17

Unread postby DaemianLucifer » 16 Dec 2006, 15:08

I disagree with you JJ.We all know that AI is a machine and will always follow a preset pattern,thus always will be outsmarted by a human,no matter how wll its been built(untill the true artificial intelegence is constructed,that is),so its primary goal should be winning.But it would never achieve this goal against a human.

As for skill tree,make the skills appear random,but make preset paths for each race that AI will try to follow,and those paths would differ only by the skills that are offered to it.For example:You make destruction as top priority for a warlock,but the hero gets offered leadership and luck on level two,luck and siege on level three,leadership and light on level 4,and sorcery and destruction on level 5.Such a warlock would get destruction on level 5 and no sooner.

As for dig the tear VC,you could simply put in a failsafe that AI has to visit 90%/75%/55%/30% of all the obilisks on the map(depending on difficulty level)before it can start digging.

User avatar
Alamar
Golem
Golem
Posts: 605
Joined: 06 Jan 2006

Unread postby Alamar » 16 Dec 2006, 15:34

Jolly Joker wrote:This is all nice and well, but I read only the things the AI SHOULD be able to or do, but not HOW.
Could you be a little more specific in what you mean by "how"? Do you need to see a SPECIFIC algorithm, source code, or what?
I’m furthermore against preset hero development because that would make opposing heroes too predictable, would really be an advantage if a human could hire a beaten AI hero and would lead ultimately to giving them the fitting spells for their abilities as well.
May I ask why you see predictability as an issue? Could you elaborate on that please?

IMHO with multiple scripts allowed per hero [say 3-5] you would not see too much of a predictability problem. Why? Assuming you play with random heroes you'll have about 10 different heroes to choose from. With 3-5 different hero builds you'd have to play at least 30-50 games before you saw each pattern. Before you saw patterns repeat you'd have to play 60-100 games [probably much more!] before you'd notice the pattern per-se. By the time heroes became "predictable & boring" you're looking at [realistically] 200 games minimum!! [assuming use of random heroes]

Also, because I as a human tend to develope a given hero almost identically every time I play, why is it a problem if the AI does this? Why not use a system that will dramatically increase hero power thus leading to better fights & more competition with a human?

If you are worried about a human hiring a well-built AI hero that they could actually use then I don't see that as an AI problem .... I see that as a game design issue. Note your issue is just as large of an issue whether the AI develops a good hero who is defeated then hired vs. a human developing the good hero who is then defeated then hired.

[Sarcasm warning] Lord forbid we have AI heroes with good skills and abilities that match their spells fairly well. Lord forbid that we fix one of the BIGGEST AI problems that the HoMM series has had.[Sarcasm over]
I think that it is not necessary to actually direct hero development with one exception: there should simply be some check algorithm to make sure the heroes never fall behind a certain ratio of skill/ability picking.
If you are not going to "direct" hero growth then you had better do an infinitely better job of picking Skills & Abilities than what we have now. It's time that AI Delebs are developed without the ballista skill, Necros with only basic light magic, Wizards with no spell schools at all, etc. to end.

Specifically reading Alamar’s post, I think he is definitely wrong when he says the goal should be to teach the AI to play the game like a human would. The reason for that is simply, that the goal of the AI is NOT winning ( at least not always; I thought that was clear now); the goal of the AI is making things difficult for the human player(s).
We clearly disagree on the purpose of an AI. To state it again the CORE principal is to develope an AI that is a "fun opponnent to play with" for a wide variety of players, with a wide variety of skills, on a wide variety of scenarios / maps.

Are you in any way saying that the above core value is wrong? If so then please explain why the goal of the AI should be "a fun opponnent"?

If you agree with the core principal then which of my specific goals based on that core value to you disagree with and why?

1. The AI should be competitive for a wide variety of players in a wide variety of scenarios.

2. The game experience, whether playing AI or human, should be as similar as possible.

3. The AI should not give us [I.E. players with many differing sensibilities] reasons to be upset with its behaviour.

Based on the above why is TRYING to teach the AI to play by the rules [not necessarily play like a human] a bad thing?
Let's try another way and check with a map in mind what task the AI (designer) is facing. Let's try the Heroic difficulty (the best the AI can do) and let's check the following rather simple Victory Conditions:
1) Find the Tear of Asha (and build it in any town) OR Beat all Opponents
2) Find the Tear of Asha (and build it in any town)
Let's further say that finding the Tear of Asha would involve visiting a fair number of monoliths all over the map with the Tear being somewhere on any one of 4 smaller islands in the middle of the map.

From a human point of view the first VC means that you don’t necessarily have to find the Tear of Asha if and when you can make sure that no opponent finds it (before you) or if so said opponent finds no town to build it in (perfectly possible that a player finds the Tear but will be beaten and has no town anymore to retreat to). The second VC means, that it’s actually a race and something like a draw would be possible (if the above mentioned would happen). That’s why the goal is a lot more straightforward.

As a human you’d probably do things the following way: you’d try to hire extra scouts to get to know as much of the map as possible AND you would try to visit at least one Monolith as soon as possible to get an idea of how many monoliths are there and to have the first hint where the Tear might be buried. Clearly, your strategy will depend on what you uncover there.

Finding the Tear of Asha is on the other hand no problem for the AI because the AI „knows“ where the Tear is buried AND knos the map. So here the AI must be „kept reasonably in check“. From a human point of view, finding the Tear of Asha is connected: a) with scouting out as much land as possible, and b) visiting as many monoliths as possible. A) is clearly more important, because even if you visited all monoliths you may not be able to dig if you have not uncovered the place, while one monolith may enough to start digging when you have uncovered enough or even all of the map to identify the region.

So on goal 2 it’s actually an easy job for the AI. Apart from doing the obvious it has to send out Scouts (note that this is in contradiction to the number of Heroes hired as listed in the diff levels); furthermore it has to visit monoliths. As soon as the AI would have scouted out the region of the puzzle map there could be probability checks for each monolith uncovered in the past and from then on, whether the AI would be allowed to start digging in the vicinity of the grail. with the probability getting better with each monolith uncovered.

However, there are opponents. There is a town to manage. There are troops needed to fight the guards of the monoliths and of crossroads for more scouting. There may be troops needed to defend the home town. The Tear not only must be dug out it must safely brought home. And so on. Which is a problem specifically under VC 1.

That means as a conclusion, actually NOT making a grab for the Tear of Asha might be much more easy to program in a challenging way. After scouting and identifying the region of the tear you’d program the AI to attack the human player once THE HUMAN tries to make a grab for it. An attack on the digging hero OR onto the town(s) of the hero would indeed make things challenging. The AI would NOT try to win the game (thus NOT play the game of the human) but it would appear in the most unfortunate moment to attack the player. IF (and that’s a big IF in my book) IF the AI has scouted out things.

Additionally you could allow the AI to try and go for the Tear, if it qualified to try digging and no one was in the vicinity.

However, I think that all of this shows that you cannot try to program the AI the way a human would play the game.
Your example is nice but what exactly is your point and what in my examples would lead one to believe that I am necessarily [totally] against what you're proposing?

Remember my CORE VALUE when designing the AI is to create an opponnent that is as fun as possible for as many people as possible on as many maps as possible.

In my examples I clearly say the goals based on my core value is for the AI to be competitive, to make the game experience to be as similar as possible to playing a human, and not to give the players reason to be mad at the AI. These 3 things need to be balanced [duh] each with their own set of priorities.

Basically I'm saying that if it would "cheese off" players that the AI instantly knows where the grail is and wins on day 9 every time then obviously I need to take safeguards to keep that from happenning. Therefore having the AI concentrate on make sure nobody else gets the grail [like defending monoliths in their territory so the human has a harder time finding the grail] may be a reasonable objective.

Remember JJ ... everything is about striking just the right balance to maintain FUN at all costs.

User avatar
Jolly Joker
Round Table Hero
Round Table Hero
Posts: 3316
Joined: 06 Jan 2006

Unread postby Jolly Joker » 16 Dec 2006, 16:53

Alamar wrote: Could you be a little more specific in what you mean by "how"? Do you need to see a SPECIFIC algorithm, source code, or what?
I just mean some basic considerations about how the AI should act in practise, the way I did.

Alamar wrote: May I ask why you see predictability as an issue? Could you elaborate on that please?
IMHO with multiple scripts allowed per hero [say 3-5] you would not see too much of a predictability problem. Why? Assuming you play with random heroes you'll have about 10 different heroes to choose from. With 3-5 different hero builds you'd have to play at least 30-50 games before you saw each pattern. Before you saw patterns repeat you'd have to play 60-100 games [probably much more!] before you'd notice the pattern per-se. By the time heroes became "predictable & boring" you're looking at [realistically] 200 games minimum!! [assuming use of random heroes]

Also, because I as a human tend to develope a given hero almost identically every time I play, why is it a problem if the AI does this? Why not use a system that will dramatically increase hero power thus leading to better fights & more competition with a human?

If you are worried about a human hiring a well-built AI hero that they could actually use then I don't see that as an AI problem .... I see that as a game design issue. Note your issue is just as large of an issue whether the AI develops a good hero who is defeated then hired vs. a human developing the good hero who is then defeated then hired.

[Sarcasm warning] Lord forbid we have AI heroes with good skills and abilities that match their spells fairly well. Lord forbid that we fix one of the BIGGEST AI problems that the HoMM series has had.[Sarcasm over]
I simply don't think it's necessary. If you look at a Warlock for example and the skill probabilities then the heroes should develop well most of the time IF the correct abilities are taken for the skills picked. Since I don't think that in battle AI against neutrals things are considered like whether the AI has Tactics or not (and I don't think it should be considered it's not necessary to pre-define hero development at all. I actually think it's against the spirit of the game because it's highly map-dependable what skills are the best set, really (Navigation, and Estates are examples for abilities that might be of use or may never be of use for the AI). The only thing that I somehow would like to make sure is that IF the AI has a magic skill it should get the abilities that fit to their spells as well.
The probabilities SHOULD do an adequate job now.
Alamar wrote: We clearly disagree on the purpose of an AI. To state it again the CORE principal is to develope an AI that is a "fun opponnent to play with" for a wide variety of players, with a wide variety of skills, on a wide variety of scenarios / maps.

Are you in any way saying that the above core value is wrong? If so then please explain why the goal of the AI should be "a fun opponnent"?

If you agree with the core principal then which of my specific goals based on that core value to you disagree with and why?

1. The AI should be competitive for a wide variety of players in a wide variety of scenarios.

2. The game experience, whether playing AI or human, should be as similar as possible.

3. The AI should not give us [I.E. players with many differing sensibilities] reasons to be upset with its behaviour.

Based on the above why is TRYING to teach the AI to play by the rules [not necessarily play like a human] a bad thing?
I disagree with point 1. IMO, the AI should be competetive NO MATTER MAP OR PLAYER OR VICTORY CONDITION.
Point 2 is something I CLEARLY disagree with, simply because it is in direct contradiction to point 1. The AI cannot copy human behaviour in any way that would make it competetive. A lot of human playing is simply intuitive. That's why I gave the big example.
A human will ALWAYS want to win and will make a plan of what is necessary to do so. That's basically not possible for the AI: it may have an agenda, but it cannot make a plan based on what is necessary to win except in the most basic cases. It's a lot easier for the AI to make a plan on what is necessary NOT TO LOSE most of the time which is one hell of a difference. For example, on simple maps with more than one AI playing to win would involve killing each opponent - which might make things very easy for the human. Playing not to lose does NOT involve going after other AIs, but is clearly not the way a human would play.
Point 3 is phrased so wide that I can't agree with it either. Upset? Depends on what people upsets. It's basically impossible to please everyone and no matter how you do things there will alyways people that are upset about something.
Alamar wrote: Your example is nice but what exactly is your point and what in my examples would lead one to believe that I am necessarily [totally] against what you're proposing?

Remember my CORE VALUE when designing the AI is to create an opponnent that is as fun as possible for as many people as possible on as many maps as possible.

In my examples I clearly say the goals based on my core value is for the AI to be competitive, to make the game experience to be as similar as possible to playing a human, and not to give the players reason to be mad at the AI. These 3 things need to be balanced [duh] each with their own set of priorities.

Basically I'm saying that if it would "cheese off" players that the AI instantly knows where the grail is and wins on day 9 every time then obviously I need to take safeguards to keep that from happenning. Therefore having the AI concentrate on make sure nobody else gets the grail [like defending monoliths in their territory so the human has a harder time finding the grail] may be a reasonable objective.

Remember JJ ... everything is about striking just the right balance to maintain FUN at all costs.
The example was meant to show that it makes sense to NOT program the AI to play like a human.


Return to “Heroes V-VI”

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 2 guests