PDA

View Full Version : Spell Casting AI


Gandalf Parker
September 8th, 2006, 08:02 PM
This is a portion of a game log. I dont understand it but its real interesting to see the "thinking" of the AI. It gives me a headache trying to follow what its thinking but it looks good. I know that "com " means commander so this seems to be the thinking for one commander named Bellare until the spell as chosen.
Gandalf Parker

Mrlreport (left): good0 broken0 autobreak0 turn0
com Bellare cast spell (favspell Summon Earthpower) (mayusegems 1)
est. choices 27
comp_castspell: eval Fire Flies result -1
comp_castspell: eval Air Shield result -1
spellscore, Freezing Touch score -9999 (boost 102 scorat 0)
Eval: Freezing Touch score 0 (fat 10)
comp_castspell: eval Freezing Touch result 0
best Flying Shards this far, 14 10 (4 pnts)
spellscore, Flying Shards score 13 (boost 83 scorat 0)
Eval: Flying Shards score 12 (fat 15)
comp_castspell: eval Flying Shards result 12
best spell so far Flying Shards (score12)
comp_castspell: eval Twist Fate result -1
comp_castspell: eval Hand of Dust result -1
spellscore, Sleep Touch score -9999 (boost 101 scorat 0)
Eval: Sleep Touch score 0 (fat 10)
comp_castspell: eval Sleep Touch result 0
comp_castspell: eval Bleed result -1
best Banishment this far, 3 6 (0 pnts)
spellscore, Banishment score 0 (boost 119 scorat 0)
Eval: Banishment score 0 (fat 0)
comp_castspell: eval Banishment result 0
best Blessing this far, 3 6 (35 pnts)
spellscore, Blessing score 35 (boost 114 scorat 0)
Eval: Blessing score 38 (fat 0)
comp_castspell: eval Blessing result 38
best spell so far Blessing (score38)
comp_castspell: eval Sermon of Courage result -1
comp_castspell: eval Smite Demon result -1
comp_castspell: eval Holy Avenger result -1
comp_castspell: eval Divine Blessing result -1
comp_castspell: eval Smite result -1
comp_castspell: eval Fanaticism result -1
comp_castspell: eval Word of Power result -1
comp_castspell: eval Burning Hands result -1
comp_castspell: eval Fire Darts result -1
comp_castspell: eval Flame Bolt result -1
comp_castspell: eval Shocking Grasp result -1
best Slime this far, 14 10 (5 pnts)
spellscore, Slime score 5 (boost 105 scorat 0)
Eval: Slime score 4 (fat 20)
comp_castspell: eval Slime result 4
looser spell Slime (score 4)
comp_castspell: eval Cold Bolt result -1
comp_castspell: eval Geyser result -2
comp_castspell: eval Acid Spray result -2
comp_castspell: eval Star Fires result -1
comp_castspell: eval Fire Resistance result -1
comp_castspell: eval Charge Body result -1
comp_castspell: eval Aim result -1
comp_castspell: eval Resist Lightning result -1
comp_castspell: eval False Fetters result -1
spellscore, Cold Resistance score 1 (boost 108 scorat 0)
Eval: Cold Resistance score 1 (fat 5)
comp_castspell: eval Cold Resistance result 1
looser spell Cold Resistance (score 1)
spellscore, Resist Fire score 1 (boost 81 scorat 0)
Eval: Resist Fire score 1 (fat 10)
comp_castspell: eval Resist Fire result 1
looser spell Resist Fire (score 1)
spellscore, Fists of Iron score -9999 (boost 84 scorat 0)
Eval: Fists of Iron score 0 (fat 15)
comp_castspell: eval Fists of Iron result 0
best Earth Grip this far, 14 10 (8 pnts)
spellscore, Earth Grip score 7 (boost 102 scorat 0)
Eval: Earth Grip score 7 (fat 5)
comp_castspell: eval Earth Grip result 7
looser spell Earth Grip (score 7)
best Earth Might this far, 3 6 (27 pnts)
spellscore, Earth Might score 29 (boost 100 scorat 0)
Eval: Earth Might score 26 (fat 20)
comp_castspell: eval Earth Might result 26
looser spell Earth Might (score 26)
comp_castspell: eval Hand of Death result -1
spellscore, Eagle Eyes score 135 (boost 114 scorat 0)
Eval: Eagle Eyes score 142 (fat 5)
comp_castspell: eval Eagle Eyes result 142
best spell so far Eagle Eyes (score142)
spellscore, Poison Touch score -9999 (boost 89 scorat 0)
Eval: Poison Touch score 0 (fat 5)
comp_castspell: eval Poison Touch result 0
spellscore, Resist Poison score 0 (boost 116 scorat 0)
Eval: Resist Poison score 0 (fat 5)
comp_castspell: eval Resist Poison result 0
spellscore, Barkskin score 293 (boost 116 scorat 0)
Eval: Barkskin score 308 (fat 5)
comp_castspell: eval Barkskin result 308
best spell so far Barkskin (score308)
comp_castspell: eval Personal Luck result -1
comp_castspell: eval Combustion result -1
comp_castspell: eval Phantasmal Warrior result -1
comp_castspell: eval Mirror Image result -1
spellscore, Quicken self score 878 (boost 98 scorat 0)
Eval: Quicken self score 798 (fat 20)
comp_castspell: eval Quicken self result 798
best spell so far Quicken self (score798)
spellscore, Stoneskin score 523 (boost 102 scorat 0)
Eval: Stoneskin score 550 (fat 5)
comp_castspell: eval Stoneskin result 550
looser spell Stoneskin (score 550)
best Armor of Achilles this far, 14 10 (5 pnts)
spellscore, Armor of Achilles score 1 (boost 86 scorat 0)
Eval: Armor of Achilles score 1 (fat 20)
comp_castspell: eval Armor of Achilles result 1
looser spell Armor of Achilles (score 1)
best Earth Meld this far, 3 6 (-35 pnts)
best Earth Meld this far, 14 10 (17 pnts)
spellscore, Earth Meld score 21 (boost 105 scorat 0)
Eval: Earth Meld score 12 (fat 80)
comp_castspell: eval Earth Meld result 12
looser spell Earth Meld (score 12)
comp_castspell: eval Immolation result -1
comp_castspell: eval Mistform result -1
comp_castspell: eval Ghost Wolves result -1
comp_castspell: eval Numbness result -1
spellscore, Ironskin score 1003 (boost 98 scorat 0)
Eval: Ironskin score 1003 (fat 10)
comp_castspell: eval Ironskin result 1003
best spell so far Ironskin (score1003)
best Protection this far, 3 6 (256 pnts)
spellscore, Protection score 293 (boost 116 scorat 0)
Eval: Protection score 266 (fat 20)
comp_castspell: eval Protection result 266
looser spell Protection (score 266)
comp_castspell: eval Body Ethereal result -1
comp_castspell: eval Spirit Curse result -1
best Tangle Vines this far, 14 10 (9 pnts)
spellscore, Tangle Vines score 11 (boost 116 scorat 0)
Eval: Tangle Vines score 10 (fat 20)
comp_castspell: eval Tangle Vines result 10
looser spell Tangle Vines (score 10)
comp_castspell: eval Summon Storm Power result -1
comp_castspell: eval Summon Water Power result -6
comp_castspell: eval Phoenix Power result -1
comp_castspell: eval Summon Lesser Fire Elemental result -1
comp_castspell: eval Summon Lesser Air Elemental result -1
Not enough vis for Summon Lesser Water Elemental
comp_castspell: eval Summon Lesser Water Elemental result -3
spellscore, Summon Earthpower score 203 (boost 83 scorat 0)
Eval: Summon Earthpower score 184 (fat 20)
comp_castspell: eval Summon Earthpower result 184
best spell so far Summon Earthpower (score100184)
Not enough vis for Summon Lesser Earth Elemental
comp_castspell: eval Summon Lesser Earth Elemental result -3
comp_castspell: eval Power of the Spheres result -1
comp_castspell: eval Desiccation result -1
comp_castspell: eval Farstrike result -2
comp_castspell: eval Blink result -1
comp_castspell: eval Returning result -1
comp_castspell: eval Communion Master result -1
comp_castspell: eval Communion Slave result -1
comp_castspell: eval Horror Mark result -1
comp_castspell: eval Dust to Dust result -1
comp_castspell: eval Decay result -1
comp_castspell: eval Frighten result -1
comp_castspell: eval Seven Year Fever result -2
comp_castspell: eval Curse result -2
comp_castspell: eval Bonds of Fire result -1
comp_castspell: eval Mind Burn result -1
comp_castspell: eval Berserkers result -1
comp_castspell: eval Sleep result -1
comp_castspell: eval Rage result -1
comp_castspell: eval Sailors' Death result -1
best Iron Will this far, 3 6 (13 pnts)
spellscore, Iron Will score 15 (boost 97 scorat 0)
Eval: Iron Will score 15 (fat 10)
comp_castspell: eval Iron Will result 15
looser spell Iron Will (score 15)
comp_castspell: eval Panic result -1
comp_castspell: eval Arcane Bolt result -1
best Mossbody this far, 3 6 (186 pnts)
spellscore, Mossbody score 160 (boost 85 scorat 0)
Eval: Mossbody score 145 (fat 20)
comp_castspell: eval Mossbody result 145
looser spell Mossbody (score 145)
castspell: cnr113 spl438 (Summon Earthpower) vis0 x3 y6 spldmg4096
vis 0 xvis 0
blastsqr: unr14799 x3 y6 aoe0 dmg4096 eff23 spc8404992 as10192 al9
affectvic vic14799 hv0
hitunit 14799 14799 dmg4096 spec8404992 ba2
battle_incheck

Wick
September 8th, 2006, 09:23 PM
So Bellare is a E2W1H2 (Maybe H1 under the new system) mage scripted to cast Earthpower, right?

The real question is how it decides the score for each spell.

Gandalf Parker
September 8th, 2006, 09:41 PM
Actually I think he was an AI with a preferance for earth spells. And the scores probably reflect things like whether he has gems, fatigure, or their are in range of the spell.

Im not much interested in knowing it further. Exact formulas ruin it for me. Im just happy to know that the AI considers what its doing so carefully.

Archonsod
September 8th, 2006, 09:42 PM
Presumably Fat refers to the fatigue incurred for casting, Boost is the bonus gained by gem use, vis looks like LOS or potential targets.
Unfortunately, it's not clear to me how it's coming up with the final scores. It looks like it's automatically discarding spells which you can't cast (either through magic picks or range etc) with those -1 results. It looks like it assigns a point value based on targets hit & damage or effect (for offensive spells) and effect on self for buffs (I would assume the point values are assigned, i.e. slowing the opponent is worth 2 points). Problem is, we can't see the calculation it then uses for the final score (so we don't know how much fatigue and gem use factor into the calculation).
The interesting thing is, it looks like it's thinking about using a gem to cast Summon Earthpower...

BigJMoney
September 8th, 2006, 11:12 PM
Archonsod said:
The interesting thing is, it looks like it's thinking about using a gem to cast Summon Earthpower...



I don't read it that way. I think it's coincidence that they are adjacent to each other. For example, if he had a different favored spell, it would still say (mayusegems1). It might be there is a way to set (mayusegems 0) so that they never use any gems at all.

=$= Big J Money =$=

Wick
September 9th, 2006, 12:06 AM
The "mayusegems 1" at the top probably is 1 = true, 0 = false and since it's true he's checked for gem use for every spell at "boost xx scoreat x". I also think the scoreat 0 means he doesn't actually have any gems.

I still think we are seeing the easy part. How does it set the relative score for Ironskin at 1003, Quicken at 768, Flying Shards 7, and so on?

A different point is that this routine could probably be speeded up a lot by checking the favored spell first and stopping if it works (favored is +100000!) and setting mayusespells to 0 if the commander doesn't have any.

Endoperez
September 9th, 2006, 04:36 AM
Archonsod said:
Presumably Fat refers to the fatigue incurred for casting, Boost is the bonus gained by gem use, vis looks like LOS or potential targets.



Also, Dominions magic system is heavily influenced by Ars Magica role-playing system. In Ars Magica, everyone plays a mage, magus, and there's this beautiful system which allows very liberal use of magic, and beautifully described spells. I'll take Arcs of Fiery Ribbons and Ball of Abysmal Fire over Scorching Ray and Fireball any time of the day. Ars Magica also had rules for how auras of different powers (Fae, Infernal, Dominion of God, and Magic) interact with the world...

Any way, magic "gems" were called Vis in Ars Magica. Further:
Not enough vis for Summon Lesser Earth Elemental

It fits.

Sindai
September 9th, 2006, 03:03 PM
Hehe, looks like the system already works the way I said would be nice in the Dom2 forum. I guess the evaluation functions just aren't as rigorous as they could be.

Gandalf Parker
September 9th, 2006, 03:48 PM
Well once the new release settles in we can always make suggestions. We would probably need to examine other combat samples than just this one.