December 14th, 2017, 18:40
Posts: 5,010
Threads: 17
Joined: Aug 2016
I don't think only letting it grab one will be enough. It would be very complicated (as seravy has shown) to teach the AI when to drop one for a better one.
December 14th, 2017, 18:53
(This post was last modified: December 14th, 2017, 19:01 by Seravy.)
Posts: 10,463
Threads: 394
Joined: Aug 2015
...eh it's even more complicated than that.
For stealing priorities, diplomacy status considers the player being stolen from. So taking away charm of life and crusade is prioritized over other spells during war for that.
But for "keeping" priorities, "being at war" is no longer related to a specific player.
Wait, that's actually good. It means we made a distinction with the intention to deny spells good during war/peace from our enemy, not because we care about which is more profitable for us.
So for the "keep" decision we don't need to care, and just need to set up an order from best to worst enchantment in a generic circumstance.
However the difference of the two lists implies :
If spell A is ahead on B on the "take" list but not on the "keep" list and we can only afford keeping one then
-We'll first steal A. Using "steal" priorities, so high.
-Then we steal B. Assuming we teach the AI this will also be for keep at the cost of losing the other one, this also uses "steal" so high priorities.
-Finally now we'll be stealing A again but as it's not for keep, we use Disjunction priorities.
What this means is there is an additional step of high chance spell removal that is essentially an unwarranted high priority disjunction.
...okay looked into the code.
So we have this.
1. Call procedure that picks a disjunction target with the highest priority and returns the priority. This procedure adjusts priority to whichever spell we know, it uses Binding priority if the target would be a spell we do not yet control, and Disjunction priority if we do. I can insert here to also use DJ priority when the stolen enchantment won't be for keeping. (if space allows. Let's hope...)
2. AI applies every preliminary modifier to wanting or not wanting to use Disjunction. Such as doubling it if owning AEther Binding or having Runemaster
3. AI rolls and selects a spell category to cast. If it's not the Disjunction category it's not relevant for us so assuming it is.
4. AI looks at known spells. If Spell Binding is known, it picks that otherwise Disjunction.
5. AI skips this step if the target is Meteor Storm. Otherwise, it calculates the "fair chance" of using Disjunction based on the number of wizards in the game. Then it rolls the dice, if the result is "reconsider" then we go back to step 1. This is to ensure 4 wizards don't dispel more often than one - or as the "lore" explanation, everyone will prefer wait for the other to do it first instead of wasting their own resources.
6. AI sets the slider value for the spell. This step should be skipped if Spell Binding was picked though the chosen slider value won't apply to it anyway so doesn't matter.
And this is where everything breaks apart. For starters, step 5 should be skipped if Spell Binding - but we don't know if we are Spell Binding, or we are just dispelling a spell using the "Spell Binding" spell as a better Disjunction and don't care about keeping the spell.
...which actually means an AI who is stealing for his own benefit in the current system also has a reduced chance of doing so if there are more players in the game. Which makes no sense...
But the "fair chance roll" can't be used to reduce priority directly. Because priority is a small integer number and rounding would break it.
Okay this is starting to grow into a problem. The dispel procedure only says "dispel that with priority X". It doesn't tell if it's for stealing or removal. And we would need that information. So we'll need an additional return value... well, that is doable I guess.
...but the code for the total mana limit will be messy. We'll need to convert enchantment ID to spell ID then look up the cost, calculate the sum...and do it both on targeting and end of turn "cancel the excess" resolution. I'm not happy with this solution. Is there anything better? More AI friendly? Maybe it's better to just say "2 spells". idk. But definitely not 1. I mean, 1 would be fair, don't misunderstand. But this is the "carry" spell in Sorcery. Their best one. At the very least it should stay slightly above average.
December 14th, 2017, 19:04
Posts: 10,463
Threads: 394
Joined: Aug 2015
Any other ideas? This solution is not bad but it's excessively hard to implement. and even counterintutive for the player. I mean, you'll lose stolen spells automatically at end of turn if you didn't calculate the costs correctly and go over the limit. Without a warning message. Obviously we can't have the game ask "which of your enchantments do you want to cancel before continuing", no such interface.
December 14th, 2017, 19:06
Posts: 5,010
Threads: 17
Joined: Aug 2016
So don't let the AI use spell binding for disjunction.
December 14th, 2017, 19:26
Posts: 10,463
Threads: 394
Joined: Aug 2015
It would still require the AI to return which type of use it is doing from the procedure but I think at this point that's the least of the problem.
The BIG roadblocks I see are :
-The lack of human interface to cancel excess spells so they'd be lost randomly and likely without warning
-Having to actually remember how many of your spells are stolen and how much mana they cost (if mana is used) before using Spell Binding
-Generally taking a lot of work to implement on the AI side no matter what - they'd need to get a separate "cancel this enchantment if excess" procedure on top of being able to predict if their disjunction target will be for "keep" or not.
-Storing "this enchantment is stolen" somewhere. I have an idea for this one but there is no 100% guarantee it works and safe.
December 14th, 2017, 19:40
(This post was last modified: December 14th, 2017, 19:51 by Seravy.)
Posts: 10,463
Threads: 394
Joined: Aug 2015
To be honest I think the greatest problem might be the human player. There is no indication on which spells are "stolen" at all, and no interface to pick what you want to keep or lose. This would be even more of a hell than learning how to play against Spell Blast.
Meanwhile implemented the "Don't reroll if Spell Binding to steal, only if to dispel" by adding the new return value. We need that fixed whether we change the spell or not. It's untested though.
December 14th, 2017, 19:56
(This post was last modified: December 14th, 2017, 19:57 by Nelphine.)
Posts: 5,010
Threads: 17
Joined: Aug 2016
IF we go this route (and I agree it would be hard), ideally I'd want spell binding to show up on the global list with a number showing how much you'd used (like 'Spell Binding 1000/2500). except then people would think you could disjunction the spell binding. um.
ok, yeah i'm not sure where you could possibly put the information on what you've stolen already.
increase spell binding cost to 2500, allow them to steal as many as they want :P
December 14th, 2017, 19:59
Posts: 10,463
Threads: 394
Joined: Aug 2015
lol.
Sounds like we need a new idea then. Too bad, so far this seemed the only one coming close to actually solving the problems.
December 14th, 2017, 20:04
(This post was last modified: December 14th, 2017, 20:05 by Nelphine.)
Posts: 5,010
Threads: 17
Joined: Aug 2016
Can we put it in the spellbook? So the name of spellbinding is x/2500 (or whatever number is chosen); whenever you click on it to cast spell binding, it pops up a message that says 'you currently have x mana stolen; if you steal a spell worth more than '2500-x', you will lose one of your currently stolen spells', and the user has to click 'yes' or 'no' - probably similar to the production buying pop up? (Of course I have NO idea if there are any messages available that could provide that functionality, and in fact, there propably aren't.)
I'm actually serious about the cost 2500 and just allow it to function exactly as it is now.
December 14th, 2017, 20:10
(This post was last modified: December 14th, 2017, 20:11 by Seravy.)
Posts: 10,463
Threads: 394
Joined: Aug 2015
Obviously we can't.
That's like 6 procedure calls right there (converting integer to string, merging strings, etc).
And we also need to let the player know how much the AI has stolen. Which is not trivial if the AI with spell binding has multiple realms. We can't expect the player to remember "Yes, this Armageddon comes from Flandre, that Doomsday from Patchouli but Clow Reed stole both despite owning 6 Chaos books as he didn't get either.".
I mean, maybe they will for those spells but not for things like Crusades or Fairy Rings or whatnot unless it was stolen from them.
...Besides I would still keep going after a warning like that and expect to be able to pick which spell to cancel when I get my new spell.
|