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

Create an account  

 
Mindy - Rules

This thread is intended to discuss efforts to define new AI rules for an external AI program.

I think we should identify bad or missing AI functionality.
And also define rules that would improve it.

Thoughts?
--I like ILSe
Reply

I'll start with a couple issues of bad or missing AI functionality.

  1. AI units never try to break a wall [ILSe].
  2. AI does not effectively chase a unit down.
  3. AI uses earth to mud and spell lock [FrancoK] where and when it's useless.
--I like ILSe
Reply

FrancoK Wrote:I've made a quick example before, but I can expand it.
The task should be very simple (move and break the wall IF we need it) and only if the AI is the attacker. smile

Here's a new version:

1. AI units never try to break a wall
Code:
Break the right tower
IF the AI is the attacker
AND the unit is outside the wall

I've left out conditions like that there need to be city walls, or that the unit needs to have wall crusher.
If those conditions are not met, the rule is implicitly not applicable.

I've added the extra condition that the unit should be outside the wall, because I don't want units that are inside to stupidly attack the wall.

Does anyone see reasons why this might lead to stupid AI behavior?
Or can someone propose a better rule?
--I like ILSe
Reply

I like Serena Wrote:Here's a new version:

1. AI units never try to break a wall
Code:
Break the right tower
IF the AI is the attacker
AND the unit is outside the wall

I've left out conditions like that there need to be city walls, or that the unit needs to have wall crusher.
If those conditions are not met, the rule is implicitly not applicable.

I've added the extra condition that the unit should be outside the wall, because I don't want units that are inside to stupidly attack the wall.

Does anyone see reasons why this might lead to stupid AI behavior?
Or can someone propose a better rule?
I'll try. smile

Starting procedure to see if we need to destroy a wall.

. Am I the attacker? If not exit. 'Instead of checking if the attacker is the AI I prefers the AI checks if it is the attacker, since this works for AI Vs AI, too.
. There is a wall? If no, skip to the end of the procedure. 'No wall to destroy
. There is a defender on the threshold? If no, skip to the end of the procedure. 'The door is open smile
. Is the defender flying? If no, skip to the end of the procedure. 'If the defender is not flying we can attack it, we can change this later if the defender is too powerful
. Can I attack it? If yes, chose if attack with all units or some and go to normal attack procedure; if not go to breakwall procedure. 'Even if it is flying we can be able to attack it, but we can also bring along non flying units to help after the defender is gone.

The AI is weak because there are situation that are not understood by it, basically there is not an WhatIf covering the situation created in a smart way. Either is not covered or the answer is not smart enough.

So bring in all the situation I missed (I'm sure there are some) and let's change the ones I've made, if we can improve them. smile
Only the people crazy enough to think they can change the world of Arcanus and Myrror can do it. rolleye
Reply

FrancoK Wrote:I'll try.

Starting procedure to see if we need to destroy a wall.

Thanks for the feedback!
Let's pick this up when we can actually target the wall.


Currently we can give each unit a command to attack a unit of our choice with melee, with a shot, or with an innate spell.

What does the AI currently do wrong that we may be able to improve?
--I like ILSe
Reply

I like Serena Wrote:Thanks for the feedback!
Let's pick this up when we can actually target the wall.
Well, for ranged units (Colossus, Catapult) we can target a unit close to a wall, breaking (possibly) the wall itself.

. Am I the attacker? If not exit. 'Instead of checking if the attacker is the AI I prefers the AI checks if it is the attacker, since this works for AI Vs AI, too.
. There is a wall? If no, skip to the end of the procedure. 'No wall to destroy
. There is a defender on the threshold? If no, skip to the end of the procedure. 'The door is open
. Is the defender flying? If no, skip to the end of the procedure. 'If the defender is not flying we can attack it, we can change this later if the defender is too powerful
. Can I attack it? If yes, chose if attack with all units or some and go to normal attack procedure; if not go to breakwall procedure. 'Even if it is flying we can be able to attack it, but we can also bring along non flying units to help after the defender is gone.

:breakwall procedure
. Do I have a ranged breakwaller? If no, exit procedure.
. There is a unit close to the wall? If no, exit procedure. 'this part can be improved later.
. Is the wall already broked? If yes go to rearentry procedure
. Shoot that unit. 'N.B. When the unit runs out of ammo, it's no more a ranged breakwaller, so, no extra check is required


Quote:What does the AI currently do wrong that we may be able to improve?

Related to a walled city, if it is defended by a flying unit, AI moves the units able to attack the flying defender; the best tactic IMO is to attack the flying defender (with ranged, throwers, flying attackers) withe units that can do it, while moving the other units close to the door, but not so close to impair other units.
Only the people crazy enough to think they can change the world of Arcanus and Myrror can do it. rolleye
Reply

FrancoK Wrote:Well, for ranged units (Colossus, Catapult) we can target a unit close to a wall, breaking (possibly) the wall itself.

Related to a walled city, if it is defended by a flying unit, AI moves the units able to attack the flying defender; the best tactic IMO is to attack the flying defender (with ranged, throwers, flying attackers) withe units that can do it,

Good point!
Note that the units are actually sort of standing on or in the wall.
Each square contains either a whole or a broken wall.
A whole wall gives the unit on it a +3 defense bonus, while a broken wall gives it a +1 bonus.

I think a ranged unit should then always fire at the unit at the gate, which is (almost) always occupied.
At the very least it would lower the defense bonus at the gate, and it would also eliminate a flying defender.

But now I'm wondering... does that work?
Does the wall actually break if you fire with a ranged unit on a unit standing on the wall?
I can't recall ever having seen that...
Did anyone?


Quote:while moving the other units close to the door, but not so close to impair other units.

I think we have a similar problem here as with the attacking of a tower.
Currently we can't make the units move other than to attack a unit they can attack anyways.
This would require a change to the code for which we would need Kyrub's help...
--I like ILSe
Reply

I like Serena Wrote:Good point!
Note that the units are actually sort of standing on or in the wall.
Each square contains either a whole or a broken wall.
A whole wall gives the unit on it a +3 defense bonus, while a broken wall gives it a +1 bonus.

I think a ranged unit should then always fire at the unit at the gate, which is (almost) always occupied.
At the very least it would lower the defense bonus at the gate, and it would also eliminate a flying defender.

But now I'm wondering... does that work?
Does the wall actually break if you fire with a ranged unit on a unit standing on the wall?
I can't recall ever having seen that...
Did anyone?
Yes. :-)
The reason to attack other units it is because the adversary can have a powerful or invisible flying defender on the door and less powerful foot units around. (that's how I defend critical cities)




Quote:I think we have a similar problem here as with the attacking of a tower.
Currently we can't make the units move other than to attack a unit they can attack anyways.
This would require a change to the code for which we would need Kyrub's help...

I remember units moving to a position, at very least moving to the door.
I'm sure there is a command to send a unit to XY coordinates, as someone said in a thread.
Only the people crazy enough to think they can change the world of Arcanus and Myrror can do it. rolleye
Reply

I like Serena Wrote:I'll start with a couple issues of bad or missing AI functionality.

  1. AI units never try to break a wall [ILSe].
  2. AI does not effectively chase a unit down.
  3. AI uses earth to mud and spell lock [FrancoK] where and when it's useless.

Here are a few additional statements on bad AI and missing functionality. I only talk about battle AI and we should not mix in non-battle AI:
4. AI spell selection is suboptimal.
5. AI enemy target selection is poor.
6. AI wastes too much mana in battle for no reason: losing battles, winning battles, node battles (AI's spells are dispelled).
7. AI fights out losing battles, which wastes units (in addition to mana).
8. City wall gate can be defended with 3 units and AI does not act if path to preferred target is blocked.
9. In some cases, AI unit speed is lower than human unit speed due to the 0.5Movement Point calculations, tree and elevation obstacles. [NOT AI bug, but general game problem which should be fixed by Kyrub].
10. AI does not protect its heroes, ranged units, and low HP units.
11. AI spell casting is too predictable and repetitive.
12. AI range attacks are inefficient.
13. AI does not consider its own available mana reserve and may drain it, which is suicidal in some cases.
14. AI does not use the move and shoot tactics.
15. AI does not use the 50 turn draw tactics, which humans heavily exploit. [Not an AI bug, but a human exploit, which Kyrub should fix].
16. AI does not use knowledge about its enemy's mana and skill in battle.
17. AI does not estimate the importance of the battle to be fought and fights them all with equal (maximum) effort.
18. AI does not exploit or capitalize on its own spells, such as call lightning.
19. AI does not run away from or counter enemy exploits, such as wrack, call lightning, repeated shots from fliers and no means to counterattack.
20. AI does not learn.
21. AI does not estimate the enemy's capabilities.
22. AI does go out of map on the South. When they are outside, then they can't be attacked, but they can still attack human player. [NOT an AI bug, but an interface bug].
Reply

Quote:1. AI units never try to break a wall [ILSe].
Probably we can improve that.


Quote:2. AI does not effectively chase a unit down.
Also can be improved right now, see point 15.


Quote:3. AI uses earth to mud and spell lock [FrancoK] where and when it's useless.
We can converge to point 4, below.


Quote:4. AI spell selection is suboptimal.
AFAIK AI as a list of spell and how likely is it casts it.
We can change the likeliness of a spell to be cast (easy, if you know where the value is stored), the fact some spells are mandatory or forbidden in certain cases (requires AI rewrite, IMHO) and combinations of spell/units/situation that are desiderable (AI rewrite as well).
Examples:
Guardian Wind on a unit with Missiles imuunity is wasted, like regeneration on a War Troll.
If a lone Slinger faces 4 bowman, Guardian Wind is the best defensive spell, if 4 spearmen face a slinger Warp Wood is the best defense (even if it is an offense spell).


Quote:5. AI enemy target selection is poor.
Examples?


Quote:6. AI wastes too much mana in battle for no reason: losing battles, winning battles, node battles (AI's spells are dispelled).
Looks like point 4 for me. Differences to that point?


Quote:7. AI fights out losing battles, which wastes units (in addition to mana).
Do you mean a single spearman attacking a deadly stack? Isn't it to be considered in the general AI?
Or perhaps you mean a single spearman attacked by 4 warlocks? Should he retreat?huh


Quote:8. City wall gate can be defended with 3 units and AI does not act if path to preferred target is blocked.
Not sure. Do you mean when there are 3 attacking units outside the door, the other foot units stop moving forward?


Quote:9. In some cases, AI unit speed is lower than human unit speed due to the 0.5Movement Point calculations, tree and elevation obstacles. [NOT AI bug, but general game problem which should be fixed by Kyrub].
I think the routine is the same that calculates the external path, fixing one should fix both.
One quick fix is to tell the routine to calculate the path of a unit with a single movement left as if it was flying. This should remove the terrain bonus/malus calculation and straight the path. thumbsup


Quote:10. AI does not protect its heroes, ranged units, and low HP units.
Except for recall hero, if AI sees it is in danger or fleeing (and losing heroes and units).
Suggestions? smile


Quote:11. AI spell casting is too predictable and repetitive.
This works the opposite way of point 4. The more a choice is random, the less is predictable and good, the more a choice is "the best possible", the more is predictable and the less is random.
I preferer the MoM way: Always a chance for the unexpected, but mainly predictable.



Quote:12. AI range attacks are inefficient.
You mean the point 14? Or there are other examples?


Quote:13. AI does not consider its own available mana reserve and may drain it, which is suicidal in some cases.
Agree.


Quote:14. AI does not use the move and shoot tactics.
And it should.


Quote:15. AI does not use the 50 turn draw tactics, which humans heavily exploit. [Not an AI bug, but a human exploit, which Kyrub should fix].
The 50 move = draw is not an exploit is a rule. smile
The bug is that the AI units are not chasing a running unit effectively.
The fact two spearmen cannot beat a cavalry if the latter is running is not a bug or an exploit, it's a tactic and the AI should use it.
The fact a swordman cannot corner a running spearman in a closed (by boundaries) but empty field is an AI bug.
This can be quickly fixed this way:
Right now the attacker check the XY difference from the target, then moves to decrease the longest difference.
So if DeltaX is 10 and DeltaY is 6 it moves forward the target to make DeltaY = 9 and DeltaX = 6.
When the are the same, then decrease both.
So when DeltaX is 6 and DeltaY is 6 it moves forward the target to make DeltaY = 5 and DeltaX = 5.

Instead it should always move to decrease both.
So if DeltaX is 10 and DeltaY is 6 it should move forward the target to make DeltaY = 9 and DeltaX = 5.

This should fix the chasing problem, but introduce a new dilemma: if there is an obstacle in the closest path, should I move around left or right?
It not a silly question (there can be more than 1 obstacle) and we can discuss it later in detail.

Right now we can solve it using a random move. shhh

Of course ther are more complex tactics ( I.E. walk in a line 2 step from the closest friendly unit to the single enemy, if each of our unit can kill it), but we can implement it later.

Quote:16. AI does not use knowledge about its enemy's mana and skill in battle.
And it shouldn't.
As we do not know AI skills (left) and mana (left) so AI should not know or use it.


Quote:17. AI does not estimate the importance of the battle to be fought and fights them all with equal (maximum) effort.
Not a bug, unless you think the AI should flee more often, but should avoid fleeing from important cities or its wizard tower. smoke


Quote:18. AI does not exploit or capitalize on its own spells, such as call lightning.
What do you mean?
Merlin is always casting C.L. on my units very soon.


Quote:19. AI does not run away from or counter enemy exploits, such as wrack, call lightning, repeated shots from fliers and no means to counterattack.
While I agree it do not move flying shooter close to maximize damage, this fall in the other categories (point 14).
AI should not rely on exploits, IMHO.


Quote:20. AI does not learn.
And that correct, unless you want to employ Josua. wink


Quote:21. AI does not estimate the enemy's capabilities.
And it should, but falls in other categories (spell choice, targets, etc.)


Quote:22. AI does go out of map on the South. When they are outside, then they can't be attacked, but they can still attack human player. [NOT an AI bug, but an interface bug].
As point 19:
AI should not rely on exploits, IMHO.
And there are other places where AI can't go. wink


I'll add:
23. The AI should make more difference between when it attacks or defends. IMO the attacker should try to kill all enemies, and stop (stand) only if the attack is nearly impossible (IE both wizards have cast all the spells and the defender still has an unwounded paladin, while the attacker has 4 sprites, AI should stop attacking).
Conversely the defender should avoid being killed as the primary target, trying to wipe the enemy only to avoid beng it by them.
Example1: 4 warlocks are attacked by 3 magicians and 3 horsebowmen. they should attack the magicians first, then the horsebowmen, unless the hbm are so close they can attack.
Example2: 1 flying draconian spearmen is on the door of a walled city and also there are 7 gnoll spearmen, they are attacked by 4 hammerhands and 4 paladins. The draconian should avoid attacking the enemies even if they are close to him.
The example2 sometimes happens (I also saw it on a youtube video), sometimes the AI attacks anyway.
Only the people crazy enough to think they can change the world of Arcanus and Myrror can do it. rolleye
Reply



Forum Jump: