The Forums Are Now Closed!

The content will remain as a historical reference, thank you.

Fallen Enchantress: Tactical Battles - Part 1

AI Talk

By on October 3, 2011 1:45:16 PM from JoeUser Forums JoeUser Forums

image

As some of you know, I’ve never written tactical battle AI before.  Galactic Civilizations and Stardock’s other games didn’t have tactical battles. War of Magic had tactical battles but I wasn’t involved in that portion of the game.

This series of journals will take you through the journey of how to write AI for tactical battles.  In my experience, games have tended to have pretty crummy AI when it comes to tactical battles (War of Magic no exception).

 

Preliminaries

So for starters, I’ve got help.  Seasoned developer Charles Lentz, who has been at Stardock for some years now, is assisting me on this project.  The first thing I asked him to do is make it easy for me to do mock battles.  When I was working on War of Magic v1.4, which was the first build I even got to look at how tactical battles were done, I noticed that there was no way for me to conduct mock battles.  I’d have to “get lucky” and find an AI player who could cast spells to see if it even worked which was time consuming.

So for Fallen Enchantress, I asked Charles to set up a cheat key that would create opposing armies and that it would read from an XML file that I could mod to decide what powers those units would have.  That way, I could test out all kinds of combinations.

Counter-Spells

Since I come from the modding world, I prefer to have my games let me, the player, mod as much as possible.  My AIs have not been very moddable in the past because, frankly, the coding necessary was far outside my area of expertise (i.e. making it read variables and data from external XML files rather than just hard coding it in C++).  But with Fallen Enchantress, Charles is going to take care of that for me.

So one of the things I intend to do is stuff as much data as I can in XML files.  I want to be able to have the AI gather as much data as it can about who it opposes and then look at the XML data to help it decide what to do.

That means I want to make it so that every spell, ability, weapon, etc. in the game has in its XML AI data that I (or others) can mod with good things to go against it.

Does the enemy side have a spell that rains down a fire storm on me? Then I want that spell to include in its XML what spells are good counters to it. Then,  the player comes in with his fire mage and the enemy casts a frost shield on her first turn. 

Moreover, this gives me the excuse to request the UI team to let both sides see what spells/abilities each other have easily because a good tactical battle, in my opinion, should be a real battle of wits making use of terrain, spells, counter-spells, and maneuver. And the more data the player gets to see, the more data I can let the AI see without “cheating”.

+912 Karma | 119 Replies
October 10, 2011 5:12:44 PM from Elemental Forums Elemental Forums

@HF,

I want that in a holodeck where I am the heroic unit and Warf plays my valiant partner. The holodeck would of course be the size of a planet. 

October 10, 2011 5:26:50 PM from Elemental Forums Elemental Forums

Imagine standing on the ground, looking up at the sky. Something shadows you - it's a titan, twenty times larger than any man. Striding across the field with a vast hammer, ludicrous in both its design and its detail. The mightiest of wizards are harassing it with fireballs tearing away large chunks of its armor. The titan cries in pain, silencing everything else, shaking the ground.

To your left some rift to another dimension opens up, and small, quick wolf-like beasts run out and start eating everything in their path. Tentacles reach out from the portal and place a firm grip on the ground. You'll have to kill the wizard channeling the portal to stem the tide of darkness. Or are you warrior enough to kill everything that comes through, break the hold by cutting off the tentacles?

Meanwhile, your demolition experts have failed - the dwarven gunpowder never reached the walls, so now all your men are caught in a deadly crossfire from ballistas in the inner keep, and a rain of arrows and poisonous oil poured from the nooks. Were you paying attention where the explosives went?

Some impossible demigod walks across the field, everything nearby that has died stands up as undead. It eats magic and souls, and if you're not careful it will destroy both factions fighting this war today. Can you trick it towards the enemy? Or do you try to rally your men fleeing before the undead horde? But what can they do, when a zombie is as strong as twenty men?

The earth shatters - the Long Wall stopping your men disappears in a huge chasm. It's your allies, finally come through. Earth spirits crawl from the underworld. They crawl up on the titan, reinforcing his armor. A single smash from them destroys ten zombies - and should one fall, they certainly won't rise again as undead. The day may still be won - but at a heavy price - you are indebted to the spirits for all time.

Ah... but you forgot. The enemy was fighting as fiercely as you were. Facing certain defeat, they change strategy. While you order your men to attack through the breached wall, your supersensitive senses pick up the smallest of odd noises. You try to dodge and roll away, but too late. Your vampire heart has been pierced by an enemy assassin. The battle is lost, but you'll rise another day with vengeance in mind. Your soul rises above the battlefield and you at last see your army routed completely with no leadership and the enemy mages making quick work of your spirit friends. The demon rift tentacles reach greedily towards your corporeal form, and you barely escape into the skies.

A million men dead. Hundreds of dragons. The earth spirits won't talk to you again - they have little patience for losers. A captured titan - you'll face him again, no doubt, fighting under the enemy banner. 

Known later as the Breaking of the Long Wall, this skirmish proved of little significance in the war.

 

Wow, I need to start exercising so I'm alive when that game arrives.

http://www.youtube.com/watch?feature=player_detailpage&v=n037Qpm7vWA#t=25s

 

October 10, 2011 6:52:04 PM from Elemental Forums Elemental Forums

Epic battles ftw. That's what you remember after playing, the wars and battles. Not the increase in production rate by +1 when you constructed some bloody building.

 

 

 

October 10, 2011 7:09:31 PM from Elemental Forums Elemental Forums

I would use my last portion of mana to cast an ancient spell:

The ground begins to shake, the Titan of old whispers his dying breath, "The Divide." The earth cracks, then splits in two. Where soldiers clash and zombies feed there is no longer solid ground. They are swallowed by the abyss. The Titan's lifeless body sinks into darkness. All of this was merely a distraction. As the rival Sovereign tries to counter this horrific divide a shadow slithers behind him. The shadow begins to take form. It is a man or it can assume such a shape. The Sovereign is at one moment chanting a spell to bridge the canyon before him; to resume the battle he was so easily winning. The next moment, for no reason at all, he stops speaking. An expression of surprise grows slowly on his face. He looks once more over the divide to see his rival bow deeply and then smile. One of the great king's servants takes his eyes off the battle long enough to see a small, darkly shimmering knife in the back of his master. The King drops to his knees and is dead before his face hits the ground before him. 

October 10, 2011 11:19:21 PM from Elemental Forums Elemental Forums

I would just like to say that I heartily approve of both casting times and counter spells, Awesome!

October 11, 2011 6:56:07 AM from Elemental Forums Elemental Forums

Quoting Magog_AoW,
Epic battles ftw. That's what you remember after playing, the wars and battles. Not the increase in production rate by +1 when you constructed some bloody building.

 

 

 

October 11, 2011 3:17:09 PM from Elemental Forums Elemental Forums

Quoting Alstein,


 

One idea for an option: semi-tactical battles:  basically grunt units are controlled by the AI, you only control your champions and what spells are cast. 


 

 

I always wished when CA did Total Warrior games, they essentially made it like a mix of MnB and Total War. You control you, but the rest is controlled by AI. I love MnB but the strategy gamer in me wants to play that sort of game from an RTS perspective.

 

Right now, of course, MnB is the closest to that experience with its grand scope of epic wars taking place over months, filled with numerous battles. Even can marry and have kids now in that, woo! Romance, war, adventure...perfect!

 

 

With regard to Elemental, at the very least; I've always wondered how easy it would be to set up a city-less faction for the player where he essentially is behaving like a mercenary war-band to allow for a more grand rpg-adventure in a world that dynamically changes thanks to the strategy-metagame performed by the rest of the AI kingdoms. The only particular issue that had me wondering was how the AI percieves the player and it if was always as an 'enemy faction' and thus always behaving based on that.

October 11, 2011 3:22:50 PM from Elemental Forums Elemental Forums

MnB: Warbands is ssuch a fantastic game, I wish there were a half dozen more games like it.  

October 11, 2011 4:20:33 PM from Elemental Forums Elemental Forums

Speaking of Warbands - why not a champion or a band of champions you can hire for X months/years. At the end of the period they demand a percentage of your wealth. If you pay, they remain under your employ for another x months/years. If you don't pay they leave your service, taking with them any weapons and armor that you equipped them with to seek service with another fraction. Each time their service expires their demands increase.

Example: Anto the Warrior for 100 GP, at the end of 15 turns he asks for 300 gp and at the end of 30 turns he asks for 1000gp to remain in your service. If you decline to pay, he leaves your service taking with him the light plate and heavey sword you equipped him with and joins the service of another AI fraction.

October 11, 2011 5:27:54 PM from Elemental Forums Elemental Forums

Actually, some basic tactical 'plans' by the AI migth add some spice.  Say, have the AI check and 'decide' basic kind of force it is running, and the best estimate of what the opponant is running.   Then pick a tactical plan from a menu that 'fits' that situation.  Say: basic rush (frontal assult), left enflade, right enflade, left feint - then hit right hard, etc.   Combine with options for magic assult, and indirect fire (archers, javalins, catapults?).   This way, the AI would actually have a 'plan' it is attempting to employ against the opposition.  And the player would have to attempt to preempt the AI, or respond to its battle plan.

October 13, 2011 9:40:04 AM from Stardock Forums Stardock Forums

Quoting Frogboy,
Flanking, LOS, terrain, etc, are all interesting concepts.

But there's also some meat and potatoes here that are easy to overlook because we take them for granted.

How about the AI just freaking healing a hurt unit? Or slowing down a charging unit? 

If you want to talk about the design of tactical battles, that's Derek's thing.  I can say, IMO, that I am not keen on tactical battles being the deciding factor in whether someone wins or loses a given game.  If a tactical battle with say 8 units takes more than 5 minutes then that's very very bad.  

But tactical battles are the best part of the game. It is what will make this game better than CIV. Both Stratigic and Tactical aspect of the game should be important.

October 13, 2011 10:06:22 AM from Stardock Forums Stardock Forums

Quoting Vaul_Darkhour,



Quoting Frogboy,
reply 63
Flanking, LOS, terrain, etc, are all interesting concepts.

But there's also some meat and potatoes here that are easy to overlook because we take them for granted.

How about the AI just freaking healing a hurt unit? Or slowing down a charging unit? 

If you want to talk about the design of tactical battles, that's Derek's thing.  I can say, IMO, that I am not keen on tactical battles being the deciding factor in whether someone wins or loses a given game.  If a tactical battle with say 8 units takes more than 5 minutes then that's very very bad.  


too true.. I remember playing MoM and thinking tactical battles were very cool to start with.. until i just wanted to skip them in the late game because of the repetitive nature of the battles and how long they would possibly take.. this is the same for other games like Total War etc..

I'm a strategist mainly and tactical battles interest me little unless they are warhammer style, but that is a game unto itself.. ingame tactical battles should be quick and fun as not to detract from the main game..

But for some of us the TC is an important part of the main game. I don't want TC to be just an after thougt. If that is the case then I will just move on.

October 13, 2011 10:15:54 AM from Stardock Forums Stardock Forums

Quoting seanw3,
I will always do a manual tactical battle. I like to role play during the battles. The units get quite a bit of dialog. 

Agreed I never auto-resolve no matter what the odds are in games with Tactical Combat. No matter how repetitive it may seem Auto-resolve for me is a hell of a lot more boring and 'lazy.' I have always thought that CIV would be much better if it had TC. However CIV5 sort of has a blend of both if you think about it.

October 13, 2011 10:38:48 AM from Stardock Forums Stardock Forums

Quoting Alstein,



Quoting Mortenart,
reply 79

Quoting maniakos, reply 75If you want to talk about the design of tactical battles, that's Derek's thing. I can say, IMO, that I am not keen on tactical battles being the deciding factor in whether someone wins or loses a given game. If a tactical battle with say 8 units takes more than 5 minutes then that's very very bad.

This is generalising hugely.  Battles with bandits and wolf packs, sure - you don't want these skirmishes to last for more than a minute or two.  But surely there will be some battles that you DO want to take longer over, and use your tactical abilities to plan and win.  To dismiss tactical battles as 'mini games' would be a great mistake, I think.  WoM and FE are set in worlds at war - and so battles will be hugely determinative in victory or defeat.  Some heroes will have little more of a role than to buff towns and cities, but most of them are there to fight for us, as are the units that we train.  And why go to all the effort of levelling up heroes and training better units, if at the end of the day the tactical battles are merely afterthoughts.  I know that this will not be the case in FE, but Frogboy's attitude here is slightly alarming.

 

 

 


 

The problem is tactical battles are in fundamental opposition to a strategy game.   They're fun though, as it's the way to see your neat and cool awesome abilities that you picked.

 

There's also the issue of different abilities having different weights in strategic and tactical battles, which is unavoidable.

 

One idea for an option: semi-tactical battles:  basically grunt units are controlled by the AI, you only control your champions and what spells are cast.  I'd love to see that idea tried.  Maybe there would be a trait that would let you control 1 unit additional per turn per level of it.

 

Generally, I think most people use tactical battles as a shortcut towards winning the game. 

 

I do think tactical AI is a whole lot harder to design for then strategic AI, and I do have doubts about Brad's ability to do a great job there (I've never seen any strategy game do a great job on tactical AI), though I think Brad has a better shot then anyone else in the industry- I just think it's an impossible task.

 

 As for randomness and AI "mindgames"- I think Sirlin's "Playing to win" series is a good inspiration for AI designers- as that is what humans do to each other in competitive environments, an AI needs to be able to handle that through intelligent randomness.

 

 

Well I don't agree that TC is in fundamental opposition to the Strategic game if anything it enhances it. 

Your idea of having a 'semi-tactical' battle is not appealing at all. I personally want control of all my units in the TC that is why TC is so much fun.  A stratigic battle is boring plain and simple. And Tactical battles (actully they are not really Tactical battles) like the ones in HOMM 3 are boring as well because you cannot control the units. They are more like your 'semi-tactical' battle which is not desirable. 

Perhaps an option in the game would be the best way to direct this so that we each can play the TC they way we want.  Perhaps it could be 1) Auto-resolve.  2) 'semi-tactical' battle  3) Homm3 movie style with no control tactical combat.  4) Full control tactical Combat aka MOM, KB, AOW

October 13, 2011 10:59:27 PM from Elemental Forums Elemental Forums

I don't know why you mention HOMM3 as a game where you can't control the units in battle, because you can in that game.  Perhaps you got it confused with some other game?

Best regards,
Steven.

October 14, 2011 9:14:39 AM from Elemental Forums Elemental Forums

Quoting StevenAus,
I don't know why you mention HOMM3 as a game where you can't control the units in battle, because you can in that game.  Perhaps you got it confused with some other game?

Best regards,
Steven.

 

I think he means that your available options are so limited that it's more like a puzzle to figure out than a tactical battle.

October 14, 2011 10:21:44 AM from Elemental Forums Elemental Forums

I think it would make a big difference if there was an option for ranged and magic attacks in fheroes2 (for HOMM2) and VCMI (for HOMM3) to make use of LoS.  A unit "not being able to see a particular unit" means that there is at least one other enemy unit between the friendly unit and the enemy unit you're trying to target.  So any enemy unit a ranged unit couldn't see would be untargetable, and any enemy unit or hex not viewable by the currently selected troop (for single troop or spells like Cold Ring and Fireball) or any non-immobilised unit of your side (for Mass Spells) would not be affected by the spell (or a non-target for a single unit negative spell).  But I think it's fair that friendly troops can always be targeted no matter where they are (by an intrinsic battle link) and that whole battlefield spells (including holy and death spells) are always available (because they potentially damage your own troops as well since they target the whole battlefield).

I think this would go some way to making HOMM2 and 3 battle more tactical than puzzle (along with spell-casting and ability-using monsters).

Best regards,
Steven.

October 14, 2011 3:36:32 PM from Stardock Forums Stardock Forums

Quoting StevenAus,
I don't know why you mention HOMM3 as a game where you can't control the units in battle, because you can in that game.  Perhaps you got it confused with some other game?

Best regards,
Steven.

DOH!!!!  I meant Dominion 3  not HOMM3 sorry about that. 

October 15, 2011 2:52:54 PM from Elemental Forums Elemental Forums

I agree, LOS restrictions and having AOE spells affect both enemy and friendly units would greatly improve Tactical Battles.

Example: I should not be able to target a unit that one of my units can't see. Trees should block LOS. Walls should block LOS. Distance should affect LOS - i.e. you can't see a unit if its 12+ tiles distant

Example: I should be able to cast spell blast (AOE) on friendly unit surrounded by six enemy units. The damage to the friendly unit is outweighed by the damage done to the six enemy units surrounding him.

Stardock Forums v1.0.0.0    #108435  walnut2   Server Load Time: 00:00:00.0000843   Page Render Time:

Stardock Magazine | Register | Online Privacy Policy | Terms of Use

Copyright ?? 2012 Stardock Entertainment and Gas Powered Games. Demigod is a trademark of Gas Powered Games. All rights reserved. All other trademarks and copyrights are the properties of their respective owners. Windows, the Windows Vista Start button and Xbox 360 are trademarks of the Microsoft group of companies, and 'Games for Windows' and the Windows Vista Start button logo are used under license from Microsoft. ?? 2012 Advanced Micro Devices, Inc. All rights reserved. AMD, the AMD Arrow logo and combinations thereof are trademarks of Advanced Micro Devices, Inc.