Hero Mages
December 14, 2017, 09:42:14 am MT *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to Hero Mages!
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: Hero Mages – All About the AI  (Read 11185 times)
Ross Przybylski
Administrator

Posts: 1050


D20Studios, LLC


View Profile
« on: October 07, 2010, 07:34:41 pm MT »

Greetings everyone!

Today I officially announced that Hero Mages v1.5 will be released on Monday, October 11th 2010. See the full details here: http://heromages.com/news/announcements/v1.5Launch.html

While I'd ideally have preferred to fine tune the AI more before the public release, I've decided to move forward with the early release due to the high player demand for the new AI feature as well as the need to have the AI included in my entry for the 2010 Indepenent Games Festival.  Besides, one of the awesome benefits of being a web-based game is that I can update it whenever I want to deliver you new and better features!

So, if you've landed on this page it probably means one or more of the following:
A)   You're looking to learn more about the Hero Mages AI
B)   You have questions about the AI
C)   You're here to offer your feedback on the AI

I'll get started by explaining how the AI works and then offer some insights on aspects I am still working to implement for future releases.

How the Hero Mages AI Works:
  • At the beginning of its turn, the AI determines a list of its available actions, looks at all the units on the board, and runs calculations to estimate which enemies pose the greatest threats and which are the most vulnerable to attack.  This strategic level data is used to prioritize enemy targets and coordinate the AI’s forces.
  • Next, the AI initiates a thought process where it decides which of its goals to focus on. “Do my allies need healing?” “Can I summon additional creatures to assist in the battle”? “Are there enemies in range to attack?” When the AI makes a decision, it assigns the best actions for completing that goal with the resources it has available to its command que.
  • Each action in the que is processed individually and uses updated tactical data to properly assign units the best available target and position from which to use the action.  This allows the AI to adapt to changes in the battlefield resulting from previous tactical decisions and battle outcomes.
  • The AI repeats the above steps and continues through its thought process choosing projects and assigning actions until it has determined there is nothing left to do and ends its turn.

The key to the AI’s ability to prioritize decisions results from a combination of:
  • A structured thought process where various goals are considered in what I’ve deemed to be the most practical order.  While this has changed a bit, the essential idea can be found on the flow chart attached to this post:  http://heromages.com/forums/index.php?topic=350.0
  • Statistical data calculated on the basis of potential targets and the individual sort properties of the action.  For example, attack actions consider the average damage the attack will cause, while healing actions consider which units are the most injured.

Targeting Priority for each unit is calculated using a combination of 3 factors:
  • Threat - A measure of how much an individual action or unit’s set of actions threatens a particular unit.
  • Vulnerability - A measure of how much damage can potentially be caused to an enemy unit.
  • Point Value – An innate value representing the unit’s inherent threat regardless of actual game circumstances.  Naturally, mages carry the highest point value, followed by guardians, then creatures.

That sums up the basic principles governing how the AI works.  I’ll leave it open for questions for those looking to learn more about it.  Next let's take a look at functions I'm still working on that probably won't make it in time for the first AI release.

The Top AI Functions Still in Development:
  • Protect Mage Project: It is my intent to create an entire AI thought process dedicated to protecting the most valuable game piece, the Mage.  Until this feature is complete, players may notice that the AI is overly aggressive with their mage in circumstances where they’d probably fair better playing more conservatively.
  • The following actions are currently unused by the AI: Teleport, Barricade, Mind Control, Reposition, Gateway.  Each of these actions requires special attention and prioritization rules for the AI to use intelligently.  The pinnacle achievement I hope to accomplish soon will be seeing the AI play the Psionist in the same frustratingly devious fashion that human players do- pushing and pulling enemy units with her Mind Control ability.  Oh, and let’s not forget the deadly teleport assault combos!
  • Sprint, while used in conjunction with unit actions, is not yet considered in AI positioning tactics. As you might guess, this also means that the Minotaur doesn’t know how to bull charge yet (though he is nonetheless very effective with Roar).
  • The decision algorithm that allows the AI to assess whether it is wise to pursue the enemy, rush the enemy or retreat and recover is still under development.  The current AI will always pursue enemy units using the safest route possible.
  • The AI currently lacks the ability to revisit projects that it was unable to complete at the start of turn.  For example, if the Mage was stunned at the start of turn but is awakened later in the turn after being attacked by one of its units, it will not go back and consider the healing project; rather, it will continue with enemy engagement.
  • “Unit shuffling” and “best action order” still remain the most complex aspects of AI development.  I have grouped actions into various categories so the AI is smart enough to always buff before attacking and disrupt units last, but actions in the same “use order” group are still carried out in random order which sometimes results in one AI unit blocking another.  Currently, I am working to mitigate this by prioritizing positions by the least conflict with other unit actions.  Shuffling refers to the ability to move pieces that have already attacked out of the way so there is room for other allies who haven’t attacked yet to get a slice.  Anyone who’s played Hero Quest knows exactly what I’m talking about.  This problem has me quite perplexed, though inevitably I foresee resolving it by having the computer run test simulations to see which potential attack/move order results in the best possible outcome.
  • Customizable Difficulty Settings and Personality Traits: I believe it’s best to develop the most intelligent AI first and then use this model as a base difficulty for making the AI easier or harder.  For example, the AI can be made easier by reducing the number of processes it considers or by limiting its ability to perform certain actions during a turn.  An insane AI might have bonus resources to work with giving it a huge edge for players looking for a very difficult challenge.  Personality traits would give the AI a particular flavor of human emotion, with my personal favorite being revenge.  I have a friend who takes any attack against him personally and who’ll declare the first person to attack him his mortal enemy for the rest of the game.  I think it’d be cool to have a bot that did this.  For the time being, though, there’s just one AI difficulty/personality which is “the best opponent Ross has been able to build so far”.

That's all for now.  Let me know what you think!
« Last Edit: October 07, 2010, 07:36:28 pm MT by Ross Przybylski » Logged

Manager of D20Studios, LLC
FrontaLobotomy

Posts: 48



View Profile
« Reply #1 on: October 08, 2010, 09:02:40 am MT »

Well. This makes for a long weekend, waiting for Monday!  My knowledge of programming is nil, and I havent had my coffee yet, so I will judge based on performance. Cant wait Ross, well done! Indie pub hosting with the new additions should be very productive.
Logged
Ross Przybylski
Administrator

Posts: 1050


D20Studios, LLC


View Profile
« Reply #2 on: October 11, 2010, 08:13:25 pm MT »

The A.I. is now available in v1.5.  Let me know what you guys think!
Logged

Manager of D20Studios, LLC
Gorstak

Posts: 64



View Profile
« Reply #3 on: October 12, 2010, 07:55:33 am MT »

i think its great,yust maybi they rush with their mage into atk too much and then they easy target.
Logged
Vinman

Posts: 5



View Profile
« Reply #4 on: October 14, 2010, 07:40:22 pm MT »

First off, Kudos to Ross, you did a great job. I can tell it took lots of hard work.

I would like to point out a few things that may improve the A.I.

1. Their mage is too aggressive and is exposed for a counter attack - easily killed
2. The positioning is good, keeping 6 spaces away, but on several times I've seen the sorc move around behind it's own guardian to lightning my guy vs lightning where it stood to avoid zapping a friendly. Also, it needs to learn to block with it's guards and summons. The A.I. moved a summon out of the way so I had a clear run at it's mage.
3. Use of spells. It casts blind on my sorc after rushing me with it's mage, only to have  my pali bless then kill off it's exposed mage. Also, uses shield on a guard vs the mage or on the mage when it is not threatened.
4. Un-stun. I've seen the A.I. wack a freindly to un-stun it, only for the freed unit to not attack. Why take a hit to sit still?
5. Troop selcetion is random at all times. If "chosen secret" is select, I would like to see a better combonation of troops.


I've battled the A.I. in 1v1, 2v1 (2 A.I.), 3v2 (3 A.I.), and 4 man FFA (3 A.I.)

In 1v1 the A.I. will lose 95% of the time. It is much harder to win against 2 of them. In a 3v2, it is closer to 50-50. In a 4 man FFA with 3 A.I., the A.I.'s go after one another.

Again, great job and fun to play, but a human opponent is much more difficult to beat.
« Last Edit: October 14, 2010, 07:42:44 pm MT by Vinman » Logged
ShadowTiger

Posts: 1



View Profile
« Reply #5 on: October 15, 2010, 04:25:48 am MT »

I just started playing this game today. The AI is pretty difficult to beat, and sometimes I feel it is because of chance more than skill. Also certain heroes like the barbarian can be overwhelming. Since I am limited in what heroes i can use, Its hard to tell if all them are balanced.

I noticed a bug... once the AI attacked its own mage with a rogue and killed it, when my mage was 2 spaces above... both mages were in range and both had 2 hit points.

I am struggling to learn how to win... so far I have won 1 battle of about 6 or 7. I often make a stupid mistake but also it is hard to predict that the enemy will cast 2 fireballs and an ice shard in one turn. I can't be sure since I don't know the game that well and since I cant see the enemy crowns, but I feel like sometimes the AI casts more spells in one turn than should be possible.

I noticed that the AI attacked its own unit to wake  it up from stun, dealing 2 damage to it. I subsequently killed the unit. I think it should have attacked one of my units instead or attacking its own unit.

Anyways I like the game and the AI seems pretty well done... just make sure its not cheating or making stupid mistakes.
« Last Edit: October 15, 2010, 04:58:03 am MT by ShadowTiger » Logged
kefkam

Posts: 25



View Profile
« Reply #6 on: October 16, 2010, 01:06:25 am MT »

2vs2 chocke point:

the first turn plays computer1. move FM, cast water elemental, attack with water to the sorcerer, sprint with the FM (exposing him), sleep the bard (just above the sorcerer).

ok. so much risking for nothing but ok. but then he did this:
warrior use protect on soul reaver. they two doesnt move to help the FM or go closer to the enemy.  actually they move to be a little farther.
Logged
FrontaLobotomy

Posts: 48



View Profile
« Reply #7 on: October 16, 2010, 01:12:10 pm MT »

I have noticed a lot of protection spells(fighters protect ability, shield, imprison) used by the cpu when not needed.  As in behind multiple walls, or first turns. Fine when your playing against them! But not so good when your teamed with one.

a lot of exposing the Mage too, leaving him vulnerable.

I like the aggressiveness, and it has actually beat me down a couple times, but not often. even in 2 bots vs me or me and a bot vs 3 bots.  Overall tho, it is a very impressive start on the A.I. and i dont think ive ever seen a bot mino use his sprint attack ability.  even tho the mino had no other real action to take.


But i do see how as it is, for first timers, or players with only a few games experience, can really be challanged by it, and learn quickly some important tips for playing.

addressing ShadowTiger

Quote
but also it is hard to predict that the enemy will cast 2 fireballs and an ice shard in one turn. I can't be sure since I don't know the game that well and since I cant see the enemy crowns, but I feel like sometimes the AI casts more spells in one turn than should be possible.

Sorceresses, and wizards can often cast far more spells than other mages, due to their valor abilities, sorc gets 2 spells for no mana, so can FB and bolt for 0 mana cost, leaving 3 mana to use on actual spells
« Last Edit: October 16, 2010, 01:16:18 pm MT by FrontaLobotomy » Logged
the stoat

Posts: 25



View Profile
« Reply #8 on: October 20, 2010, 07:38:55 pm MT »

So it's been a week of AI, and I have played against it soooo much before crafting these comments:

- overall, I think it's brilliant. Good to see you launched it without trying to make it perfect first
- it's good to see most of the priority AI problems are identified
- In the meantime, can we set up an armour modifier, roll modifier, or similar to make the AI more threatening in 1v1? (ie. give the AI guys extra armour or dice)
- AI blocks teammates move paths. IMHO, a fix is needed as priority 2 behind the protect mage improvement
- AI needs a 'mage rush' command. ie. pretty much the only way to beat a mage if you have only guardians left is to rush said mage. A paladin that retreats to cast combat healing just gives the mage time to gain and cycle cards. So once AI mage is killed, guardians need to be more aggressive, and worry less about the '6 space gap'
- AI needs a stronger motivation to attack a single target, rather than doing 2 damage to 3 targets.
Logged
Ross Przybylski
Administrator

Posts: 1050


D20Studios, LLC


View Profile
« Reply #9 on: October 20, 2010, 08:24:20 pm MT »

Thanks everyone for the feedback!  I find it interesting that veteran players find the AI too easy while newer players find it too difficult- probably a good indicator that the current difficulty is "Medium".

I'm also glad, though somewhat surprised no one has reported any bugs yet (for instance, illegal moves being performed or games locking up to internal errors).  One issue I had seen a few times during testing was players getting extra turn time after a bot had been eliminated; not sure if I managed to get that ironed out or not in this release.

Most feedback thus far seems focused on the general over-aggressiveness of the mage and need for difficulty levels- both of which are high on my priority list.  Other things I overlooked are the "attack to unstun" its own guys issue which as some have pointed out, doesn't always work to the AI's benefit as it either kills its own guys or doesn't do anything with the unstunned units.  I should also consider, as stoat suggested, having the AI consider avoiding positions that obstruct ally movement and priortizing attacks based on elimination of single units vs. highest possible attack threat.  Guardians in general need to more aggresive in general I think; I've seen too many games where support characters stay in the back too often to avoid being attacked when they should be pushing more on the front line to cover the mage and attack.

I'm also surprised at the recent player counts in the lobby.  I had presumed the AI and IndiePub feature would attract more players, but perhaps it's causing the opposite effect as players are getting an overdose of HM playing the bots?

Keep those comments comin'
Logged

Manager of D20Studios, LLC
ZaWolf

Posts: 21



View Profile
« Reply #10 on: October 21, 2010, 12:57:56 am MT »

I think while the computer is fun... it's only fun with another player.  E.g. 2 players vs 4 computers.  It just doesn't replace the interaction you get when playing another person.  It does add to the game, however.  The reason I don't play this game 5 hours a day, is really because I rarely get a chance with no one being in the lobby.  And computer is basically the same as a player, except less challenging, and you can't chat with them.  Which believe it or not, really takes away from the game play.  I think when you start incorporating quests w/ unique computer characters, that people will stay just to play the computer--- which will get people playing longer--- which will increase the chance that multiple users are on at once-- which thus makes the user more apt to continue playing this game, etc..
Logged
the stoat

Posts: 25



View Profile
« Reply #11 on: October 21, 2010, 08:44:30 pm MT »

"I'm also surprised at the recent player counts in the lobby.  I had presumed the AI and IndiePub feature would attract more players, but perhaps it's causing the opposite effect as players are getting an overdose of HM playing the bots"

I'm a bit surprised to see the lobby empty too. Has, at the least, the conversion from guest to registration gone up?
Logged
Sinney

Posts: 13



View Profile
« Reply #12 on: November 22, 2010, 09:48:13 am MT »

Been a while since I've looked at the forums...

I can't add too much more that hasn't already been said about the AI difficulty.  I agree mostly with Vin's points about the over-aggression and some not-so-smart other moves by the AI.  The difficulty settings should fix that for sure.

As for the lower numbers in the lobby.  I can't say there is a certain correlation between lobby population and introduction of the AI, but it does seem that since AI was introduced, less people are around.  Honestly, I think it's probably just because people used log on at different times, but would wait around a bit for other players to join and start a game.  With AI now though, people just log in, see nobody, fire up a game or 2 against the AI, get bored, and then log off.  Just an observation, and really no idea if there is a true correlation...
Logged
Gorstak

Posts: 64



View Profile
« Reply #13 on: November 22, 2010, 03:15:20 pm MT »

I only can say that its quite sad that lobby became a desert(
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC