Frogboy Frogboy

It is time for your destruction to begin

It is time for your destruction to begin

T_Pandemonium_PaintingWe have promised, many times, that Fallen Enchantress will be so bad that it’ll give you some sort of disease.

It is now time to pay up.

For today, the tactical battle AI begins its development.  And my job is to kill you. Thousands and thousands of times.  Meanwhile, you’ll be trying to kill the AI in tactical battle with your various tricks. They will avail you to naught. You humans and your armies will be destroyed. Your kingdoms crushed. There will be much farting in general directions.

For the past several months, I’ve been asking my diabolical cohort Charles to write me tons of little functions that I could eventually use to build up the tactical AI.  While I worked on the main game and the strategic AI, Charles did put together a decent tactical AI with what he had. 

Unlike the strategic map where the AI can’t see all, the tactical map AI has no such problem. All units can see each other.  The odds are even.  There’s no reloading your game in the middle of a battle. It’s just you and the AI.

So for the next couple of months, we’re going to get to know each other.  You will beat the AI a lot at first. And hopefully, you’ll share your secrets. From those secrets I will ask for new APIs and new XML that will help.  I still have a lot of data requests (I don’t know how many turns have taken place in a given battle so I have no concept of whether we just started the battle or are nearing its end, I don’t yet have access to what spells are good and what spells aren’t – but I will soon).

I will have to solve the AI’s terrible use of mana strategically so that it has mana left over to do horrible…horrible things to you guys.  I will also probably ask for a lot of new tactical spells that the AI is more inclined to use effectively (I got a few cool new strategic spell requests that are being put in that are…simply ridiculously evil).

So to start this conversation, let’s look at some of the things the AI needs to think about:

  1. What is the balance of power in ranged units?
  2. Should I attack the closest unit or bypass that unit to go after a more vulnerable unit
  3. How important is vulnerablity? No point casting a fire dart at a fire elemental but should I spend a day coding about blunt weapons versus cutting weapons? (remember: time is a finite resource, I don’t get a year to write this, just N engineering hours).
  4. Should I cast a spell? Right now, the AI wastes magic when it shouldn’t (because it rolls the dice rather than calculating it).  No point in using burning hands if I can kill you with a sword almost as well.

This is going to take awhile and it won’t be in the first BETA 2 build.  Or if it is, it won’t be much better than what is currently there.  But together, we should be able to come up with something pretty lethal.

205,217 views 91 replies
Reply #51 Top

No matter how good the overland AI might be, unlike in Galciv, where you had no control over the actual fight, the real fight here takes place on the tactical maps.

 

And Fantasy 4X are a different beast from any other 4X due to spells...

Reply #52 Top

Some ideas:

  • If the battle is going to be won, disengage heavily damaged units so they can live to fight another day.
  • If a unit is the focus of attack and is taking damage, move it to limit contact with the enemy, forcing them to switch targets or move through your ZoC to reach him.
  • Break the enemy's best units with your best units, then use your support units to finish off while the heavies goes for something else.
  • Units that can apply an effect with their attacks (poison, curse, shrink) should attack a target that does not already have that effect if possible.
  • Prefer attacking units that will move sooner rather than later.  Weaken or kill the ones that will move soon before they do so, taking threat level into account.
  • Don't cast the same buff/debuff twice on the same unit unless it stacks. (AI does this all the time currently)

On a related note, I wouldn't mind seeing an initiative or attack bonus for the attacking stack and a defensive bonus for the defending stack.  Not sure about the math on whether that would make a difference or not though.

Reply #53 Top

Quoting Heavenfall, reply 9
"Forward, the Light Brigade!"
Was there a man dismay'd?
Not tho' the soldier knew
Some one had blunder'd.
Theirs not to make reply,
Theirs not to reason why,
Theirs but to do and die.
Into the valley of Death
Rode the six hundred.

Cannon to right of them,
Cannon to left of them,
Cannon in front of them
Volley'd and thunder'd;
Storm'd at with shot and shell,
Boldly they rode and well,
Into the jaws of Death,
Into the mouth of hell
Rode the six hundred.

Flash'd all their sabres bare,
Flash'd as they turn'd in air
Sabring the gunners there,
Charging an army, while
All the world wonder'd.
Plunged in the battery-smoke
Right thro' the line they broke;
Cossack and Russian
Reel'd from the sabre-stroke
Shatter'd and sunder'd.
Then they rode back, but not,
Not the six hundred.

 

"There were thirty million English who talked of England's might,
There were twenty broken troopers who lacked a bed for the night.
They had neither food nor money, they had neither service nor trade;
They were only shiftless soldiers, the last of the Light Brigade.
They felt that life was fleeting; they knew not that art was long,
That though they were dying of famine, they lived in deathless song.
They asked for a little money to keep the wolf from the door;
And the thirty million English sent twenty pounds and four!
They laid their heads together that were scarred and lined and grey;
Keen were the Russian sabres, but want was keener than they;
And an old Troop-Sergeant muttered, "Let us go to the man who writes
The things on Balaclava the kiddies at school recites."
They went without bands or colours, a regiment ten-file strong,
To look for the Master-singer who had crowned them all in his song;
And, waiting his servant's order, by the garden gate they stayed,
A desolate little cluster, the last of the Light Brigade.
They strove to stand to attention, to straighten the toil-bowed back;
They drilled on an empty stomach, the loose-knit files fell slack;
With stooping of weary shoulders, in garments tattered and frayed,
They shambled into his presence, the last of the Light Brigade.
The old Troop-Sergeant was spokesman, and "Beggin' your pardon," he said,
"You wrote o' the Light Brigade, sir. Here's all that isn't dead.
An' it's all come true what you wrote, sir, regardin' the mouth of hell;
For we're all of us nigh to the workhouse, an' we thought we'd call an' tell.
"No, thank you, we don't want food, sir; but couldn't you take an' write
A sort of 'to be continued' and 'see next page' o' the fight?
We think that someone has blundered, an' couldn't you tell 'em how?
You wrote we were heroes once, sir. Please, write we are starving now."
The poor little army departed, limping and lean and forlorn.
And the heart of the Master-singer grew hot with "the scorn of scorn."
And he wrote for them wonderful verses that swept the land like flame,
Till the fatted souls of the English were scourged with the thing called Shame.
They sent a cheque to the felon that sprang from an Irish bog;
They healed the spavined cab-horse; they housed the homeless dog;
And they sent (you may call me a liar), when felon and beast were paid,
A cheque, for enough to live on, to the last of the Light Brigade.*
O thirty million English that babble of England's might,
Behold there are twenty heroes who lack their food to-night;
Our children's children are lisping to "honour the charge they made - "
And we leave to the streets and the workhouse the charge of the Light Brigade!"

The Last of the Light Brigade

--Rudyard Kipling--
Reply #54 Top

Quoting Seanw3,
 

I hope that tactical maps are designed in conjunction with your tactical AI. There are currently not enough maps. The ones we do have offer no tile bonuses. A few of them have a single choke point in the middle. I understand the design is to only have one round before melee starts, but there are so many ways to build the middle choke point. The AI needs to be able to handle them all. 

Ex: A block in the middle of the field has two choke points. A checkerboard of blocked swamp tiles, or swamp tiles that reduce defense and prevent movement. Three smaller blocked areas in the field, creating three choke points. 

The AI needs to be able to handle flanking and defending these types of maps. 

 

Lots of great ideas in this thread, however this issue stands out as a major one in my eyes.

Defense in general seems to be tactically limited. There is no way to form a barrier or front line without creating choke points on maps with the current abilities that units can obtain. 

It seems like something along the lines of attacks of opportunity from DnD could help to solve the issue of easily bypassable defensive units. Perhaps there could be some kind of trait or perk that could be added to defense first type units to prevent units from rushing to kill the first high value target asap. The system as stands seems easy to exploit because you can rush the most dangerous target that the AI possesses while bypassing the rest of the AI army with little to no repercussions.

Perks like ability to attack bypassing units or defend other units, combined with maps that had more distinct tactical design would go a long way towards adding a more tactical flavor to battles. This would allow the AI to exploit areas of a map with choke points while also being able to play defense on a map without them. Just adding maps with a ton of choke points seems like a quick fix where every map turns a blitz for choke points. 

I guess in summary I believe there needs to be less of focus on individual unit defense, and more opportunity for defense at a tactical or group level. This would likely make AI programming even harder, however without some sort of ability for group defense it all seems to boil down to a "identify highest threat, zerg rush highest threat, rinse, repeat" style of game play.

Reply #55 Top

Quoting Frogboy, reply 31
Well a big thing is listening to people play the game.

Can you imagine how cool it would be to write the Starcraft AI to deal with the Korean champions?

 

It would still loose by a very large margin. The AI can match the APM, but not the metagame thinking.

 

Even now the Difficult startcraft AI gets Resource bonuses - The only way of making it competitive.

Reply #56 Top

Kicking your ai's ass will be fun! :thumbsup:

.78 next week correct?

 

Reply #57 Top

Battle main strategy depends on 3 factors:

1) understand your foe: is my opponent a strong shooter (2S) or a strong meleer (2M)?

2) understand your strength: am I going to kill more by shooting (1S) or by engaging in hand-to-hand (1M)?

3) assess the relative strength: am I going to win easy, lose easy, or is it a challanging fight?

Then your strategy will follow.

If the fight is challenging then:

1S-2M requires you to close in defense and shoot like hell. Spells should support this strategy by slowing fast enemies and buffing your shooters...

1M-2S is typically not a good one unless you can cast spells to protect and quicken your units or blind/stun/shrink their shooters

A1-B1 and A2-B2 are more classic situations. Here one should focus more on tactics. General tactics are:

> spells: are you better at debuffing, buffing or dealing damage? Is your opponent's power concentrated in a few units or dispersed over many units? How about your power? How many units you and your opponent have each? Can you roughly estimate how long the fight will last? How much mana do you have and how much do you generate per turn? From these questions and their answers depends what spells you cast and on whom, to maximize effectiveness and efficiency.

> whom to attack: create some coefficient like dps/(current hp) to sort enemy units from highest priority target to lowest. Adjust for total hp (given an equal range, a unit with 10 times the hp of another is a worse target since you may require several turns to kill it) and for abilities that that unit may have. At every moment in time you should attack the first unit in the list, with higher priority on those units that you stand a reasonable chance to kill before their next move  - so this depends also on how many of your units can hit that unit before he moves.

> how to move/position: melee units should always count opponent's moves/initiative to get first strike. Mind that getting first strike on a weak unit to be then attacked by a high dps unit is not a brilliant strategy in general... so weight your opponent's units: if the highest dps unit in his army has dps 100 then ignore all his units with dps below 30 for the purpose of first strike avoidance and shooters protection...

If the fight is easy then:

do not use mana, unless for healing if you may lose a unit or to quick-kill a high dps shooter if you are in a 1M-2S situation.

If the fight will be lost for sure then:

if you can't flee, focus your strategy on killing at least 1 unit. Here damage spells are typically a better choice than debuffs since the fight will be short

Reply #58 Top

Quoting Aeon221, reply 6
Barry is right about Shink and Growth, those are the only buff/debuff spells I bother with. The others, not useful. Grow should be used on heroes who can do aoe multihit, shrink should be used on enemy champs with melee higher than unit def for the guy they're going after. 

Actully Slow comes in handy a lot for me. As does Haste. These are the two I use the most.

I have a question about Counterspell,, does it work. I would cast on a Champ or magic using creature yet on thier turn they can cast. It should at least shut the caster down one turn

Reply #59 Top

Quoting nitey, reply 20
Never bring a knife to a gunfight. Far too often I find AI armies running around with tons of militia units rather than effective fighting men. The calculation that you do to decide a armies strength. IF you are basing your combat strategy off that number, then you are already at a disadvantage - especially with hero stacks. I can take down epic units with strong units, and almost defeat them with medium strength units 80% of the time.  Perhaps the ratings need to be constantly re-evaluated in the game because what might be a epic strength army at the beginning of the game is nothing more than a medium strength army mid to late game.

Others have mentioned other specific tactics - chances are you already KNOW everything that has been said here. Even if you do 1/2 of the stuff mentioned here the AI will be far more challenging than in most games. 

Good luck. 

 

I would also like to add to this.....Pioneers are NOT GOOD fighting units. I see all the time when the AI si attacking me with Pioneers. I just take my weakest units and a champ and destroy them for the XP.  Keep in mind Pioneers are for building Outpost and cities nothing else.

Reply #60 Top

Quoting seanw3, reply 21



Quoting maniakos,
reply 17
Since we don't have ZoC you can't effectively block units unless the battlefield has choke points. ZoC blocking should have been added.


Actually we can. Units adjacent to an enemy can only move one space or retreat. Not full ZoC, but it makes blocking an option. I am surprised you didn't notice.

 




Quoting FallingStar0280,
reply 18
Item #2 is an interesting one.  Having lots of targeting rules and bypassing things (like MMO style targeting of killing casters and glass cannons first) seems like *smart* AI and pretty effective.  Problem being that it currently wouldn't be very *fun* AI.  If the enemy constantly runs past my expensive defenders in plate to attack my back rows, that's smart stuff, but I'd just never create or research armor again.  Right now it would neither be efficient cost wise to make a wall of units to protect squishy stuff (vs pure glass cannons) or very plausible (no preset start formation, small tac map, high move speeds, low unit count, etc).  So it would just make my armies feel more homogenous.


Actually you can block flanking. Just put your units on every other tile in a line. Probably the lack of tactical AI and OP of heroes has obscured the limited ZoC, but it is also tiresome to read suggestions based in incomplete data. 

 

Placement:

I hope that tactical maps are designed in conjunction with your tactical AI. There are currently not enough maps. The ones we do have offer no tile bonuses. A few of them have a single choke point in the middle. I understand the design is to only have one round before melee starts, but there are so many ways to build the middle choke point. The AI needs to be able to handle them all. 

Ex: A block in the middle of the field has two choke points. A checkerboard of blocked swamp tiles, or swamp tiles that reduce defense and prevent movement. Three smaller blocked areas in the field, creating three choke points. 

The AI needs to be able to handle flanking and defending these types of maps. 

Actully this is not true. I have seen many time where either I or the AI were adjacent to each other then move more than one square to hit another enemy unit.

And your second suggestion does not work either. So it would seem your data is incomplete at lest for .77 version and .75 version (I completely missed the .76 version so I cannot speak for that.

Reply #61 Top

...bring it on, Brad. Bring. It. On.

1) I found ranged units to be OP unless I had ranged or a mage. My general solution to this is to...have ranged or a mage. A good fireball will wipe them out, and my archers are generally better than the AI's.

2) It's a bit jarring to have someone run past my infantry to go for my Sovereign. I mean, why have my Sovereign sit waaaaaay back there with lines of infantry and archers and have someone run past? Would it be possible to have vulnerability be determined by distance (that is, if I have my physically weak Sovereign within running distance, the enemy will charge for him - but the enemy will not go straight for my Sovereign unless my Sovereign is within range)

3) This can go two ways. One, it could be a hard counter (blunt is super powerful against armored units but not against lighter units, blade is great against lighter units but useless against heavy armor) which would probably suck a great deal. No offense, but the combat system from GalCivII was frustrating at times because of this. Why not have them MATTER just not so much? Blunt gets extra armor penetration but is still useful against lightly armored units (instead of being defined by it, armor pen is just a perk) and bladed weapons have a different damage threshold, or extra crit...etc. I would PREFER the not-hard-counter route.

4) Magic use should go up as mana cost goes down. When I can hurl fire bolts for 4 mana I use them each turn, because I get more than 4 mana back. In big battles, I use fireball once and then use fire bolts. Perhaps have it as a separate variable? More magically inclined factions will hurl magic more often than, say, Verga. Ceresa will be more inclined to using Burning Hands than whacking someone with her staff because the staff-whacking is beneath her. I dunno. I personally always play a mage type so I can unleash magical hell.

Reply #62 Top

I've printed out the comments in this thread. You will all regret it. ;)

Reply #63 Top

Here's your challenge Frogboy - make an FE AI that can consistently beat most of us without *any* bonuses whatsoever. =) ;-)  If you can do that, maybe then you'll need to provide more bonuses to *us*. ;-)

Reply #64 Top

Quoting StevenAus, reply 63
Here's your challenge Frogboy - make an FE AI that can consistently beat most of us without *any* bonuses whatsoever.   If you can do that, maybe then you'll need to provide more bonuses to *us*.

Yep, I want to see a bunch of QQ posts on here about Brad's AI. :cylon:

Reply #65 Top

Here are some scenarios I would be interested in testing.  I suspect that AOE damage magic (with initiative bonus especially) is too strong compared to everything, and that lack of complexity in the combat engine favors generic powerful stacks over combined arms or maneuver.  But, that could just be wrong impressions based on limited information.  Too bad Beta doesn't have some kind of tactical arena for testing.

If there's some tactical tricks that can help the "underdog" get a reasonable win percentage in any of these scenarios then I think this thread will end up being very interesting.  If as I'm afraid, the team with more AOE power and max'd out generic units wins practically every time barring unlucky random rolls, then there aren't  really going to be any advanced tactics to discover; in that case AI just needs to learn rudimentary building blocks like, cast powerful spells rather than weak spells in tough battles; maneuver for first strike / kiting if you have more moves than the other guy; focus fire; don't cast the same buff/debuff spell again if it's still active.

[edit:  I should specify, when I say focus fire, that only applies to champions once you start target them.  When fighting regulars it doesn't seem matter since they lose attacks as they lose HP, and there is no mechanism to encourage application of overwhelming force at a point such as limited # of counterstrikes, flanking, suppression, morale ... ]

Anyway, following with interest, hope that i am proved wrong :)

 

A vs B

Team A:  4 strong melee squads, 2 strong ranged, 2 heroes with only +initiative and Fireball (or Blizzard).

Team B:  4 strong melee squads, 2 strong ranged, 2 heroes with all spells and any abilities EXCEPT AOE damage spells.

(IMO as a general design principle whatever is the strongest form of attack -- and right now I'm confident it's high-initiative AOE magic -- should have a defensive counter strong enough to bring other tactics into play somewhat regularly.  correct me if I'm wrong but currently the only limiting factor is on the strategy layer, that the AOE attacker needs sufficient mana reserves to do it?  and that's not something that the defender has any direct control over)

 

C vs D

Team C:  6 strong melee squads, 2 melee heroes with non direct damage spells

Team D:  X strong melee squads, (6-X) strong ranged squads, 1 melee & 1 ranged hero with non direct damage spells

It would be cool if there was a different optimum number of ranged on different maps, or at different technology levels.  Or better yet if there was another variable that came into the equation like horse to run down the archers. It seems to me now that a combination of design decisions in favor of speed/simplicity, pretty well discussed to death in all those "tactical combat" threads, that make maneuver tactics generally have only a weak impact on battle outcome.  

corollary 1:  mobility (for the very specific purpose of getting first strike or to kite with archers) is key.  is it true that you always want every guy on a horse if possible?  tactical combat would always be more interesting if there were advantages but also exploitable weakness to deploy a heterogeneous army.

[edit: corollary 2:  can you design a tactical scenario where for equal cost you'd be better off with a mixture of two different kinds of melee infantry? ]

 

E vs F

Team E:  Army of generic max'd out user-designed troops (use all three attribute slots, relevant trinkets, best weapon)

Team F:  Army of *equal cost* made of any faction's elite "flavor" units (one or two attributes, no trinkets)

I'm just curious about this one.  I'm a little sad that after a couple play throughs I never see the special units any more from myself or AI, but only my generic designed guys.

 

 

Reply #66 Top

Summary: Not all AI's have access to all the AI routines.

I would like to see the strategy used by the AI's influenced by their intelligence and/or experience level - with more intelligent/experienced opponents fighting smarter. Like a human chess player. You have some opponents that play a calcualted game and others that just charge in. Perhaps traits could unlock more intelligent subroutines; i.e. Leadership in addition to giving your army units a bonus to initiative also allows Sovereign/Champion AI to fight smarter in auto-battles.

Likewise increasing the difficulty level would make the AI's smarter by giving them access to more AI routines.

Reply #67 Top

(...) for the next couple of months, we’re going to get to know each other.  You will beat the AI a lot at first. And hopefully, you’ll share your secrets. From those secrets I will ask for new APIs and new XML that will help.  I still have a lot of data requests (I don’t know how many turns have taken place in a given battle so I have no concept of whether we just started the battle or are nearing its end, I don’t yet have access to what spells are good and what spells aren’t – but I will soon).

That is so Mazer Rackham's speach from Ender's Game novel.

Are you sure we aren't fighting the real wars somewhere in the universe?;)

Reply #68 Top

Quoting StevenAus, reply 63
Here's your challenge Frogboy - make an FE AI that can consistently beat most of us without *any* bonuses whatsoever.   If you can do that, maybe then you'll need to provide more bonuses to *us*.

That'll never happen, unfortunately. It would be a commercially bad decision to do that.  I wish I could do that though.

The reason why is CPU power.  Think about a chess game where you have to wait between turns.  There's only 64.  And the number of moves each piece can make are finite.

By contrast, there's an insane number of tiles to deal with and every unit is, effectively a queen and many of them have special powers.  

So my job is to make sure that the normal AI can provide a *challenge* to the 50%tile player.  Which means only win 50% of the time.  In FE, I did cave a bit and create "Challenging" which has some extra CPU umph in there (right now, largely additional resource analysis and tile analysis). But beyond that, it would be really time consuming (to code) and could take several minutes per turn late game.

Let me give you the #1 weakness of the AI in your build of the game: Path finding.  Something that trivial. I have to play all kinds of games with the code to make sure that it doesn't have to spend very much time doing path finding to get to your cities. That's because path finding can take a long time when you're dealing with units that are far away.

Now, that said, I would rate the AI in 0.77 (your build) at being about 50% of the way to its goal.  It's still weak strategically and a total joke tactically. So there's still a lot of room to improve it without it causing players anguish in turn times.

..

And one other thing to add, IF the game is successful enough where I can justify spending time on the AI post release, I can, like I did with GalCiv, let players opt into increasing amounts of CPU pain to ramp up the AI perf.

Reply #69 Top

How much better is the AI in .78?

Reply #70 Top

Quoting Frogboy, reply 68


(...)

And one other thing to add, IF the game is successful enough where I can justify spending time on the AI post release, I can, like I did with GalCiv, let players opt into increasing amounts of CPU pain to ramp up the AI perf.

I'd totally love that. Although I hope that FE becomes a huge financial success I somewhat doubt it seems almost all the hard core folks got their free copy thanks to your generosity.

And talking about AI - if you take Go (old asian board game) where many more moves are possible than in chess, computers still aren't able to beat very good amateurs. And here the strategy is way more straight forward (although most Go-programs use kind of a counter intuitive strategy) and programs may only focus on AI - not on graphics and they usually got more time as well.

If anyone wonders what my point is, my point is, that it's just awfully hard to make a very good AI.

Reply #71 Top

Quoting seanw3, reply 69
How much better is the AI in .78?

It's hard to say how much better it is.  It is certainly a lot more sophisticated.

A few things at the top of my head include:

+ The AI creates army groups and uses them as a single force (rather than each stack being handled invividually)

+ The AI will upgrade its units

+ The AI is much better about choosing better units

+ A lot of work has been done on mana and spell casting management

+ There's been a lot of focus on economic handling

+ A number of path finding problems have been solved

+ There's a lot more going on behind the scenes diplomatically

+ Tactical battle AI exists (as opposed to it being random / attack nearest guy)

+ Lots of bug fixes that resulted in stupid AI behavior

+ AI is pretty smart about distributing champions around to max their XP.

I still have no trouble beating it on normal. But it takes quite a bit longer and I can't just grab a few champions and slaughter them like I could in 0.77.

 

Reply #72 Top

BTW, the above is by no means a complete list, just what I am thinking of off the top of my head.

Reply #73 Top

Does that mean upgrading regular units will be cost efficient in the next version =), or just that the AI with bonuses will do it more often? ;-)

Reply #74 Top

Quoting StevenAus, reply 73
Does that mean upgrading regular units will be cost efficient in the next version , or just that the AI with bonuses will do it more often?

Yes, we are having to substantially lower that cost.

Reply #75 Top

Annoyance is it being 11:10 and realizing that the IsUnitVulnerableToAttack(AttackType) isn't working and thus you have AI players using burning hands on Ignys. Tomorrow...