Are you, in fact, a pregnant lady who lives in the apartment next door to Superdeath's parents? - Commodore

Create an account  

 
AI planar movement strategy

We've improved the game mechanics regarding to when the AI is or isn't allowed to travel to the other plane, however, the AI is still dumb as brick on deciding where to go.

I don't remember whether we discussed this in detail and had a "can't be done" conclusion or not, if someone remembers, please tell me.

Either way the problem is, the AI decides whether to move into a tower and switch planes depending on one thing - if it's the plane they have their fortress on, then they switch planes.
So when you banish the Myrran wizard, and they return to the Arcanus plane, all their otherwise idle troops will go back to the tower and stay on Myrror doing nothing - assuming you raze the cities there instead of trying to keep them, the units will be as good as never existing.
This is obviously very bad for the AI and reduces their chance of winning drastically.
In most other cases, the current simple decision is good enough, but in this particular case it's very bad.
Reply

We definitely discussed this. I don't recall it being ''cant be done', but there a lot of issues.

For me the simplest suggestion might be 'move to the plane with the most number of enemies'? Instead of 'other'?
And don't include allies as enemies EXCEPT when all remaining wizards are allies.

Base 'most' on number of units if possible.
Reply

Might also need a seperate check for settlers, send settlers to plane that you own the least cities on.
Reply

Oh yeah, settlers, that was one of the complicating factors. Not that the AI had a plane shifting strategy for those either, they were just sent to the tower at a random chance, or if nothing else was available, and once there, they either shifted plane or not the same way as other units. Considering towers stay closed for a while now, I don't think the AI really needs a settler plane shifting strategy separately, space will be used up anyway unless major razing happens. Although settlers do need the exact opposite logic, move away from trouble and towards peaceful areas... except, in peaceful areas they won't find free space most likely, unless two other people are razing each other...
Meh, I think we should just go with "always change plane if stack contains a settler". It's not like the AI sends all their settlers into the tower, so those that do get sent, better make it through.

That leaves how we define "enemy" and "most".
War targets are more enemy than nonwar targets, which are more enemy than wizard pact targets, which are more enemy than Alliance targets. So I guess worst treaty status in that order should take priority?
Problem is, amount and strength of enemy also matters. A war target with 2 remaining cities shouldn't be as important as a nonwar target that has 30 cities. A plane with 3 nonwar wizards should or should not be as important as a plane with 1 war target? Do we tally them by plane, or do we look at the other wizard's fortress location? What if the wizard is banished?

Ok, number of units, that makes sense. But we'll need to weight that number based on diplomacy status.

So a war unit being worth 10, a nonwar unit being worth 5, a wizard pact unit being worth 2 and an ally unit being worth 1 would make sense? What about peace treaty, maybe 3? Neutral units? Unclaimed lairs/nodes?

Funny thing, if we do this, the AI automatically learns to block towers when staying on their current plane. Units with nothing else to do will still move into the tower, but they'll not shift to the other plane so they get stuck there until they manage to target something on their home plane.
Reply

I don't know if diplomacy means that much . Whether they're at war, or simply hostile, it's probably going to end up the same way. A wizard pact is probably worth less, and an alliance less than that - but a wizard pact, particularly with a human, is no guarantee. 

On the other hand an alliance is pretty safe.

But we're talking about trying to get across planes, that the AI doesn't understand at all. I'd much rather they get across when there's any doubt rather than worry too much - they'll still always have troops on their original plane.

If you need to weight, I'd do more like war/hostile/peace = 5, wizard pact = 3, alliance 1.
Reply

It's worth quite a lot, actually.
Would you rather have your entire army on a plane where you have a peace treaty or no treaty with everyone, or on a plane where someone is actively conquering your cities?
Let's say the human and the AI are on the same plane and are at war. The AI has no treaty with (or has a peace treaty with) another AI on the other plane, but that other AI has twice as many units as the human.
If the AI decides to move there, they'll be vulnerable to the human player's attack, while they achieve absolutely nothing on the other side (they either don't get into a fight or if they do, they end up fighting the stronger person and lose on both sides. The outcome of winning on the other plane to the extent that it's worth neglecting the ongoing war at home is by far the least likely, not saying it never happens but the AI shouldn't bet on that. Also we particularly want to avoid "strong vs strong" AI wars and help "strong vs weak" wars, the existing diplomacy system works towards that goal.)

Speaking of which. It isn't as black and white as "more units". AI players generally have more units (at least 2-3 times as much) as the human, but the AI players are also much less likely to break a treaty and attack, or in case of a peace treaty, completely unable to. So going after the more units will result in the AI ignoring the human and losing to them more often than not. Maybe the human needs a different multiplier for each treaty status?

War/None/Peace/WP/Allience
Human : 12/8/6/4/2
AI : 10/5/3/2/1

But even this is wrong. How much presence you need doesn't always depend on how much enemies are in a particular plane, it also depends on how much you have to gain (or lose) on a plane. If an enemy has 75% of their units in one plane, but 75% of their cities on another (probably fighting a different enemy/planning an invasion), then attacking the plane where they have the 25% is the correct move - destroying the cities deals way more damage to a player than destroying their units, and the absence of units makes it the perfect opportunity.
Maybe we should base it on cities afterall? 
But that's also wrong. If we send all our units away to the enemy plane for cities, when the enemy has their forces on ours, ready to strike, it might make self-defense hard. Or maybe not? No, it won't. The AI already does follow the strategy of trying to destroy more enemy cities than the enemy can do to theirs through numerical advantage. So sending the units to the other plane is what it should be betting, not leaving them around their own cities. The human will raze anyway, leaving nothing to retake.

So I think it should be based on number of cities owned, weighted by treaty status, (possibly ignoring peace treaties as they are temporal - they are absolute for another AI but they are guaranteed to expire even then) with different weights for human and AI players. Not sure about the numbers though, in city count the human won't be as behind as in unit count. But they still need more attention as they are more likely to backstab, as well as they are what the game is for. If an AI fails against another AI, no one will care too much, in fact it makes the game harder as the other AI will then be twice as big. But if the AI fails against the human, the human will be disappointed. (or happy for finally scoring an easy win, but that's not the design goal :D )
Reply

But we're not asking if WE (humans) want to do this; we're asking what the AI wants to do. And the biggest speed bump is that the AI is simply SLOW at crossing planes, even if we get this algorithm correct. That means it is going to take a long time for it to move enough troops from one plane to the other to matter, regardless of what algorithm we choose. Which means, the plane where it is creating troops (generally, the home plane) is always going to have a lot of troops in it, regardless of what rule we have.

Therefore, my proposal is based around the fact that the AI is most dangerous because of build up time. It needs to get a swarm of troops into enemy territory BEFORE any war starts. Now if it's already at war on it's unit-creation-plane, then MOST of those units are going to go off and select immediate targets - they aren't going to cross. So that situation is already addressed REGARDLESS of what we do for this algorithm.

The only time these troops have a chance to cross in any significant quantity, is when no targets are available close enough to them anyway for them to go anywhere on their home plane (in which case they aren't going to help the war effort on the home plane anyway, so they may as well go get ready for a war on the other plane in the meantime!)

GIVEN THAT, yes, I DO want the AI to cross to swamp a wizard pact wizard - because a wizard pact will USUALLY end up in war. And the AI needs to have the troops ALREADY in position when that war breaks out. If the troops aren't there already, the AI simply will not be dangerous even if a war has started. If the wizard pact instead results in an alliance, well, that's too bad; now it's got a bunch of troops there. And they'll eventually cross back onto the home plane because the alliance wizard is suddenly no longer much of a factor. Or they'll just sit around, and if the alliance DOES betray them *cough chaotic AI or human cough*, then they still have some troops already ready.


The only big exception to this, will be if the AI has a species that never gets inter-continental travel units, and is life/chaos (AND doesn't have chaos channels/doom mastery), AND has multiple towers on its home continent. In that particular case, it MIGHT be better for the AI to stay on its home plane during war, regardless of who is on the other plane, because a lot of its own troops are going to take FOREVER to get to the enemy continents on that plane. However, that's an EXTREMELY niche case - I don't think it needs to seriously be addressed, and certainly not at the expense of the standard AI (which will be 95+% of enemies).
Reply

Quote:And the biggest speed bump is that the AI is simply SLOW at crossing planes, even if we get this algorithm correct.

That's somewhat true and unfortunate (though with 9 towers and the AI being allowed to send multiple stacks into a tower it's actually not that bad... yes it's at most 1 stack per turn per tower still but it was much worse than this.)

However it's not relevant. If the AI is slow to move into the other plane, it's also slow to come back. So going to the wrong place is even less desirable.
Also, no, the units being built won't really satisfy the AI's needs for the home plane. Going through the tower is slow but, building up quality stacks is slower. Especially doomstacks.

It's a bit harder to judge this based on my recent games because the Myrran wizard will have tons of troops piled up so yes, they will have a lot left over on Myrror even if they do enter the tower. But that's not a case that matters, in that scenario there won't be another player on Myrror anyway.

I have doubts about a wizard starting on the same plane as a human, will have so much troops built up that the towers can't swallow most of them. And those freshly produced troops will not be properly organized, they'll be easy to destroy before they form larger stacks, or they'll attack without waiting for more units.

Then again, if the troops already left then starting to keep them when the war is already on is too late indeed. As is trying to send them at that time.

So we have a timing problem, we'd need to predict the diplomacy status in advance. That's not something the AI can do.


Either way, I find it the most important that the AI should base their plane shifting decision on similar goals as their diplomacy.

-So we generally wanted the AI to fight other AI and refuse peace if they are winning it, so stronger AIs get to eliminate weaker ones and become even stronger. (This would imply go towards the weakest enemy)
-But wanted them to not fight and make peace if neither side is really winning and the war is in a standstill (this means the AI should go away from strong opponents to minimize battle opportunities)
-We wanted the AI to always be prepared to strike back at the human because the human is allowed to attack them any time, and if they don't meet enough resistance, they won't have fun / win too easily.

...based on this, and what you say, maybe we want to keep the AI a simpleton and go with "always go towards the human player's plane", based on the number of their cities. It might be a bit excessive though, and during the early game, the AI not racing with the human to expand into the other plane (during peace) is a mistake...  but do it and they are vulnerable to an attack from them, idk...
heck, the AI won't expand into the other plane through military, they do it by settlers. Military won't do a thing.
Problem is, let's say the human allies with an AI and both declare war on the other plane. The human will rightfully ask "why is the AI not going to the other plane to attack our enemy"...
And then we are back to weighting everyone based on their treaty status and being human or not. Except, we also want to look at different things and in a different direction. (AI shouldn't even care about other AI during a WP or alliance. They'll never fight each other. During neutral/war, they should prioritize the enemy with the most cities but fewest units in a plane and go to that plane. Against the human the AI should prioritize the plane where the human has more cities, but this shouldn't outweight AI wars if the AI is not at war with the human...)

This is getting crazy overcomplicated and we aren't even near the solution or using actual numbers. We'll need some more generic rules to separate the possible cases instead (there aren't all that many?) and figure out how the AI can recognize each. Weighted priorities won't work for it.

Something like

0. If the stack contains a settler, go to the other plane. (the settler will keep swapping planes until it manages to find a target on either side)
1. If the AI is at war with or hostile towards the human, go to the plane with most human cities.
2. Otherwise if the AI is at war with or hostile towards any other AI, go to the plane where that AI has the most cities.
3. Otherwise if it's before turn 200, go to the other plane (where the AI doesn't have a fortress)
...do we even need this? Unsure. The AI might conquer neutrals or hunt lairs there, and will generally need some troops to defend their cities if they sent settlers, but it might make them too weak against an attack on their home plane. Albeit if the attack does come, the units will be coming back as soon as they have no targets on the other side so maybe it's ok. At this time period we are talking about much fewer stacks than in the endgame.
4. If none of these apply then go to where the human has most cities anyway.

would that work? Am I missing any important case? Are we ok with not distinguishing between war and hostility? I'd be rather annoyed to see the AI dedicate all their forces on me when we are not at war but they are with someone else, so probably not.

then...

0. If the stack contains a settler, go to the other plane. (the settler will keep swapping planes until it manages to find a target on either side)
1. If the AI is at war with the human, go to the plane with most human cities.
2. Otherwise if the AI is at war with any other AI, go to the plane where that AI has the most cities.
3. If the AI is hostile towards the human, go to the plane with most human cities.
(4. Otherwise if the AI is hostile towards any other AI, go to the plane where that AI has the most cities.)
5. Otherwise if it's before turn 200, go to the other plane (where the AI doesn't have a fortress)
6. If none of these apply then go to where the human has most cities anyway.

Maybe we don't need step 4? If we don't go there, we won't trigger an unnecessary AI war. Yeah I think skip step 4.
Wait, one more thing. Jihad hostility. Those need to be before normal wars... but also need to be based on fortress location.

0. If the stack contains a settler, go to the other plane. (the settler will keep swapping planes until it manages to find a target on either side)
1. If the AI has Jihad hostility towards the human, go to the plane of the human's fortress.
2. If the AI has Jihad hostility towards another AI, go to the plane of that AI's fortress.
3. If the AI is at war with the human, go to the plane with most human cities.
4. Otherwise if the AI is at war with any other AI, go to the plane where that AI has the most cities.
5. If the AI is hostile towards the human, go to the plane with most human cities.
6. Otherwise if it's before turn 200, go to the other plane (where the AI doesn't have a fortress)
7. If none of these apply then go to where the human has most cities anyway.

...anything missing now?
1 can be abused by Move Fortress, but if the Jihad was triggered by SoM, it's necessary even at that price...
Did we do anything to make the AI go into the towers during Jihad or did we merely allow them to attack enemies there ignoring strategic strength? I think the latter?
Reply

The latter.

I think that last set is pretty good, but I'd put settlers below jihad, not above. During jihad, you don't want a random settler 'eating' a doomstack. Might even put the 'war with human' before settler (but not war with AI, or hostility).
Reply

While implementing this, I was thinking that maybe we need to revisit our decision on AI Planar Travel ban, as a lot of changes related to it happened.

-The AI will now keep the units on the plane where a relevant war happens once I'm done with this.
-If we allow the movement only when a tower is opened, the "unfair" factor is mostly eliminated, as that tower had to have been opened by the human so they have access to the other plane already.
-The problem of dropping single units, especially heroes, still exist but slightly reduced, as there is a "buildup" time where the stacks can gather before the tower opens and allows the planar movement. Past that initial turn, the units will go one at a time though. We can also reconsider having Planar Travel that works on the entire stack -but that would be inconsistent with Shadow Demons, item abilities, and would require a rare Life spell to become uncommon, as well as probably being excessively hard to implement, so I rather not.

Ultimately, there have been a lot of improvements, but the core problems are only reduced, not eliminated - simply having an open tower does not guarantee the human has the capacity to fight the Myrran wizard, and that wizard might even end up conquering everyone in Arcanus. We've seen the Myrran relative advantage is maximal around 1410. Also, the player would lose their chance to contain the problem by blocking all towers, which we agreed is a desired feature. Furthermore, the AI will still end up losing heroes or other units through stupid plane shifting, just not as many.

So I think we should still not allow the AI to use Planar Travel and Plane Shifting.
Reply



Forum Jump: