The New ISWorthy Calcs

This is so much win, but how much of these can we add before it starts slow the game down? I already have a ton of these I want to implement:

 

Check if enemy is poisoned, then cast haste enemy.

Check if ally is poisoned, then cast slow ally.

Check if enemy has 50+ armor, then prioritize target for elemental damage. (Staves too!)

Check if unit is powerful, then cast enchantments to make it invincible.

Check if unit is powerful, but wounded, then cast regeneration.

Check if hero has 4 or more injuries, then cast Restore Wounds. (Spell coming soon to Path of the Healer)

Check background stats for weapon types, then prioritize countering weapons to focus on that unit.

Check background stats for unit types, then prioritize weapons and spells to counter.

Check background stats for summons type, then have caster cast a counter-summons. (You cast Fire Elemental, I cast Greater Ice Elemental.)

Check power rating and level, then prioritize attacks on weakest units.

Check hp and armor, then avoid units with a high number.

 

There is so much that can be done here to let the modder fine tune the AI. We can also teach the AI how to use new spells, like my wider hastes and slow spells. The only question is where this new tag works and where it doesn't. I would even try it to teach the AI how to play basic parts of the game better, once a mod is added. Like choosing Tower over Town or Conclave with a nice little wrapper.

18,826 views 17 replies
Reply #1 Top

These features are about future proofing.

Not for 1.0 but rather post 1.0 so that modders (and myself) can make the tactical battles far more sophisticated in the future.

Reply #2 Top

So do the tags work right now? If not, that's fine. As long as they get turned on at some point, I love the design concept.

Reply #3 Top

alot of these would help to train new players as well as add spice - when they see something smart the ai has done to them they can 'monkey see monkey do' and love the game more for it

- this game is seriously great right now (having lots of fun tryin different strategies) , when's the next vote? (EXCELLENT!!!) - I recently had the change of 'having to play it to wanting to play it'

Reply #4 Top

Check if enemy has 50+ armor, then prioritize target for elemental damage. (Staves too!)
End of quote

Right idea but more like 10+ armor. Then the AI should be using dmg spells against them, or curse when the enemy is in combat.

Check if unit is powerful, but wounded, then cast regeneration.
End of quote

Indeed, if a unit has a above average armor or attack value and is under 50% health it should be healed.

I guess the AI should be prioritizing high armor and attack units for pretty much every spell, which it probably already does.

Check background stats for weapon types, then prioritize countering weapons to focus on that unit.

Check background stats for unit types, then prioritize weapons and spells to counter.

Check power rating and level, then prioritize attacks on weakest units.

Check hp and armor, then avoid units with a high number.

End of quote

I find that the thing players usually do, and it makes sense, is something like  targeting the unit with the highest value for Attack/(Defense+(HP/5)). That way you take out their glass cannons first, overall good units second, and low attack high defense units last. Everything else is very very secondary.

Reply #5 Top

well i still have some doubt

 

while i love this new concept there is some flaw in it

i mean is target worthy comes when the spell is already casting

so i dont care much of that, i mean, its way way better to decide who to buff, who to damage etc etc, but the point is ai already took one big decision

and all this calculation on target worthy should come much sooner

i mean ideally ai compare prior to deciding what to cast

i have spell A B C

A is dmg and can apply on target x, y z

B is debuff and can apply on x y z

C is heal and can apply on j,k

 

here should be a "calculation" of what is worth and what no

i mean should "compare" Ax, Ay... Cj,CK and see what work and what is not

 

and then someway decide

putting the variables only after the choice of A, B C seems too weak to me

Reply #6 Top

But this is not a system we can use to put priority on targets, right? All I see is a system to prevent AI from making stupid spell decisions such as casting Firedart on a Fire Immune target.

Reply #7 Top

If you look at the actual code, it is a calculation on the AI Value tag. I would have to test it, but the simple logic is that the AI is using that priority to decide which spell to cast. It seems the AI chooses who to perform an action on based on this number. A higher priority on stoneskin, causes the AI to cast stoneskin before any other spell. A higher priority on flamedart causes the AI to cast it before doing anything else. I would have to test it further, but if that is the case, we can manipulate the whole battle based on how much the AI values things. It is already capable of making the complex decisions, we just need to tell it how valuable each option is.

Ex:

The AI has a high priority on casting damage spells early on. It looks for targets. Any target with high armor passes the IsWorthy calculation. 

The AI has a high priority on casting healing spells later on. Any friendly unit that is below a certain Hp passes the IsWorthy calculation. 

 

This simple logic can be expanded in any direction with different calculations. I already do this for city improvements and the AI is very good at following my calculations. My mod only has Conclaves on Essence of 2 or more. It only has Fortresses on tiles of 3 or more Materials. The only thing we might need to wait for is the finished tactical AI to get the internal tactics right. From there AI Values are a good way to teach the AI.

Reply #8 Top

Frogboy can you tell us a little about how the wrapper works?

Reply #9 Top

I haven't implemented the code yet. But what I would have it do is have it adjust the priority of the target.

Reply #10 Top

It would be very useful to have something like that, although I don't quite understand the calculation and how it will impact priority. Looking forward to seeing it in use!

Realistically, all the tactical spells could have things like this to make the AI much better at targeting weakness and countering strength.

Reply #11 Top

What we have today is a lot of hard coding by me on the spells. Not by name but by what type of spell they are. And it's tough because I'm not really that good at tactical battles.

What I do is give a value to each enemy target and then combine that with a value for a particular spell on that particular unit.  It works reasonably well but you still see stupid stuff sometimes because my own familiarity with spells is limited (for instance, I didn't know about coal stones until recently and now it's on and people are saying it's OP'd <grin>).

What's in there now is fairly sophisticated in terms of AI logic. I think it meets the "generally smart but specifically stupid" criteria of AI.  The hardest part for me has been learning the best tactics to save my units from total destruction without it costing the player the overall battle -- knowing when to run.

What I would like to do is hand this over to the community.  You guys would put in a formula to determine the value of a particular spell on a particular unit. I call that and whoever comes up with the best value gets whacked.

 

Reply #12 Top

That would be great for my more complex spells. Like the one that locks a unit into a faster timestream and poisons him. Hehehe...

Reply #13 Top

Could always try genetic algorithms and have the AI learn by doing. The major difficulty there is developing the weight function you use to evaluate outcomes. But if you put a little thought into it, you can actually make it very objective.

 

Just make sure you set the WILL_BECOME_SKYNET criteria appropriately.

Reply #14 Top

Have the IsWorthyTarget things been implemented?

Reply #15 Top

The best discovery I've made in all this is the existence of boolean-type tests in calculate tags. By that I mean things like "Armor > 5".


This is going to be extremely useful combined with Heavenfall unitstats libraries...

Reply #16 Top

Bump again. Has this tag been implemented? How is it being used?

Reply #17 Top

Quoting Heavenfall, reply 17
Bump again. Has this tag been implemented? How is it being used?
End of Heavenfall's quote