.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Dominions 3: The Awakening (http://forum.shrapnelgames.com/forumdisplay.php?f=138)
-   -   Gem Usage in Battle (http://forum.shrapnelgames.com/showthread.php?t=47724)

Chazar September 1st, 2011 04:34 PM

Gem Usage in Battle
 
What are the criteria for gem usage during battle?

I just lost a fully equipped Rudra (and probably the MP game) against Vanheim 25PD. The Rudra was scripted to cast SoulVortex, Bless, PhoenixPyre, Bless, HoldTurn&Attack. Instead of using one of the 5 death gems in his pocket, he just went straight to around 50 fatigue by casting SoulVortex without a gem. Being highly fatigued, despite E4 bless and BootsOfTheMessenger, he did not use one of the 3 fire gems for PhoenixPower. Since the first self bless had actually hit him ok, instead of the second bless spell he choose to case some insignificant death attack spell without a gem, bringing him above 90 fatigue, which of course resulted in certain death.

I remember Dom2 mages being very eager to use up all their gems before casting spells that actually require gems, so I thought 5 death gems would encourage the Rudra enough to use one or two to lower the fatigue from SoulVortex, but apparently a 40 fatigue spell + encumbrance from HydraSkin is not enough to warrant gem usage in Dom3.
  • Does battle gem usage depend on how fatigued the caster already is? (i.e. would the Rudra have used its death gems if I had first scripted PhoenixPyre, Bless and then SoulVortex)
  • Is there a known threshold for using gems to avoid fatigue, besides 100+ fatigue spells?
  • Does the number of gems in the mages pocket influence the likelihood of gem usage to reduce fatigue?

I would like to generally understand how the AI decides upon gem usage, the Rudra example is just an example from an ongoing game, which should otherwise not be of interest here.

Samhain September 1st, 2011 08:53 PM

Re: Gem Usage in Battle
 
According to the unofficial Dom3 Wiki, gems are only used to reduce spell fatigue to 50 or the lowest amount possible above 50.

See: http://dom3.servegame.com/wiki/Gem_use

So, your Rudra must have been right on the cusp. Perhaps he would have used a gem had he more than 10 points of spell casting encumbrance.

To avoid the issue with an undesirable spell being substituted for a redundant bless, I would set the Rudra off in a corner by himself to ensure that the bless falls on him. That way, you can either put something you really want him to cast in the slot that had the second bless or script him to attack one battle turn sooner.

thejeff September 1st, 2011 09:14 PM

Re: Gem Usage in Battle
 
I would assume the "Is this battle a big enough threat to use gems" calculation, applies to using gems to counter fatigue. I'm not 100% sure, but it looks like that is what happened. 25 PD wasn't enough of a threat, so the fatigue checks didn't even come into play.

As a side not, if your Rudra is going into battle alone and the enemy has no fliers, it should be safe to only cast bless once. Self-bless will always hit if he is the only target within range, which if it's early in the script means fliers.

Deathblob September 1st, 2011 09:40 PM

Re: Gem Usage in Battle
 
If you view the battle with -dd on, then you can see if can_use_gems is 1 or 0. If it's 0, then he won't ever use gems in the battle, unless you hit the bug where he starts using gems when the enemy routs.

If it's 1, then you are better off saving the higher fatigue spells for later in the script, since if current fatigue is 0, the caster will be unlikely to use gems for fatigue reduction even if the spell has a fatigue cost of 80 or something.

If you're casting Soul Vortex, you might want to bring friendly battery units along with your Rudra to leech health off of. Make sure you don't hit the auto-rout HP limit though.

thejeff September 1st, 2011 11:08 PM

Re: Gem Usage in Battle
 
Battery units are tricky to bring if your Rudra is cloud trapezing, which is usually the case.


Also remember, if you're cloud trapezing to attack and you do take the province, your enemy might be moving troops into the province. If he is, they'll arrive after the first battle and fight a separate one. If you're out of gems now, you're also in trouble.
Relying on gems to keep a raider's fatigue down or to get buffs off at all is risky. Not to mention a pain to keep him supplied with gems. Even with the gem use you'd be high on fatigue those first couple rounds of combat. A couple of lucky hits and you can be in trouble.
Going with weaker but cheaper buffs might be better.

brxbrx September 1st, 2011 11:19 PM

Re: Gem Usage in Battle
 
Is this for vanilla?
Man gems sound confusing.

Finalgenesis September 1st, 2011 11:38 PM

Re: Gem Usage in Battle
 
The gem mechanic is fairly simple, the AI mechanic (which I assume you're referring to) and trigger conditions for gems however is a total nightmare.

You get use to it, but you can manipulate AI only up to a point, the other 50% is crap-shoot, not a totally bad thing though, if immensely frustrating.

Deathblob September 1st, 2011 11:58 PM

Re: Gem Usage in Battle
 
Quote:

Originally Posted by thejeff (Post 782858)
Battery units are tricky to bring if your Rudra is cloud trapezing, which is usually the case.

A few blood slaves would work.

Chazar September 2nd, 2011 01:36 AM

Re: Gem Usage in Battle
 
Thanks for the many useful answers!

If I had only known those a single turn earlier! I guess that either knowing about the corner-self bless and/or the blood slave batteries would have saved my day. I did already account for a battle in the normal turn phase, which is why the Rudra had 5 or 6 death gems - which I thought would be enough to cast SoulVortex twice, but according to the above link Wiki page, he would never use those anyway with that script. Good to know that the Dom3 is not so wasteful on gems. ;)

LDiCesare September 2nd, 2011 03:18 PM

Re: Gem Usage in Battle
 
Quote:

Originally Posted by Samhain (Post 782852)
According to the unofficial Dom3 Wiki, gems are only used to reduce spell fatigue to 50 or the lowest amount possible above 50.

Which may be right but the ai will spend much more than that.
I had a S9 oracle scripted to cast magic duel*4+returning. It needed 11 gems to do so despite the ridiculously low cost of magic duel for an S9 mage (100 fatigue but 8 levels over the required level).

Samhain September 2nd, 2011 10:05 PM

Re: Gem Usage in Battle
 
I'm going to make an educated guess here and say that your Oracle was burning pearls to boost his chances of victory in the duels rather than to reduce what little fatigue it would cost it. I haven't heard of this special case for Magic Duel before, and it is not listed in the Wiki page I linked to above. But, I've got to believe that is what was going on.

There is good nugget of advice in this little epiphany, if you are sending a mage in to battle with the intent of spamming Magic Duel, dump some pearls on him if you want to increase his probability of survival.

Deathblob September 3rd, 2011 02:04 AM

Re: Gem Usage in Battle
 
Magic Duel is based on the unboosted S levels of the mages.

LDiCesare September 3rd, 2011 04:40 AM

Re: Gem Usage in Battle
 
Yes, there would have been no point boosting the S level even if it worked: I was S9 and facing S2 adonim so had 100% chance of success. But to make sure I could retrat in time, I had tested the magic duel-returning combo in SP several times until I found out how many pearls the oracle actually used in battle.
I think that's the best thing to do: Setup a test game, check how many gems your mage will use to cast the spells you want to use. (Of course, magic scale affects fatigue casting, so the test may need to take thhat into account, but I haven't found the scale really relevant with reagrds to gem use).

Samhain September 3rd, 2011 01:34 PM

Re: Gem Usage in Battle
 
There would be no point if your mage knew the level of Astral of his opponents. But, the coders may not have written the AI code with the premise that your mage would know that. This could still be true, and consistent with some coherent concept of how battle magic in Dom3 works, even if the AI is written so that he targets the highest level opponent Astral first.

On the other hand, if Deathblob is right and that gem boosters don't help, then this could actually be a bug. I just can't think of any reason other than increasing the likelihood of success, even when the exact probability is not known, for your A9 Oracle to use Pearls for Magic Duel.

It is a good case for testing. I would be particularly interested if you set up a test with A9 astral mages on both sides of the duel but only one having the cache of Pearls. Run the test a few times and we should have a pretty good idea if the Pearls affect who wins.

JonBrave September 3rd, 2011 03:02 PM

Re: Gem Usage in Battle
 
May I ask (politely), if you care so much about discovering whether/when/how/etc gems are cast, why don't you run the turn with -dd debug ? Does that not tell you what you want to discover?

Deathblob September 3rd, 2011 05:48 PM

Re: Gem Usage in Battle
 
Because the question (or rather the answer) we all want to know is "OMGWTFBBQ WHY!?!?" And sometimes "Why not?".

Unfortunately neither of which is in the debug log.

LDiCesare September 4th, 2011 02:26 PM

Re: Gem Usage in Battle
 
For magic duels, pearls and items don't affect who wins. Only the base, raw level of the caster.

Samhain September 4th, 2011 08:50 PM

Re: Gem Usage in Battle
 
In that case, you should report it as a bug.

LDiCesare September 5th, 2011 02:10 PM

Re: Gem Usage in Battle
 
Why would it be a bug? It's the ai gem usage, the ai decides to use it however it wants. If the wiki gives an inaccurate description of how the battle ai works, it's that site which is wrong, not the game which is bugged. It may as well be working as designed for all we know, and it's not an issue once you have done your homework of checking how many gems you actually need before going to battle.

Bananadine September 5th, 2011 04:32 PM

Re: Gem Usage in Battle
 
Quote:

Originally Posted by Chazar (Post 782864)
If I had only known those a single turn earlier! I guess that either knowing about the corner-self bless and/or the blood slave batteries would have saved my day.

I'm not sure, but it appears that the "corner" part of the corner-self-blessing idea was suggested because a unit by itself in the corner wouldn't be close enough to other sacred units to decide to bless them instead of itself. But if the unit is alone to begin with, there's no reason to put it in any particular spot just for the sake of blessing--it'll very likely hit itself on its first try no matter where you put it. (I think it's still possible for the blessing to miss, in spite of the maximal precision of the spell, but even if I'm right about that, it's still unlikely enough that you can safely ignore the possibility in most cases.)

Quote:

Originally Posted by thejeff (Post 782864)
I would assume the "Is this battle a big enough threat to use gems" calculation, applies to using gems to counter fatigue. I'm not 100% sure, but it looks like that is what happened. 25 PD wasn't enough of a threat, so the fatigue checks didn't even come into play.

My experience suggests that the 1-or-0 gem-use switch that shows up in the debug log is the extent of the influence that the enemy's strength can have on gem use in this situation. Especially with a self-targeting spell like Soul Vortex that works no matter what enemies are present, I wouldn't expect enemy strength to have anything to do with the per-spell gem use decision. But I'm only speculating with little evidence. Can anybody confirm this one way or the other?

thejeff September 5th, 2011 05:02 PM

Re: Gem Usage in Battle
 
Quote:

Originally Posted by Bananadine (Post 783050)
Quote:

Originally Posted by Chazar (Post 782864)
If I had only known those a single turn earlier! I guess that either knowing about the corner-self bless and/or the blood slave batteries would have saved my day.

I'm not sure, but it appears that the "corner" part of the corner-self-blessing idea was suggested because a unit by itself in the corner wouldn't be close enough to other sacred units to decide to bless them instead of itself. But if the unit is alone to begin with, there's no reason to put it in any particular spot just for the sake of blessing--it'll very likely hit itself on its first try no matter where you put it. (I think it's still possible for the blessing to miss, in spite of the maximal precision of the spell, but even if I'm right about that, it's still unlikely enough that you can safely ignore the possibility in most cases.)

I did extensive testing one this. It is not possible for a self bless to miss. (There's some evidence that long range 100 precision spells can miss, especially with low precision.) If there is no other unit within range, the blesser will always hit himself. Any other unit within range, even enemys or non-sacred units, makes it possible. The spell always hits it's target, but to choose that target the AI simulates casting it on the available targets, then picks the first target that got the best result. Since the AoE spread is random, the actual cast won't hit the same squares and thus maybe not the caster.
That's probably clear as mud, but I'm not sure how to say it better.


Quote:

Originally Posted by thejeff (Post 782864)
I would assume the "Is this battle a big enough threat to use gems" calculation, applies to using gems to counter fatigue. I'm not 100% sure, but it looks like that is what happened. 25 PD wasn't enough of a threat, so the fatigue checks didn't even come into play.

My experience suggests that the 1-or-0 gem-use switch that shows up in the debug log is the extent of the influence that the enemy's strength can have on gem use in this situation. Especially with a self-targeting spell like Soul Vortex that works no matter what enemies are present, I wouldn't expect enemy strength to have anything to do with the per-spell gem use decision. But I'm only speculating with little evidence. Can anybody confirm this one way or the other?

I think we agree. For some reason I was thinking that gems to avoid fatigue might ignore the gem-use switch. They don't of course.

Bananadine September 5th, 2011 07:47 PM

Re: Gem Usage in Battle
 
Quote:

Originally Posted by thejeff (Post 783055)
I did extensive testing one this. It is not possible for a self bless to miss. (There's some evidence that long range 100 precision spells can miss, especially with low precision.) If there is no other unit within range, the blesser will always hit himself. Any other unit within range, even enemys or non-sacred units, makes it possible. The spell always hits it's target, but to choose that target the AI simulates casting it on the available targets, then picks the first target that got the best result. Since the AoE spread is random, the actual cast won't hit the same squares and thus maybe not the caster.
That's probably clear as mud, but I'm not sure how to say it better.

I can guess at an exact algorithm based on that, and it isn't what I'd vaguely imagined the actual algorithm probably was... interesting!

Anyway about the missing: I'm like 2/3 sure I've seen a blessing miss, but if you're right then it must have been because there were multiple units present... but surely not many, in fact maybe just two, because if there were many then I'd have expected the spell to miss some, so I wouldn't have been surprised when it did, and I wouldn't remember the incident now! But that's quite possible.

I thought I saw somebody say in some thread, though, that a 100 precision, single-tile spell could still straight-up miss. Like, somebody had seen a mind duel of all things miss, or something like that. I dunno. Of course magic duels tend to happen at much longer ranges than blessings.

Samhain September 5th, 2011 08:40 PM

Re: Gem Usage in Battle
 
Quote:

Originally Posted by LDiCesare
Why would it be a bug? It's the ai gem usage, the ai decides to use it however it wants. If the wiki gives an inaccurate description of how the battle ai works, it's that site which is wrong, not the game which is bugged. It may as well be working as designed for all we know, and it's not an issue once you have done your homework of checking how many gems you actually need before going to battle.
Reply With Quote

It would be an issue if you gave your mage Pearls for the purpose of casting a particular spell but he or she burned them first casting magic duel.

Perhaps I was mistaken, but I inferred from your original post in this thread you felt that there was something particularly odd about gem usage for Magic Dual not that the claim in the Wiki about AI only using gems to reduce fatigue to 50 was in doubt.

Deathblob September 5th, 2011 08:41 PM

Re: Gem Usage in Battle
 
1 Attachment(s)
The other units don't even have to be sacred to screw up a self-bless. Here is a Dai-Oni trying to bless himself. He's not very smart, so instead of targeting himself (at x6 y15), he targets his non-sacred wolf in (x5 y16), and hopes he gets a spalsh bless. He doesn't. Here's the relevant -dd info:

deploycom Shingen at 6 15
com Shingen cast spell (favspell Blessing) (mayusegems 1)
best Blessing this far, 5 15 (112 pnts)
castspell: cnr261 spl754 (Blessing) vis0 x5 y15 spldmg1
blastsqr: unr7365 x5 y15 aoe1 dmg1 eff10 spc1086373888 as10217 al9
affectvic vic7367 hv0
hitunit 7365 7367 dmg1 spec1086373888 ba-1
blastsqr: unr7365 x4 y16 aoe1 dmg1 eff10 spc1086373888 as10217 al9
blastsqr: unr7365 x6 y16 aoe1 dmg1 eff10 spc1086373888 as10217 al9
blastsqr: unr7365 x5 y14 aoe1 dmg1 eff10 spc1086373888 as10217 al9
blastsqr: unr7365 x3 y17 aoe1 dmg1 eff10 spc1086373888 as10217 al9

It looks like there's a no-debug-output stage building the scores for spells, where Bless is targeted at various squares, and scored based on the outcome. Perhaps the Dai Oni was splashed with a bless during the trial run cast at (5,15). I can't tell if (6,15) was even tested, since there's not enough output.

If you have a mixed squad of sacreds (S) and vanilla units (V) like this:

SVS
VVV
SVS

Then it may be optimal to target the center vanilla square.

But when there's only a single sacred unit on the battlefield, it's completely buggy that the unit does not target his own square when casting Bless.

thejeff September 6th, 2011 07:38 PM

Re: Gem Usage in Battle
 
Yeah, that matches what I've seen.

It's completely buggy, except that it uses exactly the same code that's used for all the other spell targeting. Now that you know what it is, you can generally work around it. It's only really brutal, if you're using self-blessing thugs against Caelum or Pan. Flying PD means there are always targets around.

If it's really frustrating, mod in a new H1 bless at AoE 1 or caster only.

Deathblob September 6th, 2011 08:02 PM

Re: Gem Usage in Battle
 
I wasn't sure what you meant at first, but I think I understand now... just like in the Dai Oni case of the spell targeting the wolves, if enemy PD flies over, the bless will target the enemy PD square, any just maybe splash onto your thug. Is that right? If so, that's even worse than I thought ... the enemy is of course not affected by the bless!

thejeff September 7th, 2011 08:09 PM

Re: Gem Usage in Battle
 
Yeah, that's about right.

It's not quite as bad as it sounds. It will only cast on an enemy if you can fall into the AoE. It does mean when you aren't solo it has a better chance of getting multiple targets.

Dimaz September 8th, 2011 02:17 AM

Re: Gem Usage in Battle
 
I had Magic Duel (Prec 100) miss the target square, with S9 oracle too. I posted the -ddd logs somewhere and probably still have the turn in mail archives.

Deathblob September 8th, 2011 02:37 AM

Re: Gem Usage in Battle
 
Was there a Storm or Mist up at the time? Were there so many units on the battlefield that the target was more than 100 squares away?

Dimaz September 8th, 2011 03:03 AM

Re: Gem Usage in Battle
 
There were only 2 units (Oracle and Golem IIRC) or maybe some pd too, I'm not sure. No BF spells. The miss was one square, something like (5,15) instead of (5, 14).


All times are GMT -4. The time now is 05:16 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.