As a French person I feel like it's my duty to explain strikes to you. - AdrienIer

Create an account  

 
AI

(February 23rd, 2017, 05:03)Catwalk Wrote: Does the AI favour casting spells of the same colour as the node when fighting in a node? I just fought Raven in a sorcery node, I know he has Psionic Blast but he chose to cast (and fail) Call Centaurs instead.

Not yet. I better add this to my todo list as well...
Reply

New AI rules for handling walls on a per-unit basis :

If the unit has ranged attack power>melee attack power/2 and a ranged attack type, check these in this order :
-Enemy Vortex exists : Maintain "leave walls" tactic, done
-Enemy total ranged power is 0 or very low : override tactic to use "leave walls", done
-Enemy total ranged is less than half of own : override tactic to use "leave walls", done
-otherwise override tactic with "stay behind walls" and proceed as though it wasn't a ranged unit

If it wasn't a unit matching the above rule,
-if the unit is on the list of "should leave" units, override to use "leave walls" if it has no ammo
-but maintain existing tactic if it still has ammo.

For reference, "should leave" units contain only two ranged units, which are Djinn and Colossus.
This is the entire list (was already posted a long time ago somewhere but might as well have it here too)

Code:
; Units that should not stay behind walls
db 14 ; Assassin Hero (has first strike)
db 17 ; Draconian Hero (fire breath+flight)
db 20; Ninja Hero (is invisible, nice surprise attack...if it can find its way outside)
db 22; Amazon Hero (thrown and generally poor defenses, better to attack with this one)
db 28; Paladin hero (First Strike)
db 29; Black Knight hero (First Strike)
db 74; Doom Drakes (flying + fire breath, better on offense. Fear supports their survival, no need to rely on walls)
db 136 ; Griphons (flying+first strike)
db 146 ; Wyvern Riders (flying, poison can be nice)
db 160; Chimera (flying+breath)
db 161; Doom Bat (can hit on first turn, flying, doom)
db 164; Great Drake (flying, breath, strong enough to not need walls)
db 167; Night Stalker (this is no threat if it's not trying to hit you)
db 172; Death Knights (flying first strike. Can probably life steal enough health to not need the wall armor)
db 175; Unicorns (Teleport, should go take out weakest enemy units? Defense too low so walls won't help much anyway)
; Resistance bonus is lost if it does though, not sure about this one.
db 185; Colossus (first strike after it runs out of rocks)
db 189; Great Wyrm (teleport, high damage, this is meant for offense!)
db 195; Djinn (teleport!)
db 196; Sky Drake (flying, breath, strong enough to not need walls)
Surprised Wraiths are not on the list, maybe they should be? I think the list was made when Wraiths had a movement of 3?

For reference, the default AI tactic for all units, before executing this procedure is :
If enemy magic vortex, call lightning, wrack, mana leak - leave walls.
If enemy ranged power>25+Own ranged power - leave walls.
Otherwise stay behind walls.
Reply

That looks like a good approach to the problem, looking forward to testing it.
Reply

Found another "bugfeature" in the AI.

When the AI is looking for targets for their melee hero...
-If the hero has fewer swords than the enemy has shields, the target is invalid
-If the hero has fewer than 2/3 of the enemy swords in shields, the target is invalid
-If the hero has fewer than 2/3 of enemy thrown, or breath, the target is invalid.

Now, this is supposed to make sure the AI can't stupidly suicide their heroes by attacking much stronger units...which is nice.

And here is when it's not nice :
I has a single Trireme (17 swords) vs an enemy Draconian hero (8 shields). Since my boat has more than 3/2 of the 8 shields in attack strength, the hero didn't attack it. So far so good, the ship was somewhat of a risky target, although with 18 swords on the hero it would have been able to defeat it. Unfortunately I had Fire Bolt and killed the hero in 4 shots while it was busy doing nothing.

...and here is my problem. If the enemy was the one with the stronger direct damage spell, this would have been the perfect tactic. But there is no way to consider that - far too many spells in the game. If they aren't, it might be better to attack the ship...but if it is a better ship (warship with holy weapon for example) that would have killed the hero. So...idk, unless anyone has an idea for a better rule, leave as is?
Note that it only happens if the ship (or ships) are the only units in the battle, if there is something weaker to attack, the hero will go after it.
Reply

The only thing I could see is if you put something in that checked if the human player has x casting skill available, and at least 2 books in a single non life non nature realm, where x probably needs to be at least 50, and the AI can't have any other units in the combat, then the hero would attack anyway.
Reply

(February 24th, 2017, 18:03)Nelphine Wrote: The only thing I could see is if you put something in that checked if the human player has x casting skill available, and at least 2 books in a single non life non nature realm, where x probably needs to be at least 50, and the AI can't have any other units in the combat, then the hero would attack anyway.

I had 1 Chaos book and only 40 skill. And the AI had Nagas (but it's slower than a ship). So that wouldn't have worked in this case.
Reply

Yeah without checking exact spells I don't think there's a good way to predict that.
Reply

How about simply relaxing your 3 rules? Say, multiplying hero swords and shields by 1.5 for purposes of the above calculations.

Would you be able to come up with a factor that estimates a wizard's magic strength in combat? You'd be able to use that for a lot of stuff.
Reply

In CoM, combat spells are generally strong. If a minimum of 50 skill and 2 books of a single realm is too stringent, you should really just say 'if fighting a wizard', because 99% of the time, the wizard will be strong. I mean you could say 'at least 35 casting skill, and at least 1 non life spellbook.' That's about as minimal as you can get.
Reply

you could give a weight to books (numero of books, with chaos and death boox wighting more) and multiplay this weight times the remaining casting skill to guess a "danger level" of opponent wizard, then use it to determine if yous stack should take a different tactic and try to end combat as fast as possible, no matter the risks?

edit: it should probably take remaining mana into account, too, so that he can dare you to suck yourself dry...
Reply



Forum Jump: