June 25th, 2016, 07:00
(This post was last modified: June 25th, 2016, 08:02 by Seravy.)
Posts: 10,492
Threads: 395
Joined: Aug 2015
We have several ways the AI can declare war, and all of these only look at the two players involved, the AI declaring war, and the target. None of them consider the global situation as a whole. I believe this has to change.
In short, it would be a lot more reasonable if the AI was unable to start a war through the "generic" war sources - retribution for a threat, attack or hostile spell obviously won't and shouldn't be affected - if their military power is less than the sum of the military power of all players they are already at war with plus the intended target.
In short, the AI should not start a new war if they do not have enough forces to do it.
The formula could be
Sum(existing enemies military)+war target military>own military*1.5 then skip the war declaration.
This would
-reduce the chance of an AI player getting themselves eliminated by picking a fight with everyone
-slightly reduce the pressure on the human player as some wizards that are normally guaranteed to declare war might be too busy to do so
-prevent the AI from ever declaring war on people way stronger than themselves without provocation.
-prevent a situation where a strong AI makes a very weak AI declare war on a way stronger player.
-increase the value of peace treaties since the AI wizard might get into a war with someone else that they otherwise might not do, which might prevent them from declaring war on the human player after peace expires.
The war (and treaty breaking) sources that get affected would be the militarist, the generic, the alliance based and the relation/difficulty based DoWs, chaotic skips the procedure where I can apply the check and would remain unaffected, which makes sense anyway.
The question is, how much should the constant, 1.5 in the above example, be? Should the AI be able to fight two players equally strong as themselves? Only one and a half? More than two? Or we could base it on personality, like Peaceful does at most 1.25 and maniacal goes up to 3 for example?
Posts: 488
Threads: 51
Joined: Apr 2012
This looks ripe to be gamed by the player. Just make sure the scary adversary has a war or two on his hands, and you'll be safe.
Posts: 10,492
Threads: 395
Joined: Aug 2015
(June 25th, 2016, 17:43)Tiltowait Wrote: This looks ripe to be gamed by the player. Just make sure the scary adversary has a war or two on his hands, and you'll be safe.
Exactly. Until they make peace, at least, then the situation might reverse.
It's pretty hard to make two AI wizards stronger than you fight each other though, unless they do it on their own.
Also, if they are scary enough they'll be able to handle a third war
June 25th, 2016, 17:47
(This post was last modified: June 25th, 2016, 17:53 by namad.)
Posts: 520
Threads: 8
Joined: Jul 2011
At least 2 or 3 for the constant. If this is done at all.
Often the best way to win a war of master of magic is to attack someone much stronger than you. Why? well because they're only pulling away from you anyways so even if you're not that likely to win, you're only getting less likely as time goes on.
That said if this doesn't effect undeclared wars, maybe that's fine. An undeclared war being a situation in which there is no peace treaty and an enemy wizard issues a surprise attack order which results in a city changing hands which automatically triggers a war.
Actually though I'd be 100% okay with using a constant of 1.25 or 1.5 IF this entire section applied only to wars the ai declared on other ai players.
On extreme and impossible the player will almost always not be the player with the largest armyscore, but their armyscore will be the most efficient and well placed. Making it almost pointless to add anymore code checks to the players armyscore to the game.
Or alternatively you could use a formula like: (Sum(existing enemies ai military)+war target ai military)+difficultysetting*playerarmyscoreifplayerisatwarwithyou>own military*1.25 then skip the war declaration.
Where difficulty setting is the bonus in the difficulty setting to power? So roughly 1.0-3.0..
Honestly I've seen games where an ai player has 30-50% of my army score and their best move every single turn would be to declare war on me. Because I've choked them off, placed single military units on all their possible settler city locations, I've got 3times their cities and they're only falling further behind. At least if they attacked me they'd annoy me a little and maybe disrupt my plans.
Then other times a ruthless AI with double my army score will be in an alliance with me and declare war suddenly out of the blue and it's a brilliant and devastating move as my entire army is across the world wiping out a small ai player with half my army score and a quarter of his.
June 25th, 2016, 18:10
(This post was last modified: June 25th, 2016, 18:14 by Seravy.)
Posts: 10,492
Threads: 395
Joined: Aug 2015
(June 25th, 2016, 17:47)namad Wrote: At least 2 or 3 for the constant. If this is done at all. You mean for the worst personality (maniacal) or the best (peaceful)?
I was thinking 1.25 for peaceful and +0.25 for each personality below that, so 1.5 for lawful, 1.75 for chaotic (they will do war anyway through their personality), 2 for aggressive, 2.25 for ruthless and 2.5 for maniacal.
Maybe +0.5 would be better? That makes it 1.25 peaceful, 1.75 lawful, 2.25 chaotic, 2.75 aggressive, 3.25 ruthless and 3.75 maniacal?
Or we can do 1.33, 1.66, 2, 2.33, 2.66, 3? I actually think this might be the best.
(June 25th, 2016, 17:47)namad Wrote: Often the best way to win a war of master of magic is to attack someone much stronger than you. Why? well because they're only pulling away from you anyways so even if you're not that likely to win, you're only getting less likely as time goes on. True for the human player. False for the AI. The AI lacks the intelligence advantage that helps winning wars against a stronger enemy. The AI is fighting against itself so the stronger will win and eliminate the weaker since they are equal otherwise. The only exception being the maniacal and ruthless personalities who might win through sheer spamming of curses even if army total is much lower - but they'll have the highest modifier to do wars, so no problem with that.
On the other hand if the weaker keeps peace, eventually they'll also manage to research/build something that's a threat : There is no "stronger" than a stack of 9 very rare creatures. If the weak AI can survive until then, they are just as relevant to the game as the "strong" AI who has 5 of those same stacks. If they play Sorcery they might even blast SoM until they can cast their own. (June 25th, 2016, 17:47)namad Wrote: That said if this doesn't effect undeclared wars, maybe that's fine. An undeclared war being a situation in which there is no peace treaty and an enemy wizard issues a surprise attack order which results in a city changing hands which automatically triggers a war. It doesn't. Undeclared wars, also known as Hostility are purely random chance and relation based. If such attacks are successful war starts as normal. Wars resulting from repeated warnings (like casting armageddon) are also unaffected, although warnings can only be made towards the human player so AI wizards might tolerate each other doing that.
One thing to keep in mind, AI players make peace with each other relatively easily, at which point the opportunity to declare war on the human player opens up, so this "no war" thing will often be temporal. Ofc the human player can do the same, make peace and shift the war towards someone else.
June 25th, 2016, 19:01
(This post was last modified: June 25th, 2016, 19:09 by namad.)
Posts: 520
Threads: 8
Joined: Jul 2011
The problem with it being temporal is that when peace is made the ai doesn't instantly re-evaluate the wars it skipped due to this code. It has to wait for another random low chance trigger. If you want this part of the code to cancel a large number of wars maybe you should also increase the odds for those random checks to trigger?
I didn't actually think this should have anything at all to do with personalities. Personalities already determine how likely someone is to want to end up at war. It doesn't also need to determine how likely they are to end up at war, again, another layer. That's like giving the ai 300% bonus power AND 300% bonus mana. They'll stack and have more effect than intended.
Another thing I realized is that the formula should probably be:
(Sum(existing enemies military)+war target military)-(Sum(existing enemies of target's military score))>own military*1.5 then skip the war declaration.
Regardless of what you do with the constant or personalities.
There's no harm in attacking someone powerful who is already losing a 3 front war.
I also disagree about there being nothing more powerful than a 9 stack. The ai doesn't comprehend the value of targets and an enemy AI with one 9 stack of very rare's can be slowed down by placing chaff in it's path, whereas the AI with 5 stacks will have 5 times the chance one of them will attack a key choke point.
You're right though. That weak AI in my example game with half my army score wouldn't've benefited from attacking me randomly. They however would've benefited greatly from waiting for me to declare war on someone else and then attacking me. Hence my proposed change to the formula. A weak ai should attack a strong player, but perhaps only if that strong player is in another war already.
Then again if they disrupted my plans slightly another unrelated player might've pulled ahead of me. So I think maybe this code should apply only to AI versus AI war declarations. This would prevent AI's from killing themselves unnecessarily but it wouldn't prevent ai's who hated the player from disrupting their strategies slightly even if they were too weak to win against the player.
Other variations I think are too complicated and pointless:
(Sum(existing enemies military)+war target military)-(Sum(existing enemies of target's military score))+((Sum(allies of target's military score))*0.5)>own military*1.5 then skip the war declaration.
Or even maybe (Sum(existing enemies military score+war target military)-(Sum, all enemies of enemies that aren't also your enemies warscore)>own military*1.5 etc etc.
Posts: 10,492
Threads: 395
Joined: Aug 2015
(June 25th, 2016, 19:01)namad Wrote: The problem with it being temporal is that when peace is made the ai doesn't instantly re-evaluate the wars it skipped due to this code. It has to wait for another random low chance trigger. If you want this part of the code to cancel a large number of wars maybe you should also increase the odds for those random checks to trigger? Fortunately that "low" chance is pretty high.
Militarist war check is done at a 1/3 chance per turn.
Generic (equal army) check is done at 1/7.
Alliance check is somewhat lower, 1/15, while the chance of a purely relation/difficulty based check depends on the relation level, at least 1/20 but can go up to 1/6 at "hate" relation.
A typical peace treaty lasts 15-40 turns at random unless broken, which is enough time to trigger most of these war sources at least once.
Quote:Personalities already determine how likely someone is to want to end up at war.
Yes, but not on all sources.
Also personality unfortunately balances itself out, which is the main problem. The more peaceful the personality the higher the chance they'll make allies...but an ally's enemy is my enemy so they'll be more likely to enter war the more allies they have. It only takes one ally who is at war with the entire world to be at war with the entire world. Unless everyone joins in a big alliance, peaceful tends to backfire.
Quote:There's no harm in attacking someone powerful who is already losing a 3 front war.
This would be true in real world politics, but not for MoM AI.
Here is the harm : You declare war on the guy who is already losing a 3 front war but is stronger than you by a lot anyway. He has been at war for a while and is losing so he needs peace...so he asks for peace from the other 3 guys. Not from you since you recently declared the war and relation is the lowest possible. The other 3 guys accept the peace because AI players can't refuse other AI players, that just doesn't exist in the game. So now you are stuck in a war with the strong guy who has nothing to worry about except attacking you for another 15-40 turns.
Yes, this is the worst case scenario - it's not very likely for all 3 peace treaties to go off at the same time - but it's possible and it's even more possible, in fact very likely if the strong guy is only in 1 war, which they're losing 3 times as badly, in which case the formula gives the same results.
Quote:The ai doesn't comprehend the value of targets
They do. They'll never attack a spearmen if they are powerful enough to attack a city right next to it - unless the city is unreachable without killing the spearmen in the way. This isn't Insecticide anymore where the AI preferred to walk through tiles taken by the human player just to be more aggressive, I have time to do better than that, fortunately.
Quote:They however would've benefited greatly from waiting for me to declare war on someone else and then attacking me.
Wouldn't it be even better for them to wait until your army power drops in that war and attack then when it's under the threshold?
The best example for this I can bring is the game Hadriex played. He defeated a wizard, but let them keep the fortress. Then that wizard kept declaring war on him then asking for peace and/or wizard's pacts once every 10 turns, since they were allies with the 3 strong guys left in the game. Aside from annoying the player, this didn't help them any, and caused them to waste their troops before they could have become relevant again. And of course risked getting attacked and eliminated from the game : The only reason it didn't happen was Hadriex thought the wizard has Spell Blast to stop Spell of Mastery for him.
Although the largest reason for rejecting this would be the following :
What made me add this check was too many AIs declaring war on the player at the same time : I wanted at least something that reduces the chance of an AI declaring war because it was way too high : 2 objectives and 1 personality guarantees war as well as having enough opposite books, or having any ally that matches any of these conditions. Each of these on its own is fair, but the chance of none of this being true for a random wizard is surprisingly low. Games where 3-4 wizards declare war are frequent, games where no one does are extremely rare.
As your suggestion aims for the opposite goal, multiple AI ganging up on the human player at the same time, I have to say no to it. Every AI declaring war at the same time happens way too much already, and the game is way too hard to beat on extreme - forget impossible, I don't even try when I lose 50%+ of my games on extreme...and this is after 3 consecutive AI resource reductions.
A weak AI will still attack a strong player - if the difference is no more than 2-3 times, and they aren't in another war - and if their personality allows. In particular, a maniacal or ruthless wizard declaring war has a huge impact : they'll spam curses on the player. A more "normal" personality will use those less frequently, and thus will not be much of a threat - at a 2-3x military difference it's reasonable to assume most of the stacks the AI can build will not take any valuable cities - The player is in a war so they are maintaining large garrisons since they are expecting to get attacked.
Posts: 520
Threads: 8
Joined: Jul 2011
Yes. My goal is to improve the AI's ability to win the game without cheating.
Making them declare fewer suicidal wars against other AI's accomplishes that goal.
An ai wizard in a multiple front war will most often allow the weaker ai to steal a free city or two as the bulk of his forces are deployed on a far away front of the war lines. Yes, rarely the AI trying to dogpile will get screwed. Dogpiling however is a high level human strategy seen in all competitive turn based pbem strategy games.
I actually don't notice the AI declaring war on me that often. Maybe that's the outlier.
In fact the AI started declaring war on me a lot less when I went from extreme to hard.
Maybe if you don't want every AI to gang up on the human at once you should look at the bonus to odds to declare war given by extreme/impossible difficulties?
You can also just do both at once. Use this anti-suicidal code to prevent the AI from declaring suicidal wars. At the same time still allowing them to dogpile. Then if you think that means there are too many wars against the player. Level the code's math based on difficulty so that every ai is equally likely to declare war on the human player regardless of difficulty? (Higher difficulties will still result in ai's with higher army scores which still results in more wars and more dangerous wars for the player.)
Of course you're free to do what you want. I am just trying to help brainstorm the optimal formula for this part of the code, despite my lack of knowledge about code. I see this somewhat as the upkeep bug issue. If you improve the ai, and improve the ai, and improve the ai... making it smarter all the while. I don't see any problem there, if the ai is too difficult when it is smart and powerful, then reduce it's cheating slightly. IIRC the code makes ai wizard's more likely to declare wars on players playing on a harder difficulty, that's true right? (or is this just observation bias on my part?)
Posts: 10,492
Threads: 395
Joined: Aug 2015
(June 26th, 2016, 02:29)namad Wrote: IIRC the code makes ai wizard's more likely to declare wars on players playing on a harder difficulty, that's true right? (or is this just observation bias on my part?) Yes although most of this effect is indirect.
Alliance war declaration : not related to difficulty but on higher difficulty the AI is more likely to get allies.
"difficulty" war declaration : chance of war is not based on difficulty, number of players doing it is : war is not declared if existing wars>difficulty level.
Chaotic, militarist, generic : directly modifier by difficulty
militarist : AI is more likely to have larger armies on high difficulty, amplifying the effect
generic : AI is more likely to have larger armies, reducing the chance of war here since it checks for the AI and player being near equal.
In my experience, 3v1 and 4v1 early war games are unwinnable (on extreme), even if the player manages to survive, they won't be able to make much progress or expand since all their forces have to be used to defend. So the AI should not intentionally try going for that. It's fine if they throw in some sneak attacks and curses though. Chances are the player will retaliate and trigger a war anyway.
June 26th, 2016, 06:56
(This post was last modified: June 26th, 2016, 08:32 by Seravy.)
Posts: 10,492
Threads: 395
Joined: Aug 2015
One more thing we can consider changing to reduce the chance of early wars : either changing the starting relation formula, or moving the -30 threshold for the relation based war declaration (although relations count into generic wars, even if you are at only half army strength as them, a -30 relation will get you into a war against most personalities in extreme. I think the difficulty modifier in this formula might need a revision. At the moment each level of difficulty pulls the threshold up by 12 points of relation needed to avoid wars.)
Not sure if the starting relation should be changed or the thresholds for war declaration, maybe the latter?
One more thing. I've just had two wizards getting themselves banished/defeated by another around turn 40-50. The AI cannot be aggressive towards the human player until a specific turn (currently set around turn 36-40) but AI players can start fighting as soon they make contact which is like, turn 5-10 or so if they are near enough.
Do we want AI players to be able to get rid of each other in the early game, which makes games more unpredictable and interesting, but probably less fun and easier to win when it actually happens, or limit them to no wars until turn 40 against each other just like against the human player? The AI prioritizes expansion and exploration until turn 50 so their capital is often less defended than what their most powerful offensive stack contains, so losing a capital is not that unlikely.
|