Brad Wardell's site for talking about the customization of Windows.

I’ve ready a lot of comments on Fallen Enchantress: Legendary Heroes AI.  I feel confident in saying that most people seem very satisfied with it overall. But I think most people would say it’s not quite as good as GalCiv II’s.

In some respects, the GalCiv series is an anomaly.   I’ve been programming AI on GalCiv games for 20 years.  Let’s put that on the table for a moment and consider the ramifications. Can anyone think of a game, any game in the history of game development, where the same individual programmed the AI for the same franchise for 20 years.  That’s why the AI in the GalCiv games is so good. I’ve had 20 years to digest people’s ideas.

Similarly, a couple weeks ago we released FE: Legendary Heroes 1.3.  As many have observed, the AI improvements in it are nothing short of spectacular.  But that’s not because I suddenly became a better programmer (I wish! <g>). It’s because I’ve had just that much more time to play the game, read the forums, watch “Let’s Play Videos”.

Probably the biggest advantage the LH has had in AI is that pretty much everyone has multicore setups.  I can’t promise this but I think LH may be the first truly native multicore AI that’s been developed (it certainly won’t be the last).  That is, every AI player gets its smarts spawned out to a different CPU core.  That’s why the turn times are much shorter than in most games even though the AI plays pretty well without having to cheat.

Why we don’t like cheating

I’ve gotten a lot of email from people asking why I don’t just have the AI “cheat” on the challenging and normal difficulties.  And I think there may be an age thing.  People of my age (around 40) really really hate cheating AI.  I think it hurts the game. I think it hurts the game because when I play a game, I want to feel like the AI is playing the same game as I do.

Even on the harder levels in Legendary Heroes, the AI doesn’t just conjure up units out of thin air. We just give them more gold or more HP and other things that players can understand and react to.  We don’t, for instance, spawn enemies out in the FOW (a very common trick on our industry). The AI has to have the resources, even on “ridiculous” to create those units. That matters because players want to be able to knock out iron mines and stables and know that this is going to impact the AI’s ability to create those units (same for wiping out shards and spell casting).

What’s next

I still think of Legendary Heroes as a new game.  New DLC is in the works, new updates (1.4 and 1.5) are in the works.  The success of the DLC allows me to pay developers to keep enhancing the game. 

So how do we make the AI better?

There’s just no substitute for time on this.  When people play the game and post, I read. And I conspire how to thwart their plans. Smile  Like many of you, I enjoy playing the game and thinking of ways to wreck it.  I’m a lucky guy that I get to spend time with you guys and brainstorm new strategies for the AI.  I do feel bad for the amazing experts who won’t get to see the expression on those new players who suddenly see the AI doing something clever.

But I think, you and I, together are doing something really fun for next-generation gamers who will realize that 4X games are, actually, pretty darn amazing.

 

Cheers!


Comments (Page 2)
4 Pages1 2 3 4 
on Sep 06, 2013

I agree with others, one of the main advantages of tactical summons is the way it increases the total size of your army, with all the implications that has for swarming etc., and also because it reduces the damage your permanent units take, increasing their survivability and chance of going up levels. Earlier in the game I summon units strategically because in most circumstances that saves mana, and it saves you a tactical turn with your spellcaster, but certainly when you have a full stack with other units it makes sense to summon tactically.

The fact you can summon anywhere on the battlefield means you can also attack ranged units you might not otherwise be able to reach. Conversely you can summon a unit defensively to stop their melee units reaching your ranged units.

Summon Skeleton Horde and Summon Lightbringer are always good. Some tactical summons with additional side effects are also good, if the AI understands how to use them (i.e. cast positive ones on maximum numbers of friendly units, cast negative ones on maximum numbers of enemy units). The Death Ward effect of Summon Grave Elemental has won me a battle against dragons almost on its own. Summon Air Elemental and Summon Ice Elemental can be good, although both are quite fragile, so you have to be careful not to summon them in too exposed a place where they can be killed quickly by the enemy.

There are several AI specific tactical summons such as Summon Death Demon or Assassin Demon which I worry that the AI will cast but it never does. It is a valid point that you still only have to target the summoner to kill the summoned unit, however in practice you would probably have to split your attacks because of being unable to move through the summoned unit's zone of control to get to the summoner. If the AI understood defensive summoned unit placement it would be helpful.

Other tactical summons are a bit more debatable, they can be helpful but it would depend on what alternative actions were available. In general however I don't think the AI casts enough spells which have a global effect (including summons) vs. spells which only affect one unit. The AI casts Burning Blade so much it's ridiculous! Burning Blade is almost certainly not going to significantly affect a battle; Mass Curse and Summon Grave Elemental, on the other hand, could affect the course of a battle. In terms of effectiveness for the mana I tend to think of global spells (Mass Curse, Titan's Breath, Wellspring, Wither) first, area effect (including Fireball etc.) spells second, summons third, initiative affecting buffs (Haste, Slow) fourth (with a preference for Haste because Curse might be resisted), and other buffs last. There are of course exceptions to this when you target one particular unit with Heal or Diamondskin or whatever, but I think that's a reasonable rule of thumb. The AI almost seems to follow the exact opposite rules! It casts very few spells except damage spells and self buffs such as Burning Blade. A high level spellcaster with sufficient mana would be a very scary thing if the AI understood how to cast tactical spells better. As it is, apart from Fireball and Horrific Wail, there is currently very little to worry about.

 

on Sep 06, 2013

Non-cheating A.I. ftw!


New DLC is in the works, new updates (1.4 and 1.5) are in the works.  The success of the DLC allows me to pay developers to keep enhancing the game. 

Supporting the ongoing development made me buy the "Bunny Slippers DLC" and although content wise your DLCs feel poor, just count me in for another round of weird crowd funding.

 

on Sep 06, 2013


I belong to the minority who feel that the AI, even in 1.3, is significantly inferior to GalCiv2. I have not noticed a significant jump in AI behavior in 1.3 vs. 1.2, although I have noticed some changes, such as the AI's improved willingness to take unguarded goodie huts and to hunt monsters, and a somewhat higher willingness to produce Pioneers and escort these to better sites. The AI still fails to be more aggressive in warfare, select appropriate targets, and have a plan regarding what to do to facilitate victory against those targets. (The AI does not use magic well, nor does it design units well, nor does it perform nearly as well as it could in tactical combat.) Strategically, the AI's greatest weakness is its failure to plan and build cities. The massive bonuses the AI gets in "cheating" do, however, make the AI fun to play again up until the Mid Game is done. That being said, the game is very well thought out, and if the AI were to be significantly improved and the serious problems in unit pathing solved (including letting non-hostile units be allowed to occupy the same tile), this game will be as legendary as its name.

 

 

on Sep 06, 2013

If you wanted to make a formula out of what the best spell to cast in a particular situation was you could probably come up with something based on hitpoints, attack, defence and initiative. So a damage spell is better the more damage is done to higher attack, defence and initiative units. For non damage spells, a Haste spell which boosts initiative by 50% gives you 50% of that unit's value, a Slow spell which decreases initiative by 50% but has a 50% chance to be resisted gives you 25% of that unit's value.

For spells which cause units to miss a turn, get 50% of the value of that unit, multiplied by the chance of success (i.e. if there's a 75% chance of success then get 37.5% of the value of that unit). Clearly if chance of knocking a unit prone is 0% then casting the spell on that unit has no value. 50% of a unit's value for missing a turn might be a bit high, but forcing units to miss a turn is generally pretty devastating as battles are over quite quickly. The automatic hit on prone units is significant, as well.

Mass Curse gives you the armour value of all the enemy units (taking into account their chance to resist). Wither gives you the attack value reduction multiplied by number of enemy units, taking into account their chance to resist.

For summoning units just add the value of the summoned unit. Arguably it should be less because the summoned unit will die if the summoner dies, however arguably it should be more because of the swarm effects.

Death Ward should give you at least 50% of the value of that unit. So Summon Grave Elemental should almost always be a good idea if you can get Death Ward on three units.

For buffing units add the amount buffed (depending on the relative weighting for attack, defence, hitpoints).

Divide values by two if it takes two turns to cast the spell, divide by three if it takes three turns to cast the spell.

The idea behind these changes is to promote the AI behaviour I've been talking about, i.e. encourage it to cast spells which affect lots of units, and reduce the number of times it casts minor buffs on individual units.

I don't generally think it should worry about conserving mana; if the tactical AI is running then it's fighting a human and is going to need all the help it can get, it should just cast the most devastating spell it has the mana to cast in each round.

on Sep 06, 2013

Will we ever get to see the AI source code similar to what CIV IV did? Always interesting to see how the sausage is made

on Sep 06, 2013

Great to hear that the DLC is helping to fund further work on the core game.  Really looking forward to the next updates, particularly 1.5 assuming it's still going to be focused on Diplomacy, yay.

 

Regarding summoning...

Frogboy
The problem isn't the summoning part (that's easy). Getting the AI to think that it's worth the casting time for that summons has been the hard part. The AI tends to calculate that summoned creatures aren't worth it. Which begs the question, is that true? are we summoning creatures because it's fun but not tactically effective OR is the AI miscalculating?

Thing is.... I don't get how it's (much) more complicated than other spells.... such as buffs/debuffs. For example the AI casts something like Shrink a lot. There is some complexity around whether it's worth it using the mana, when to cast it, which target to choose etc... but sure enough the AI does cast it. I don't see how something like Summon Shadow Warg is a great deal more complicated. It's always going to be of use. Just cast it straight away if the spell is available.

 

I think something definitely isn't right right with whatever priority calculations for summons are currently used. The AI *never* casts tactical spells going by the feedback in this thread:

https://forums.elementalgame.com/447685/page/1/#3393328

It's almost like the AI calculates the priority for summons as always zero. This seems to happen regardless of the <AIPriority> tag.... even if you crank it right up, no summons.

 

Summoning units in strategic and tactical is fun.  But it's also effective.  We want the AI to drop Air Elementals and Lightbringers and Skeleton Hordes on us  

 

on Sep 06, 2013

abob101
This seems to happen regardless of the tag.... even if you crank it right up, no summons.

I agree, the fact that tactical summons seem to never happen, even after modding, suggests that it is at least possible there's a bug involved. Either that or the priority tag does not work as people expect.

on Sep 06, 2013

puntarenas


Supporting the ongoing development made me buy the "Bunny Slippers DLC" and although content wise your DLCs feel poor, just count me in for another round of weird crowd funding.

Funny.  I feel the same way.  I consider buying the DLC as a Dev Tip.  So far most of the DLC is not something I would consider buying otherwise.

on Sep 06, 2013

Frogboy
are we summoning creatures because it's fun

This pretty much answers why the AI should be summoning creatures

on Sep 06, 2013

Are Summons worth it?

Are 5 swords better than 4 swords? Do ducks duck and bees be?

If you battle a guy and it looks like he has 3 troops but is able to bring in a 4th that's a bait and switch on you and you have to adjust when you realize you are overmatched.

A summon can significantly alter the course of a battle and make a close contest into no contest.    Even if you forced summons to occur in the first turn instead of working the calculations to decide a time tactically when it could be used to swing a battle it's still better than no summons at all.

 

Where to summon?  There are a few options.   Generally I'd say right next to the most dangerous target out there although they could be used as meat fodder to slow an advancing enemy and provide a caster additional time or to appear behind enemy lines and harrass archers in the back row.

on Sep 06, 2013

abob101
I think something definitely isn't right right with whatever priority calculations for summons are currently used. The AI *never* casts tactical spells going by the feedback in this thread:

https://forums.elementalgame.com/447685/page/1/#3393328[/quote]

Indeed no matter what I do the AI never summons anything in tactical combat. I create some kickass new summons that are free and it never uses them.

on Sep 06, 2013

smeagolheart

Do ducks duck and bees be?

This pretty much says it all.

on Sep 06, 2013

Thanks for the "behind the scenes" explanation! I really enjoy reading all of the detailed posts about AI development/improvement.

Oh and thanks for a great game too!!

on Sep 06, 2013

Notice he says Galciv's AI..not Galciv 2's..what is it ten years now and the AI was never written to use all the special racial techs and abilities.

on Sep 06, 2013

The AI is actually pretty bad in absolute terms

it needs massive cheats just to provide a challenge against a decent player

 

although it may be good in relative terms, since most 4X games have terrible AI

4 Pages1 2 3 4