Connection ErrorBad RequestSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
Good afternoon. I looked through the forum and didn't find an answer (or a question) about this.
What principle do neutral creatures use to target enemies on the battlefield? Is there an algorithm that the AI uses to determine which enemy to attack first? Or do they simply run forward and attack the first enemy they reach?
If I haven't expressed myself correctly, feel free to correct me.
dnaop-wr
12 years ago
Auto-translated
Check out the guide for Heroes of Might and Magic III in my signature – it has a section about AI behavior on the battlefield.
Check out the guide on formations in my signature – it has a section about AI behavior on the battlefield.
A while back, almost a year ago, I was working on a similar issue, but only with 1-on-1 units. As an example, I studied how a stack of wyverns behaves when holed up and attacked by dwarves. Given their speed, the wyverns move first and have two behavior options: wait or fly forward completely. This depends on whether they are afraid of getting hit by the dwarves. Ultimately, it involved comparing the values obtained using the formula below, and the ratio between them could be used to understand the AI's tactics. The formula itself looked something like this (FV - Fight Value from crtraits.txt): K_stack = HP_unit * (stack_damage / FV_unit), where FV_unit = sqrt(((FV_base + (hero_attack * FV_base) / 20)^2) * ((FV_base + (hero_defense * FV_base) / 20)^2)) However, this isn't quite everything, but it's an approximate explanation of how the stack simply wants to deal more damage, not just to HP, but to HP * FV, and it also takes into account the hero's attack and defense separately. That is, all other things being equal, a stack with 5/5 attack and defense and a hero with 0/0 is not the same as 3/3 and 2/2, even though the damage is the same. At the same time, the wyverns always flew in if the ratio (K_stack_dwarves / K_stack_wyverns) >= 2. That is, they were already resigning themselves to defeat. Also, if the ratio <= 0.07, they consider that they have already won. I can describe all this based on my old notes, but it's quite possible that I'm wrong about something; after all, it's been almost a year. If you're interested, I can show you examples of calculations and everything, but I'd have to refresh my memory. In practice, this translates to: attacking harpies in hives, attacking archers at the beginning of the round against the advanced units, not against elves, the fear of getting hit by a stack of wyverns, and attacking with a single unit. P.S. And yes, by the way, stack_damage is the average damage. That is, a stack of air units will calculate its damage as 5 with a damage range of 2-8. At one point, I wanted to record a video with the formula displayed, but I was just too lazy.
dnaop-wr
11 years ago
Auto-translated
Yes, this is a mathematical justification for the AI's behavior on the battlefield. The problem is that it's not always possible to quickly consider, evaluate, and calculate the influence of all factors. The AI's behavior can be defined as the most probable, but that doesn't mean it will act exactly that way – it may act illogically from the player's point of view, but logically according to the algorithm programmed into it. In addition, there may also be a certain degree of randomness in the AI's actions in some situations. Therefore, it is not possible to describe the AI's behavior algorithm on the battlefield briefly and unambiguously (without analyzing the code). However, I would like to note that the "brainless" undead behave as they should – they go to the nearest enemy, while living units may ignore flanking maneuvers and go directly to the main enemy forces.
Yes, this is the mathematical justification for the AI's behavior on the battlefield. The problem is that it's not always possible to quickly account for, assess, and calculate the impact of all factors. The AI's behavior can be defined as the most likely, but that doesn't mean it will act exactly that way – it may act illogically from the player's point of view, but logically according to the algorithm programmed into it. In addition, there may be a certain degree of randomness in the AI's actions in some situations. Therefore, it is not possible to describe the AI's behavior algorithm on the battlefield briefly and unambiguously (without analyzing the code). However, I would like to note that the "brainless" undead behave as they should – they go to the nearest enemy, while living units may ignore flanking and go directly to the main enemy forces.
I'm not sure if there's a difference between creature types, as skeletons were also present during my tests. They behaved exactly like the others. At the same time, given the lack of morale, I cannot claim that the behavior is identical. And regarding behavior, I can provide my test from scenario 12. Hero - Ain 0/0 (SP and knowledge are not taken into account by the AI when calculating moves). Army - only Gnolls. Let's try two Gnoll formations: 422+6 units and 423+6 units. In the first case, the snakes attack the units. In the second, they rush to the large stack. The difference in damage here is of little importance. Considering the FV of the stacks, we can see that the FV of the snakes = 250*60 = 15000, while the FV of the 428 Gnolls = 70*428 = 29960. The 429th Gnoll acts as the boundary Gnoll that makes the snakes realize that they have no chance. It increases the FV of the Gnolls so much that the ratio becomes >=2. As a result, the first snakes attack the large stack. Then, the snakes see 7 stacks, one of which will not retaliate, but hitting it will result in more HP*FV loss for the enemy. Therefore, all the other snakes attack the large stack as well. In this way, by adding one Gnoll, you can increase the losses while having a larger army. By the way, once in a game, everything went wrong in a dungeon because of a larger number of Gnolls. It turned out that the vampire killed by the lizards had reduced the enemy's FV so much that the ratio went beyond the limit, and the skeletons started killing large stacks instead of chasing a single unit. It was something like that, I don't remember exactly. P.S. With 428 Gnolls, if the large stack is defended in the first round, it will be hit in the second round, even if there is one more Gnoll. The added defense unit seems to be counted not from the creature, but from the hero, and as a result, the stack receives Gnolls with a slightly higher FV, which makes them attack.
dnaop-wr
11 years ago
Auto-translated
I haven't tested the behavior of different monsters on the battlefield – I just noticed the typical behavior of certain types of monsters.
And if the expression Fv_unit * Sum_of_Units > 2 * Fight_Value * N is true, then the AI will attack the main stacks; if it is not true, then it will avoid them and attack individual units. floor - rounds the resulting number down. Where bonuses are the sum of bonuses for native territory (+0 or +1) and the bonus to the unit from the hero's special ability for that unit, in units. For example, Galtran's +1 at level 1 will give to skeletons. Fight_Value is the unit's value.
This formula can be used when attacking Black Towers with a black or golden dragon.
Also, a more general formula for a mixed army to determine at what point the AI algorithm changes in battle:
Σ(Ni * floor(sqrt(V(vi,ha,b1) * V(ai,hd,b1)))) > 2 * vj * Nj, where V(vi,ha,b1) = FV_unit. If the formula is not true, then the AI will try to protect archers, attack those who deal less retaliatory damage, keep its distance from the main stack's attack, attack the unit from which the retaliatory attack has been removed, and which is wounded. And in general, many different coefficients are used; in general, the damage will be based on Unit_Value * Damage / Unit_HP
isq 742235848
Plotnick
10 months ago
Auto-translated
A question I've wanted to ask for a long time. In the third game, the randomness isn't entirely random. It's literally predictable, to the point that if you restart a scenario and find, say, 1000 gold in a chest near a town, then in a nearby warrior's grave, you'll find, say, Rider's Gloves, and if the chest contains 1500 gold, then the grave will contain something else. But if you restart again and the chest contains 1000, then the grave will again contain the gloves. The same applies to the hero skill tree, which is why the LMOracle tool works.
It's interesting that no matter which versions I play, where I download them from, or which computer I install them on, it works exactly the same way in combat. If I repeat the same sequence of actions, then at exactly the same moments in the battle, morale, luck, or the same spells of Djinns or Wizards, etc., will appear for me/the computer. However, in discussions about offline walkthroughs, there are often comments that you can't base a walkthrough on the assumption that morale will appear, because it might not. That is, I feel that the way randomness works for me seems to only work for me.
Could it be due to the HD mod or something else? Please tell me how randomness works for you in combat, because for me, 100% of events are reproducible with step-by-step repetition.
This is a question I've wanted to ask for a long time. In the third game, the randomness isn't entirely random. It's literally predictable, to the point that if you restart a scenario and find, say, 1000 gold in a chest near a town, then in a nearby warrior's grave, you'll find, say, Rider's Gloves, and if the chest contains 1500 gold, then the grave will contain something else. But if you restart again and the chest contains 1000, then the grave will again contain the gloves. The same applies to the hero skill tree, which is why the LMOracle tool works. Interestingly, no matter which versions I play, where I download them from, or which computer I install them on, it works the same way in combat. If I repeat the same sequence of actions, then at exactly the same moments in the battle, morale, luck, or the same spells of Djinns or Sorcerers, etc., will drop for me/the computer. However, in discussions about offline walkthroughs, there are often comments that you can't base a walkthrough on the assumption that morale will drop, because it might not, etc. That is, I feel that the way randomness works for me is unique. Could it be due to the HD mod or something else? Please tell me how randomness works for you in combat, because for me, 100% reproducible events occur when I repeat the steps.
Apparently, different seeds are generated when restarting. Is this on Hota or SOD? Just in combat in Hota, the randomness is strictly deterministic (full repeatability), while in SOD/Complete, it's almost chaotic (the randomness is frame-by-frame).
I've tried different versions of SOD. GOG, Complete, SOD English. It always results in 100% reproducibility.
Understood. I once came across a video in one of the Reddit threads about reproducibility/changing layouts with different restarts, where the author described approximate patterns. Using the "Rubi and Cromsau" campaign as an example. But unfortunately, I can't find that video. Is it the same on HotA, perhaps?
I once came across a video in one of the Reddit threads about reproducibility/changing outcomes with different restarts, where the author described approximate patterns. Using the "Rubi and Crom" campaign as an example.
Previously, walkthroughs could be found on ag.ru in the "Heroes" section, but now that section no longer exists. In general, it was directly stated at the beginning of different campaigns that you could achieve combinations of secondary skills by restarting. Essentially, the sets of these combinations were static, meaning that several options would appear. Moreover, after one of the restarts, they could cycle up to two times. After that, you had to restart the game. The same thing happens with the starting artifacts; you can try to generate something decent, but sometimes the restarts fall into a cycle and never produce anything worthwhile. )) But battles are a different matter; you can skip a turn or perform some action to influence the randomness. For example, you can sit and count the turns of the enemy unit and notice that its morale drops on the 5th turn. To prevent this from happening, you need to somehow change the situation, for example, by moving your unit or, conversely, skipping a turn. Otherwise, the morale will drop again on the 5th turn. This is what I'm talking about. This always works for me, but the reasons for this behavior are unclear to me. I haven't played Heroes of Might and Magic 3.