|
Thread: a Modest AI mod | This thread is pages long: 1 2 · NEXT» |
|
kyrub
Hired Hero
|
posted July 10, 2016 06:31 PM |
|
Edited by kyrub at 11:22, 20 Jul 2016.
|
a Modest AI mod
I will make a small AI patch for HoMM3, "Modest AI". The patch changes the original exe file, but I will list all the code changes in a txt file so that anybody who wants to carry the patch to his version of the game, can do it with a simple hex editor program.
What the patch should do: make some rude (modest) but effective corrections to the self-harming behaviour of the AI in the game.
The first version will
a) try to let AI build more creature dwellings and economical buildings earlier (simple change with unknown effect.)
b) try to make AI choose better secondary skills, to make the contest more interesting
I have written this post before finishing the mod, to ask for thoughts and assistance from experienced players: what preferences should AI have for Secondary skills? I have read several threads about best/worst skills and skill sets, but there is an important angle in thinking about - what helps the AI most?
Below you can see my current sketch for AI choices. On the left there are values for each sec. skill. AI always chooses the best value of the 2 offered skills, there's no random factor included. If 2 skills have the same value, there is a 50/50 choice. What do you think about the sketch?
Thanks for any comments.
Suggested AI secondary skill preference: - EDITED 20/7
27 offense
26 (earth) if magic schools <=1
25 armorer
24 necromancy
23 logistics
22 (air) if magic schools <=1
21 wisdom
20 (archery I) (for Castle, Rampart, Tower, Dungeon, Stronghold)
19 resistance
18 (tactics)
17 (water) (archery II for Inferno, Necropolis, Fortress)
16 leadership (pathfinding II if army _strength < 200)
15 ballistics
14 (fire)
13 luck
12 pathfinding
11 (intelligence) if knowledge >3
10 (artillery)
9 (scholar) if we have wisdom
8 estates
7 sorcery
6 diplomacy
5 (first aid)
4 scouting
3 navigation
2 mysticism
1 eagle eye (archery III Conflux)
0 learning
Current HoMM3 AI secondary skill preference:
estates
navigation
first aid pathfinding
logistics
archery
ballistics
offence armorer
necromancy scouting learning
resistance
luck leadership tactics
diplomacy
(note: the other skills are usually considered as inferior, especially for might heroes)
|
|
Baronus
Legendary Hero
|
posted July 10, 2016 07:43 PM |
|
|
Good idea.
But why learning on end?
I suggest boosting learning x10 to:
1. 50%
2. 100%
3. 150%
It must be powerfull skill.
End look like:
first aid, eagle eye, etc.
|
|
natalka
Supreme Hero
Bad-mannered
|
posted July 10, 2016 07:52 PM |
|
|
Water/fire has too high value. It should be much less and they should be taken by mages only after both earth and air are present.
____________
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted July 10, 2016 08:19 PM |
|
|
Depends for who. If player is already decent then it won't change big thing. Is not a matter of priorities, in my opinion, but about what AI should ALWAYS have, otherwise it will still lose and easily.
So for me, when working to Conquistador training mod, it was obvious each AI must have earth, air and their mass spells, all natural fighting skills (Armorer, Offense and Archery) + goodies as Resistance/logistic/wisdom, always mana at maximum, always more creatures in towns.
But then we have Conquistador, which serves to train vs decent to invincible AI's, so there is already one mod out there.
|
|
kyrub
Hired Hero
|
posted July 10, 2016 10:07 PM |
|
Edited by kyrub at 22:34, 10 Jul 2016.
|
natalka said: Water/fire has too high value. It should be much less and they should be taken by mages only after both earth and air are present.
Thanks, natalka. If you say "much less", I am alaways interested into where you would put it.
I am inclined to agree on Water, but not so sure with Fire. Water is Bless + very little else for the AI. Fire's different.- First, mass curse is a pretty effective weapon in big battles (probably better than mass bless), and AI loves to cast mass spells. Second, there is Blind and that's the marquee AI spell right there. And Armagedon down the line. And my third concern is more general: what if AI ends with no Magic school because we put 2 schools too low on the table?
Quote: it was obvious each AI must have earth, air and their mass spells, all natural fighting skills (Armorer, Offense and Archery) + goodies as Resistance/logistic/wisdom,
Thanks a lot for the input, Salamandre. I will put Archery higher, it seems. And think more about Resistance.
Quote: we have Conquistador, which serves to train vs decent to invincible AI's
Yes, I have seen it. It's quite different approach, the typical "AI on steroids" thing. I respect that, but am trying to do something a bit different.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted July 10, 2016 11:41 PM |
|
|
Resistance is very helpful to AI. Without, he is just easy fodder to blind/mass slow as he ignores its own blinded stacks.
|
|
potmdehex
Known Hero
professional ERM™ scripter
|
posted July 11, 2016 02:20 PM |
|
|
Good idea, disregard the haters.
Good luck.
|
|
kyrub
Hired Hero
|
posted July 11, 2016 03:05 PM |
|
|
Based on suggestions, I have edited the list in the first post.
potmdehex said: Good idea, disregard the haters.
Good luck.
Thanks. I don't see any haters so far, everybody's helpful.
|
|
kyrub
Hired Hero
|
posted July 12, 2016 02:00 PM |
|
Edited by kyrub at 14:03, 12 Jul 2016.
|
An important question:
Is there a technically simple and quick way to study AI behavior (and the effect of the changes), turn by turn, without actively playing the game?
(Typically, I can achieve it with some sort of supercheat that reveals the whole map and allows to look "inside" the towns as well, to scout heroes etc. - Does such a "Cartographer +" cheat exist in HoMM3?)
It would help a lot.
|
|
natalka
Supreme Hero
Bad-mannered
|
posted July 12, 2016 02:10 PM |
|
Edited by natalka at 14:16, 12 Jul 2016.
|
Tactics should switch places with wisdom imo.
I dunno how u can program it but i think ai should aim for the 7 essential skills - offrnce, armorer, logistics, tactics, air, earth, wisdom. 8th slot could br either archery or resistance. Maybe resistance above archery as Sal suggested.
I see another flaw - if ai is fferd offence/earth it will miss the spell school. Maybe put earth & air on top of list.
____________
|
|
potmdehex
Known Hero
professional ERM™ scripter
|
posted July 12, 2016 02:27 PM |
|
|
Some technical info before answering your question:
Secondary skills are represented by 60 bytes inside of the hero struct.
First 28 bytes:
Array of skill levels. Each byte is for a certain skill, for example byte 0 (the first of the 28) is for Pathfinding. They hold a value 0-4:
0: None
1: Basic
2: Advanced
3: Expert
Next 28 bytes:
Array of taken slots. Each byte is for a certain skill as in the first 28, and tell which of the hero's skill slots the skill occupies. If for example the third skill the hero has learned is Pathfinding, the first byte will have value 3.
Last 4 bytes:
Count of skills the hero has learned.
Answer:
If I were you and starting from scratch I would set hardware breakpoints in the secondary skills arrays to see the functions that modify the skills during AI's turn, or when causing events such as leveling up during my own turns. If you wanted you could even write logging hooks for these functions or use them in whatever way you want to observe AI behavior.
|
|
AlexSpl
Responsible
Supreme Hero
|
posted July 12, 2016 02:30 PM |
|
Edited by AlexSpl at 14:33, 12 Jul 2016.
|
ProspectorRT + HeroesInfo by Stormbringer. Works with saved game files. You might be interested in the second part - HeroesInfo, as it shows essential statistics for heroes.
LMOracle. Works with memory. Various features regarding skill trees.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted July 12, 2016 02:33 PM |
|
|
kyrub said:
(Typically, I can achieve it with some sort of supercheat that reveals the whole map and allows to look "inside" the towns as well, to scout heroes etc. - Does such a "Cartographer +" cheat exist in HoMM3?)
It would help a lot.
Install Era 2 then use the trainer mod. If you disable all wog scripts in wog options (one click) it will behave 100% vanilla but have advanced cheat options, scout heroes, give them skills/spells and others. For inside towns, is easy to write a script giving the town to you on click.
|
|
kyrub
Hired Hero
|
posted July 12, 2016 02:38 PM |
|
|
natalka said: Tactics should switch places with wisdom imo.
...
Maybe put earth & air on top of list.
Thanks, natalka, for input.
My questions:
Is Tactics so important for the AI? Can AI use it well?
- As I remember it, AI often makes protected shooters group, which is ideal target for Meteor Shower / Chain lightning. The only good situations are, when AI goes full offense with Tactics + Mass Haste. The other good thing is that nullifies the player's Tactics advantage... not bad, but a bit uninspirational use.
Why is Air school crucial for the AI?
There are only those 5th level spells, Fly and the DD... but that's pretty long shot and a lot of the luck to have in Magic Guild, for the AI.
The reason for putting offense to first place:
- it is a no brainer skill, hefty +30% damage for something the AI does well: hand to hand combat. Offense will help the AI throughout the game and unlike Magic schools, it gets no guaranteed offers later. A strong AI with Earth or a strong AI with Offense (and Air, Fire whatever)? It's probably easier to defeat the first one.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted July 12, 2016 02:46 PM |
|
|
kyrub said:
Why is Air school crucial for the AI?
There are only those 5th level spells, Fly and the DD... but that's pretty long shot and a lot of the luck to have in Magic Guild, for the AI.
In my opinion, trying to improve the game without knowing the game is beating a dead horse, so I would suggest you play it first.
It is the mass haste spell which is the backbone of the air school, and AI surely needs it.
|
|
AlexSpl
Responsible
Supreme Hero
|
posted July 12, 2016 02:57 PM |
|
|
In my opinion, Earth Magic is a must because of (Mass) Slow. Also all of the so-called passive battle skills (Offense, Armorer, Archery, etc.) would be quite welcome for the AI. Logistics isn't as good for the AI as for human players.
|
|
Sav
Known Hero
|
posted July 12, 2016 05:34 PM |
|
|
kyrub said: An important question:
Is there a technically simple and quick way to study AI behavior (and the effect of the changes), turn by turn, without actively playing the game?
Try "gosolo" cheat-code. It makes your player controlled by AI and shows you each player turn. Probably developers added it to test AI.
|
|
kyrub
Hired Hero
|
posted July 13, 2016 01:00 AM |
|
Edited by kyrub at 01:01, 13 Jul 2016.
|
Very nice - that is a plethora of options! Thanks to all. I am pretty sure they will come handy. I'll put them to work in a week, when I am back home. I hope to put some modest result online by then.
potmdehex said:
If I were you and starting from scratch I would set hardware breakpoints in the secondary skills arrays to see the functions that modify the skills during AI's turn, or when causing events such as leveling up during my own turns.
I use my technique, to find out AI decisions, without breakpoints. And all necessary functions are already located, otherwise I would not start this thread. What I lack is deeper understanding of data structures and current AI conditions, but it comes quickly when the AI is not complex (it is not).
So, thanks for your technical informations, potmdehex! I have been using the ERMhelp webpage as well, the indexes are of vital importance.
Quote: Logistics isn't as good for the AI as for human players.
Point noted. (I still count logistics to the secondary skills, that can surprise a human player, a bit like resistance. So I would not put it too low. Sometimes, the AI hero gallops from the distant shroud to non-awaited attack. That's a pretty good move.)
By the way, I think I put artillery (with ballista) too low. Expert ballista can hurt in early-mid game.
|
|
kyrub
Hired Hero
|
posted July 13, 2016 04:17 AM |
|
Edited by kyrub at 04:29, 13 Jul 2016.
|
Salamandre said:
In my opinion, trying to improve the game without knowing the game is beating a dead horse, so I would suggest you play it first.
It is the mass haste spell which is the backbone of the air school, and AI surely needs it.
You could be more polite and, maybe, better read the thread. We have Earth Magic as a clear priority, is it necessary to double it with Air? - that is the suggestion from natalka. Is it better than offense, for AI, like he (she) says? I think the opposite. But I may be mistaken.
So, how does having (mass Slow + mass Haste) improve on having mass Slow only? Is it so crucial? I think not. Mass slow is the superior choice. In some situations haste is the better option (battle against dragons, shooters, sieges maybe), but it does not warrant having Air on top of every choices. Surely, mass Haste with exp Tactics is another story, but then we suppose the AI gets everything eventually... which is far from simple. Since AI has no algorithm for "waiting" on the right skills.
(That's why I ask what are the other goodies Air brings on table.)
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted July 13, 2016 07:08 AM |
|
|
kyrub said: We have Earth Magic as a clear priority, is it necessary to double it with Air?
You asked why air then enumerated dim door and fly as being air important. Or 99% of the game is played without dimension door or fly, but with mass haste. Mass slow is way too powerful when cast by both AI and human, however has a counter: mass haste or mass cure. But mass haste is better than mass cure as it negates the slow penalty and adds a +5 bonus to speed. An AI hero which doesn't have mass haste -or mass cure at least, is a dead hero, if I have mass slow.
kyrub said:
So, how does having (mass Slow + mass Haste) improve on having mass Slow only? Is it so crucial? I think not. Mass slow is the superior choice.
Mass haste is a counter, is not about choices.
____________
Era II mods and utilities
|
|
|
|