negative ai aggression
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
-
- Posts: 1296
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
negative ai aggression
https://wiki.wesnoth.org/AiWML#List_of_AI_Aspects
"Very large negative values...", not so much. I don't know what large is, let alone very large. I think it's reasonable to assume that -1.0 would be roughly the opposite of 1.0, which would mean that it only considers the damage it could take in return, and therefore would almost never attack. And I guess < -1.0 might lead to the AI not attacking even when there is no chance of taking any damage, but I don't really see any other options (so -9,213 should be the same as -1.001).
I SUSPECT the difference between -X and -Y, both less than -1.0 probably has something to do with likelyhood of getting a kill (and probably other stuff like wanting to stay on/be near a keep, affinity for healing if injured, etc)? I have noticed that enemy leaders seem to only attack, and usually only from their keep, when they have a good chance of a kill.
I see leader_aggression defaults to -4.0, but I have no idea what that means. How much is that in Olympic size swimming pools?
I'm tired of standing in an enemy keep, pounding away at the leader and never being attacked in return. I could try leader_aggression=-3.9, restart with 3.8, etc, or change it based on turn number or write a gui, etc, but I'm not in the mood for error and trial.
The description of aggression=1 is quite helpful, when combined with that of aggression=0.
- If 'aggression=1', no negative contributions are added to the score. Thus, the AI disregards damage done to its own units and selects attacks based solely on the damage it can do to enemy units. If the AI can inflict 1 damage and take 0, or inflict 2 damage and take 20, it will take the latter option.
- The smaller the value of aggression, the more weight is put on value of and potential damage to the AI's units as compared to the attack target.
- Roughly speaking, 'aggression=0' results in the AI valuing its units approximately as much as the enemy units. This is not a one-to-one relation, but can be used as an approximate guideline.
- Very large negative values of aggression mean that the value of the AI's units is much more important than that of the enemy units. As a result, the AI never attacks unless it will receive no damage in exchange.
"Very large negative values...", not so much. I don't know what large is, let alone very large. I think it's reasonable to assume that -1.0 would be roughly the opposite of 1.0, which would mean that it only considers the damage it could take in return, and therefore would almost never attack. And I guess < -1.0 might lead to the AI not attacking even when there is no chance of taking any damage, but I don't really see any other options (so -9,213 should be the same as -1.001).
I SUSPECT the difference between -X and -Y, both less than -1.0 probably has something to do with likelyhood of getting a kill (and probably other stuff like wanting to stay on/be near a keep, affinity for healing if injured, etc)? I have noticed that enemy leaders seem to only attack, and usually only from their keep, when they have a good chance of a kill.
I see leader_aggression defaults to -4.0, but I have no idea what that means. How much is that in Olympic size swimming pools?
I'm tired of standing in an enemy keep, pounding away at the leader and never being attacked in return. I could try leader_aggression=-3.9, restart with 3.8, etc, or change it based on turn number or write a gui, etc, but I'm not in the mood for error and trial.
Speak softly, and carry Doombringer.
Re: negative ai aggression
I think there are other AI parameters which affect this, too. (e.g., passive_leader)white_haired_uncle wrote: ↑April 24th, 2024, 9:02 pm I'm tired of standing in an enemy keep, pounding away at the leader and never being attacked in return.
- Celtic_Minstrel
- Developer
- Posts: 2281
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: negative ai aggression
The quantity
I'll leave it to someone else to unravel what that code actually means…
(1 - aggression)
is used to determine which of two attacks is better. The actual code that does the comparison is this (harm_weight
is the aforementioned aggression-based quantity):Code: Select all
// Compare: P(we kill them) - P(they kill us).
a = them_a.hp_dist[0] - us_a.hp_dist[0] * harm_weight;
b = them_b.hp_dist[0] - us_b.hp_dist[0] * harm_weight;
if(a - b < -0.01) {
return false;
}
if(a - b > 0.01) {
return true;
}