Automatic attack choice for you
Moderator: Forum Moderators
Forum rules
Before posting a new idea, you must read the following:
Before posting a new idea, you must read the following:
-
- Posts: 873
- Joined: July 4th, 2004, 9:14 pm
- Location: My imagination
- Contact:
Automatic attack choice for you
Currently, when you attack something, the game chooses the first attack in the list which does the most damage (you can change it after, of course). For certain units, that is quite annoying. For example, Elvish Rangers normally have equal melee and ranged attacks. The melee attack comes first in the list, so it is selected. But most enemies have stronger melee than ranged, so I have to keep selecting the ranged attack every time I attack.
Possible solutions:
When the attacks do equal average damage, pick the one that does less average damage to the attacker.
Or,
Use a scheme similar to the aggression that the AI uses.
The second one might not be entirely desirable, but the first one would be very convenient.
Possible solutions:
When the attacks do equal average damage, pick the one that does less average damage to the attacker.
Or,
Use a scheme similar to the aggression that the AI uses.
The second one might not be entirely desirable, but the first one would be very convenient.
Play a Silver Mage in the Wesvoid campaign.
it doesn't always choose the best attack. It always chooses the melee attack. It orders them from melee to ranged, every time.
Because of this, your whole statement makes little sense...
Because of this, your whole statement makes little sense...
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
It orders them the same all the time, but the attack that is selected when the dialog is opened varies. Currently it will select the attack where damage*number_of_strikes*chance_to_hit is the highest, choosing the first in the list if they are equal.turin wrote:it doesn't always choose the best attack. It always chooses the melee attack. It orders them from melee to ranged, every time.
I agree with this. It's a small improvement that'd make the selection slightly better. I'll look at changing it.Invisible Philosopher wrote: When the attacks do equal average damage, pick the one that does less average damage to the attacker.
This has been suggested before, but I don't like it so much. The idea of the default attack selection is to make the 'very very obvious choice' of the most powerful attack. If the player wants to do something 'smart' like choose a less powerful attack in exchange for less retaliation, or for a higher chance to kill, etc, then that's up to them to make that tactical choice.Invisible Philosopher wrote: Use a scheme similar to the aggression that the AI uses.
David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
i stand corrected...
anyway, i still don't see a point to this. it doesn't take much time at all to select what attack you want, and personally i would find it annoying to have it keep switching back and forth on what the default selected attack was.
but if someone wants to implement it, i have no major objections..
anyway, i still don't see a point to this. it doesn't take much time at all to select what attack you want, and personally i would find it annoying to have it keep switching back and forth on what the default selected attack was.
but if someone wants to implement it, i have no major objections..

For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
Well, suppose you want to attack an Orcish Grunt with your Elvish Ranger. Which attack would you use?turin wrote:and personally i would find it annoying to have it keep switching back and forth on what the default selected attack was.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
i would take the time to change the attack manually, rather than trust the computer to do it,Elvish Pillager wrote:Well, suppose you want to attack an Orcish Grunt with your Elvish Ranger. Which attack would you use?turin wrote:and personally i would find it annoying to have it keep switching back and forth on what the default selected attack was.

For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
But you don't have to 'trust' the computer to do it.turin wrote:i would take the time to change the attack manually, rather than trust the computer to do it,Elvish Pillager wrote: Well, suppose you want to attack an Orcish Grunt with your Elvish Ranger. Which attack would you use?
You select to attack with your Ranger, and you see that by default the ranged attack is highlighted, which is the attack you wanted to use anyway. Then you press enter (or click ok) to confirm the attack.
David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
For instance, if you have a large number of Elvish Archers attacking a large number of Orcish Grunts, you know you want to use their bows, so you can do "attack-ok-attack-ok-etc" but with a large number of Elvish Rangers in the same position where none of them are Strong, you have to do "attack-select-ok-attack-select-ok-etc" which is much more of a nuisance.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Well, you could give them the attack that is their specialty... I mean, rangers come from archers, so long range would be their default; all the advanced units will have the default attack specialty of the basic unit of their branch; I think this would work for every unit (as its basic specialty is always their best attack), and is a lot more simple. But I don't know if it's easy to implement...
Perhaps this could be set in the .cfg for each unit?
Perhaps this could be set in the .cfg for each unit?
good idea
I have been thinking about this myself for a while... I think I posted something about picking attacks based on something slightly different.
If it's not too presumtuous, I want to suggest a way of doing this.
Math follows: !!
For every possible attack-defence pair. suppose that the attack is 4-2 50% and the defence is 3-1 30%
you build a table of all possible outcomes: the table is (2+1) by (1+1) since you can hit between 0 and 2 times and you can get hit between 0 and 1 times. Each entry in the table has:
- the probability that this case happens (you can fill this table very quickly by dynamic programming)
- the amount of damage that the attacker and defender has taken
- whether or not the attacker or defender is dead
taking a weighted average of each entry in the table you get:
Ad and Dd: the average amount of damage each has taken
Ak and Dk: the chance that each has been killed
These values could be used to improve the AI as well as give the player the more obvious answer.
given two choices of attack, we want to compare them. I suggest we use Ad/Dd as the goodness of that choice, the better goodness wins and use Ad in case both Dd are 0. That's simple and will do what Invisible Philosopher wants.
But to make things even better, I sometimes do want the melee attack if it has a strength of 10 and the ranged attack has a strength of 8 and the defender has 9 HP then even if he can fight back, I want to increase my chances of killing him.
So, maybe the formula could be a bit more clever: if Ak for both attacks that we are comparing is 0 and Dk is higher for one of the two attacks by at least 5% then over-ride the formula above and go for this method.
Doing this, at least for the AI, will be a big improvement. Many times I have suckered the AI into attacking into a blocker that will poison him, or attack from the water (the AI should not attack if Aa/Dd < 1/2 -- that means you are getting screwed). Also I noticed that Ad and Dd can be negative if someone has a draining attack.
Please don't tell me "my whole statement makes little sense" turin.
If it's not too presumtuous, I want to suggest a way of doing this.
Math follows: !!
For every possible attack-defence pair. suppose that the attack is 4-2 50% and the defence is 3-1 30%
you build a table of all possible outcomes: the table is (2+1) by (1+1) since you can hit between 0 and 2 times and you can get hit between 0 and 1 times. Each entry in the table has:
- the probability that this case happens (you can fill this table very quickly by dynamic programming)
- the amount of damage that the attacker and defender has taken
- whether or not the attacker or defender is dead
taking a weighted average of each entry in the table you get:
Ad and Dd: the average amount of damage each has taken
Ak and Dk: the chance that each has been killed
These values could be used to improve the AI as well as give the player the more obvious answer.
given two choices of attack, we want to compare them. I suggest we use Ad/Dd as the goodness of that choice, the better goodness wins and use Ad in case both Dd are 0. That's simple and will do what Invisible Philosopher wants.
But to make things even better, I sometimes do want the melee attack if it has a strength of 10 and the ranged attack has a strength of 8 and the defender has 9 HP then even if he can fight back, I want to increase my chances of killing him.
So, maybe the formula could be a bit more clever: if Ak for both attacks that we are comparing is 0 and Dk is higher for one of the two attacks by at least 5% then over-ride the formula above and go for this method.
Doing this, at least for the AI, will be a big improvement. Many times I have suckered the AI into attacking into a blocker that will poison him, or attack from the water (the AI should not attack if Aa/Dd < 1/2 -- that means you are getting screwed). Also I noticed that Ad and Dd can be negative if someone has a draining attack.
Please don't tell me "my whole statement makes little sense" turin.

- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
No, your idea is up to Dave to refute.
Dave wrote:This has been suggested before, but I don't like it so much. The idea of the default attack selection is to make the 'very very obvious choice' of the most powerful attack. If the player wants to do something 'smart' like choose a less powerful attack in exchange for less retaliation, or for a higher chance to kill, etc, then that's up to them to make that tactical choice.
David
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
A bit snipish, eh Pillager?!Elvish Pillager wrote:No, your idea is up to Dave to refute.Dave wrote:This has been suggested before, but I don't like it so much. The idea of the default attack selection is to make the 'very very obvious choice' of the most powerful attack. If the player wants to do something 'smart' like choose a less powerful attack in exchange for less retaliation, or for a higher chance to kill, etc, then that's up to them to make that tactical choice.
David
There are two reasons why you would want this system:
- the AI would be harder to trick
- it eliminates tedium from the game
Personally, I see the strategy of the game more in how you organize your troops and less in doing the numerology/math-crunching of choosing an attack. You can still be clever here, taking into account all sorts of different things (poison, how many attackers, etc.) but the default selection should, I think, do the math crunching.
Neil
Elvish pillager, his suggestion was for a new AI attack method, not deciding what would be selected by default when you open the attack window.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm