You must be logged in to post messages.
Please login or register

AoW3: General Discussion & suggestions
Moderated by Swolte, Enginerd, ChowGuy

Hop to:    
Welcome! You are not logged in. Please Login or Register.24 replies
Age of Wonders 2 Heaven » Forums » AoW3: General Discussion & suggestions » FastCombat AI
Topic Subject:FastCombat AI
posted 02-21-13 08:10 AM EDT (US)         
Hey people, probably someone already mentioned it, but i couldnt find it...
Will the FC AI be improved?
I mean: can we choose which units to prioritize when dealling damage? Can we set some units as 'body guards' for our frail ranged troops? Can we choose the spells we allow our heroes to use?

I think FC is more important than TC, if less fun. So imho i think it would merit some work .

btw: I said more important because it gives the player and the AI the same combat habilities, so the making and planning of the army ios what matters, and it is what we use in PlayByEmail.

[c#7373DE] Humans [c#EFB573] Azracs [c#4AA58C] Lizard Men [c#9CC6E7] Frostlings
[c#6BB54A] Elves [c#EFE773] Halflings [c#D6AD8C] Dwarves [c#EFEFDE] High Men
[c#B563BD] Dark Elves [c#F74242] Orcs [c#BD7352] Goblins [c#947B73] The Undead
Add the '=' sign afther the 'c'
posted 02-21-13 09:07 AM EDT (US)     1 / 24       
Blue Tracker is your friend
We’ve made some structural changes to help the AI and the AI programmers. Auto combat AI now uses the same AI routines as the one used in the regular tactical battles, so our efforts can be concentrated. A cool side effect is that auto combat replays (for PBEM) for example can be played back in with the full tactical battlefield visualization – sort of like Gratuitous Space Battles.

A proud member of the Unofficial Patch team.
Creator of the AoW1 Mod.
posted 02-21-13 09:18 AM EDT (US)     2 / 24       
Hi Monstro22,

Yes it will.
We'll be running a full tactical combat in the background to determine the results of auto combat, with all players under AI control.
So there will be no difference between auto and manual combat, other then the absence of human input.

Darn, ninja'ed by PawelS ; )>

>>>Delete Yourself; You've got no chance to win<<<

Atari TeenAge Riot

posted 02-21-13 09:27 AM EDT (US)     3 / 24       
Yeah, this should improve pbem quite a bit.
posted 02-21-13 01:32 PM EDT (US)     4 / 24       
Well the obvious next question is "How will the battlefield a.i. be?" because it hasn't as yet been a massive challenge:S.

Take an old, dirty, hungry, mangy, sick and wet dog and feed him and wash him and nurse him back to health, and he will never turn on you and bite you.

This is how man and dog differ.
posted 02-21-13 09:21 PM EDT (US)     5 / 24       
Yes, AI FC spellcasting could use improvements. I often had to take my Wizard out of his tower when doing FC since precious casting points would be used on relatively unimportant battles.

Get the unofficial Patch v1.4. here!
My best AoW-Sm map: Drums of Death (This is the multiplayer version; for single player, or AI use different version)
Other proud AoW-sm maps: The Key of Kharzul, The Fight for Light, Waikiti Island, Goldrush Mountains
My proud AoW2 maps:The River Arne
Coordinator of the v1.4 and v1.5 patchteams, Seraph of AoWHeaven, PBEM Singles Champion 2008
posted 02-22-13 05:33 AM EDT (US)     6 / 24       
A simple "AI casting" tick box before every battle might do the trick.
posted 02-23-13 11:18 AM EDT (US)     7 / 24       
PawelS:Whats Blue Traker????

Picard: i like your idea, but i think it would be even better is the check box was for each hero, and not for every battle. This way you can choose when you are attacked as well.

[c#7373DE] Humans [c#EFB573] Azracs [c#4AA58C] Lizard Men [c#9CC6E7] Frostlings
[c#6BB54A] Elves [c#EFE773] Halflings [c#D6AD8C] Dwarves [c#EFEFDE] High Men
[c#B563BD] Dark Elves [c#F74242] Orcs [c#BD7352] Goblins [c#947B73] The Undead
Add the '=' sign afther the 'c'
posted 02-23-13 11:58 AM EDT (US)     8 / 24       
PawelS:Whats Blue Traker????
See the stickies in this forum

A proud member of the Unofficial Patch team.
Creator of the AoW1 Mod.
posted 02-27-13 03:46 AM EDT (US)     9 / 24       
A "Do not use magic" checkbox is absolutely mandatory.
posted 03-13-13 05:38 PM EDT (US)     10 / 24       
I have considered this to be a problem for some time and would never use FC, unless I would clearly win.

My suggestion for dealing with this would be to designate unit postions Front, Middle, and Back Ranks.
Front: Melee units
Middle: Missile/mages
Back: Long Range/catapults
So your mage does not charge the calvary, but if you place your mage in the front rank they will blast whoever but be vulnerable. So you could place units anywhere, but further back they cannot be attacked by melee units until the front line units fall, or some variation. So if you have only 1 melee unit left the your opponent has 3 he could hit your second rank for instance, of course range units could always attack 2-3 ranks away for instance. Some method along these lines should be easy enough to implement.

So sorry I read you will be running a full tactical combat in the background without human influence. And how does that work. You must have a series of rules to follow for the AI to resolve combat.

[This message has been edited by ffbj (edited 03-13-2013 @ 05:44 PM).]

posted 03-14-13 10:23 AM EDT (US)     11 / 24       
I think the most important part of this usecase is combat spell flexibility and AI that is not afraid of 'defending' or running away.

So a checkbox with 'wizard casts on this combat' AND a larger menu that you config 'allowed spells/abilities per-hero/wizard' would be very nice (so that a monster hero with 30 mp doesn't waste them on geyser instead of sacred wrath for instance, although this should 'do the right thing' if there is only one major enemy of course).

As for running away, i'd expect damaged units with low HP to run away; and if the rest of them would be 'too weak' to win after the one that runs away runs, for them to run too. So 'before they do any move' the army votes - i'm running away: Y/N, and the ones that aren't take that into account, and might run too. On combat in progress, the units still make turn by turn the decision to run away, but that it would be influenced by the hp of the enemy, my attck/defense ratio against it, if we are adjacent and you provoke a AoO, how many attacks does it have, etc; but not influence others to run away.

[This message has been edited by i30817 (edited 03-14-2013 @ 10:33 AM).]

posted 03-19-13 05:18 AM EDT (US)     12 / 24       
Now that there are 6 units per stack, why not assign 6 field positions for each stack?
For instance, the Army view that was in AoW1 was divided into top and bottom rows, so let's have the top row as front rank, 4th and 5th pos. as second row, and the 6th position as rear guard.
If no user input of swapping units is detected, the interface assigns units to positions using common sense (melee front, squishy in the back).
Couple that with some right-click stack options like "self preservation mode" or "reckless assault" and you have several helpful parameters per stack that take up no more than a dozen bytes.

And I like the idea of specifying casting options. I did usually avoid fast combat unless the outcome was a dead certainty (with the usual trick of setting all casters on some high-cost spell used to prevent combat casting).
posted 03-24-13 11:37 AM EDT (US)     13 / 24       
Hi everyone,

We've been discussing FC - and especially AI FC spellcasting - in the office.

Adding options to the combat prompt - e.g. don't cast spells - is easy, but doesn't solve the problem when playing humans.
The defender doesn't get the prompt, so there's no moment of choice for him/her.
This is especially apparent in PBEM play, since having a prompt for the other user - as a solution to the issue - would slow down play severely.

Same logic hold for anything we could add to give some choice and options in the combat prompt screen btw.

As a secundairy consideration, if there's no human there the AI gets to flip the toggles.
Won't go into detail here, but lets just say AI will have a hard time judging what to do.
So the perfect solution would be something that would help out the AI in battle, which could automatically fix the issue above.

So, there's a bunch of things we could do here. I'll jot down some of the things that were discussed below, so you can tell us what you think.
If there's any other suggestions for how you'd like this tackled, please post them here too.
I've numbered my solutions for easy commenting, please do the same : )>

1) We add the toggle to gameplay settings. I.e. never cast spells in FC, which could be set true or false.
We could do fancy stuff here like a slider for combat castingpoint expenditure per turn, but all of these are basically the same thing with more or less bling.

Some attempts at AI friendly solutions.

2) We don't have the AI cast spells ever, when you are preparing a strategic map spell.
That rule would also guide the AI player's choice.
Nice, simple, clean and easy to understand. No need to micro a button in the options panel.

3a) We have a per turn casting pool for strategic and one for tactical combat.
Completely avoids the 'where to spend my casting points' issue.
This does introduce an exploit/AI issue. Multiple attacks in a turn could be used to have a player/AI spend casting points, before sending in the army with valuable troops - e.g. heroes.
Having the AI opt to not spend casting points so it can do so in future battles is a hard nut to crack.
Just think of all the games you've finished with a bag full of health potions and resurrection scrolls that have sat there unused ; P>

Arguably, this exploit was already present in AoW:SM. But still, the goal is to improve upon AoW:SM here.
This then leads us to a modified version of 3a.

3b) We have a per turn casting pool for strategic and a per battle casting pool for tactical combat.
Avoids the exploit/AI issue above. Actually, this makes things real easy for the AI. It will empty its clip asap each battle.
However, this introduces another exploit. Now you can send in a single unit, kite with it while you burn all you castingpoints. Rince and repeat with cheap units, untill the enemy is dead.
The only thing preventing that would be the mana you have available, but it's easy to stockpile mana before a big engagement.
Worst thing, it will a good strategy that's very tedious and boring. Especially when you are on the receiving side.

Sorry for the wall of text, and the lack of tl:dr.
No real way of giving a brief version of this, that doesn't leave out something vital.
Here's a cookie for getting through it all ... *gives cookie*
There will be another cookie for whoever comes up with the perfect solutions for this ; )>

>>>Delete Yourself; You've got no chance to win<<<

Atari TeenAge Riot

[This message has been edited by sikbok (edited 03-24-2013 @ 11:38 AM).]

posted 03-24-13 03:44 PM EDT (US)     14 / 24       
I'd go with option #1. You could additionally make sub-option that would require the opponents party to have at least 50% of the value of the owners party, for casting points to be used in the battle. And a second sub-option that works reversely (opponent can have twice as valuable stack max for cp to be used). AI players could have these defined map-specificly. Also the options could be made stack-specific for human players if that helps (but perhaps not necessary).

Really looking forward for my cookies now.

Maker of the CoMA and Strange Lands mods.
Check out the AoW Chatroom

[This message has been edited by Griffith (edited 03-24-2013 @ 04:00 PM).]

posted 03-24-13 07:31 PM EDT (US)     15 / 24       
The AI should be able to access what it thinks the outcome of the battle should be. One way to do this would be to run thousands of simulated battles with various force mixes on each side, and then codifying that data to a table. This battle data could be pared down later to a more manageble size. The AI is essentially fighting against itself to determine the most efficient use of it's forces. For instance: AI(1) determines, from some table, that it's numerical value is 12, using some algorithm to arrive at this value, and the enemies value is 4, a 3 to 1 advantage. It just attacks normally with no magic, aside from a heal perhaps.
If things are reversed as they would be in an all AI battle AI(2) would fire off all it's magic in battle, knowing it was going to be defeated.
Consideration of the overall battle numerical value would have to include terrain. Some units get advantages in certain terrain.
I like cookies!

So in regards to how a human player could exploit this as suggested above, by sending in low level units to kite or deplete the magical mana of the AI. This would be less effective if the AI saw that it was just a bunch of twits,(my groups term for weak units) attacking it's tough stack.
In the example above the human player would be the 3 value stack and the AI would be the 12. So make some arbitrary point based on the acquired data when the AI will use magic. Like to finish off a badly wounded unit in a close battle. Also with this method it could be dynamic as the rounds progress. Ok, thinks the AI at first I was ahead big time when the battle began. Say 3 to 1 in my favor, now as the rds progress it's more like 2 to 1, so 50%-60% (greater than or equal to 50 on a d100 )chance it will use magic, if it falls to 1 to 1 even chance in a subsequent rd, it thinks, then that raises the chance it uses magic to 75%-100% (anything greater than 25 on a d100). Finally if it falls to less than 1 to 1 like 1 to 1.5 against the AI, it fires off all it's remaining magic, since it is probably going to lose at this point. I offer the random determination as a way to prevent the common exploits players use by always knowing what the AI will do in any given situation.

[This message has been edited by ffbj (edited 03-24-2013 @ 08:08 PM).]

posted 03-24-13 11:07 PM EDT (US)     16 / 24       
Just think of all the games you've finished with a bag full of health potions and resurrection scrolls that have sat there unused

Hey, this things are really will be in game? ))
posted 03-25-13 10:28 AM EDT (US)     17 / 24       
#2 seems like it would work well enough.
#3 seems to be better.

Couldn't you program the AI to only use spells in the most "uncertain" situations? This would prevent the kiting exploit. Example:

1 Karagh vs 1 swordsman = no spells
1 Karagh at 5hp vs 3 swordsmen = tons of spells.
posted 04-05-13 10:58 AM EDT (US)     18 / 24       
3b + Solution) Have combat casting points (BattlePoints) drain from the per-turn Casting Point pool
Give each spell casting unit a setting for how many CP they would like to allocate as the max amount usable in a battle; this BattlePoint setting ranging from 0 to CP (limiting how many spells may be cast per battle), while the Casting Point pool restricts the total number of spells that may be cast each turn (and consequently how many battles may be cast in). The AI just needs to be updated with conditions for altering each casting unit's BP setting, wisely managing the domain's Mana Pool.

Example 1) Casting unit has 20 CP, and sets BP to 10. It may use 10 mana in each battle, no more than 20 per turn.

Example 2) Casting unit has 20 CP, and sets BP to 0. It will never use spells in combat.

edit:.. I suppose this suggestion is more like a combination of 3b) and 1).

[This message has been edited by taijitu (edited 04-06-2013 @ 10:37 AM).]

The Harlequin
posted 04-05-13 12:24 PM EDT (US)     19 / 24       
Is there no way to predict the outcome of a battle without casting spells, taking into consideration the strengh of the armies involved? Like, I don't know, assign a value per unit level (+medals) and sum them for each army, and if one is bigger than the other by x margin, then have the AI's not cast spells at all, but if they are similar, go all out.

These options don't seem to consider army strengh at all :S

Also, I'm not quite sure I understand how the casting pools work. So, assuming the casting points are similar to what the players have available in SM, if with casting specialist V + Casting Chambers you have 80 points available, but you then assign half of it to strategic, only 40 CP left for FC seem too little to have it devided again for 3b), and make any significant difference. So, I'd go for 3a). I prefer the AI casting would rather make a kill, than a scratch.

Hope that makes sense, lol.
posted 04-05-13 01:37 PM EDT (US)     20 / 24       
I like #1 and #3b. Detest #2. It would be nice to have a stack override. Something that says I'll cast more for this stack and less for this stack.

Also, as a related sidebar, I would like to override default value of spells. I might value Blinding Flash or Oil of Skin over Blazing Comet or Stoning. I see this rating as a global setting. The AI must use some sort of rating system to determine what spells to cast.
HG Angel
posted 04-05-13 02:14 PM EDT (US)     21 / 24       
1 - I like this option, having the flexibility to toggle... or even some bling with the slider. But having an option is good.

2 - ugh! Spells are part of the game, let the AI cast spells... even if whatever method is figured out gives them more benefits than human players... we're a whole lot smarter them then anyways

3a - it's ok... but...

3b - yeah... that exploit would need to be resolved and it doesn't make sense to be able to cast in battle then recharge for the next battle same turn. Maybe a sliding scale of some kind, like first battle you get the full battle casting points... 2nd battle you get 75-80%, 3rd battle even less... and so on until you're out of battle casting points. Attack and retreat tactics were sometimes overused in AoW1, losing all your movement points after retreating in AoW2/SM was a good change... not sure how you would do this for battle casting points exploit vs movement points exploit... tricky logic. But I'm sure you guys can come up with something to minimize the exploit. 3b is an interesting option to be explored.

2009 1v1 Mapmaking Competition 1st Place MapBattle of Enioch
posted 04-05-13 06:27 PM EDT (US)     22 / 24       
Another idea besides Combat CastingPoints draining from the per-turn Casting Point pool would be to give casters a unit enchantment with a minimal casting cost and upkeep, something like "Wizard's Touch": which actually allows the caster to cast spells in battles that the affected unit is participating in, without needing to be present. Otherwise limiting them from doing so.
This would restrict how many units and battles the caster may influence.

[This message has been edited by taijitu (edited 04-06-2013 @ 06:38 AM).]

HG Cherub
posted 04-05-13 07:46 PM EDT (US)     23 / 24       
I think that a "reloadable" casting pool is a bad idea both because it's subject too far too many exploits, and because it really doesn't address the real problem which is resource management unless the same reloadable pool is used in PvP play as well.
The AI should be able to access what it thinks the outcome of the battle should be. One way to do this would be to run thousands of simulated battles with various force mixes on each side, and then codifying that data to a table.
Considering just the differences afforded by racial mix and leader classes, no matter how many simultions you run in advance you probably can't hope to cover all possible combinations of units/counter units, and even if you could the tables would be useless once mod makers start tinkering with things. Isn't that after all the big problem with "balance," not to mention complaints that the AI "doesn't know how to handle" this or that new unit?

Probably better then relying on any single scheme then would be to use a game tree approach. Run multiple trial combats with the units actually present using the different casting strategies (with or without user presets) and chose the one that maximizes the given side's results based on gain versus resources expanded. If the battle is unwinnable even with casting, don't do so and preserve casting points. The same if it's a cake walk even without casting. Otherwise, use the strategy suggested by the player's setpoints.

The biggest problems I see with this is are that it complicates the design and coding (since you need to program for the multiple strategies) and that some people may find it slows down the game too much.
posted 04-06-13 11:30 AM EDT (US)     24 / 24       
More thoughts:

When formulating a strategy the AI should check not only if the necessary MP/CP are available to cast the most effective spell at a given time, but also if they are actually worth spending: determining the most efficient balance between Mana Expenditure and Mana Conservation, in a similar fashion to it's method of determining the most efficient relationship between Research and Mana Accumulation. CP(+BP) expenditure just needs to be checked and balanced against the AI's system for managing the domain's Mana Pool at large, and the caster's directive (which probably already considers the power of enemy troops in proximity).
You must be logged in to post messages.
Please login or register

Hop to:    

Age of Wonders 2 Heaven | HeavenGames