Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Library of Enlightenment > Thread: AI's skill priorities
Thread: AI's skill priorities This thread is 3 pages long: 1 2 3 · «PREV / NEXT»
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 10, 2018 09:54 PM

There was no such a goal as to make the most advanced AI possible. Actually, AI in most games has two legs: a basic code to not look stupid and scripts to look clever, whenever the basic code looks stupid. My point is that it's not rational to make the most advanced AI, when you don't even know whether your game will be selling well.

So, if a game is selling well, then there's a little chance that developers will be busy improving their AI. Speaking of H3, there's our only hope that the current AI will be improved by fans.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
phoenix4ever
phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted October 10, 2018 10:03 PM
Edited by phoenix4ever at 22:04, 10 Oct 2018.

Well I made AI much better in combat, by changing AI Values of spells. If we wanted we could even make it spam Armageddon and Implosion...

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
bloodsucker
bloodsucker


Legendary Hero
posted October 11, 2018 02:50 AM

I even remember to read that the first AI was too good so the marketing team forced them to rewrite it with some limitations.
If you feel you don't have a chance you will not replay the game over and over.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Maurice
Maurice

Hero of Order
Part of the furniture
posted October 12, 2018 01:48 PM

AlexSpl said:
the_strongest_spell_efficiency_delta() is quite a complex function which operates with the AI_Values of spells. In short, it calculates the difference between:

a) the efficiency ("power") of the strongest spell, currently known to a hero,

and

b) the potential efficiency of the strongest spell with an offered secondary skill.

In general, it may be two different spells.



This whole post is great work, +QP assigned!

I guess you found these in the source code? Can you provide memory locations for (some of) these? I'm curious to explore this myself at some moment.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 12, 2018 05:33 PM
Edited by AlexSpl at 17:38, 12 Oct 2018.

Thanks. But this work is not done yet. For example, I don't know what happens when AI has to choose from two new skills, and how to calculate Estates value. Currenty I'm parsing the function which calculates the efficiency ("power") of spells.

Quote:
Can you provide memory locations for (some of) these? I'm curious to explore this myself at some moment.

See sub_52C0B0 and sub_524B70, the switch which evaluates a secondary skill.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Maurice
Maurice

Hero of Order
Part of the furniture
posted October 12, 2018 09:01 PM

Thanks. Now to save that for prosperity .

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NimoStar
NimoStar


Responsible
Legendary Hero
Modding the Unmoddable
posted October 13, 2018 03:22 AM
Edited by NimoStar at 22:59, 13 Oct 2018.

Quote:
I even remember to read that the first AI was too good so the marketing team forced them to rewrite it with some limitations.
If you feel you don't have a chance you will not replay the game over and over.


Doubt so, if such was true @good ai@ would have at least been put on King difficulty. Whereas actually all AIs have the same basic code, higher difficulty just has less restrictions.

Horse and Peon level AIs are dumb on purpose, I don't remember if Rook AI is handicapped, but King and Queen AI are the same AFAIK and still have dumbness (such as bad AI values for skills as displayed here); one of the things that changes is that they buiold town buildings whenever they can instead of having artificial delays in days.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
phoenix4ever
phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted October 13, 2018 08:32 AM

NimoStar said:
one of the things that changes is that they buiold town buildings whenever they can instead of having artificial delays in days.

Except there are some buildings they never build, no matter the difficulty. AI would be much better if it build Mana Vortex, Portal Of Summoning, Lighthouse etc.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
bloodsucker
bloodsucker


Legendary Hero
posted October 13, 2018 01:39 PM

NimoStar said:
Whereas actually all AIs have the same basic code, higher difficulty just has less restrictions.

What I remember to read was that AI priorities and movement calculations were so perfect it would always be at your door day 7, with full army.
Now, how many times have you saw one hero picking a resource or taking a minor bank and ending the turn one or two squares away from your door?
Plus, I'm not saying it happened, I'm saying they said it happened.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NimoStar
NimoStar


Responsible
Legendary Hero
Modding the Unmoddable
posted October 13, 2018 11:01 PM

Quote:
Except there are some buildings they never build, no matter the difficulty. AI would be much better if it build Mana Vortex, Portal Of Summoning, Lighthouse etc.


Yes, laxily they left out special buildings.

However seeing as VCMI can't even implement custom special buildings yet, can I really blame them that much?

Well, maybe cbecause they didn't even fix it for the expansions...

Quote:
Now, how many times have you saw one hero picking a resource or taking a minor bank and ending the turn one or two squares away from your door?


That's probably due to how getting the resources has more priority than attacking your castle, not because it was deliberately dumbed down :V
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 24, 2018 01:01 AM
Edited by AlexSpl at 16:33, 24 Oct 2018.

Well, as expected, if AI has to choose from two new secondary skills, or from two skills it already knows, it picks one with bigger value (the left skill if values are equal). Otherwise AI evaluates all allowed secondary skills and picks the right skill if it's among (8 minus number_of_already_occupied_secondary_skill_slots) of most valued skills. If not, then the left one.

Updated my post about values.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
phoenix4ever
phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted October 24, 2018 08:15 AM

Thanks Alex.
You are a genius.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 24, 2018 12:12 PM
Edited by AlexSpl at 12:14, 24 Oct 2018.

For reference

----------------------------------------------------------
==================== ADVENTURE SPELLS ====================
----------------------------------------------------------
DEC HEX NAME                    AI VALUE             FLAGS
                                NON BAS ADV EXP
----------------------------------------------------------
00  00  Summon Boat             10  10  20  20      100002
01  01  Scuttle Boat            1   1   1   1       000002
02  02  Visions                 1   1   1   1       000002
03  03  View Earth              1   1   1   1       000002
04  04  Disguise                1   1   1   1       000002
05  05  View Air                1   1   1   1       000002
06  06  Fly                     30  30  40  50      100002
07  07  Water Walk              15  15  20  25      100002
08  08  Dimension Door          30  30  40  50      100002
09  09  Town Portal             5   5   70  70      100002
----------------------------------------------------------
===================== COMBAT SPELLS ======================
----------------------------------------------------------
DEC HEX NAME                    AI VALUE             FLAGS
                                NON BAS ADV EXP
----------------------------------------------------------
10  0A  Quicksand               1   1   1   1       000081
11  0B  Land Mine               1   1   1   1       000081
12  0C  Force Field             1   1   1   1       000081
13  0D  Fire Wall               1   1   1   1       000081
14  0E  Earthquake              1   1   1   1       100001
15  0F  Magic Arrow             10  10  10  10      008211
16  10  Ice Bolt                20  20  20  20      008211
17  11  Lightning Bolt          25  25  25  25      008211
18  12  Implosion               75  75  75  75      009211
19  13  Chain Lightning         75  75  75  75      010211
20  14  Frost Ring              12  12  12  12      008281
21  15  Fireball                15  15  15  15      008281
22  16  Inferno                 20  20  20  20      010281
23  17  Meteor Shower           37  37  37  37      008281
24  18  Death Ripple            20  20  20  20      021201
25  19  Destroy Undead          40  40  40  40      020201
26  1A  Armageddon              100 100 100 100     020201
27  1B  Shield                  10  10  20  20      044845
28  1C  Air Shield              20  20  50  50      044845
29  1D  Fire Shield             10  10  12  15      044815
30  1E  Protection from Air     2   2   4   4       044845
31  1F  Protection from Fire    2   2   4   4       044845
32  20  Prot. from Water        2   2   4   4       044845
33  21  Prot. from Earth        2   2   4   4       044845
34  22  Anti-Magic              10  10  15  20      044815
35  23  Dispel                  3   3   3   3       040041
36  24  Magic Mirror            12  12  18  24      044815
37  25  Cure                    4   4   4   4       040841
38  26  Resurrection            50  50  60  120     081011
39  27  Animate Dead            60  60  60  120     081011
40  28  Sacrifice               1   1   1   1       001011
41  29  Bless                   10  10  11  11      040845
42  2A  Curse                   10  10  11  11      040045
43  2B  Bloodlust               7   7   15  15      041845
44  2C  Precision               7   7   15  15      040845
45  2D  Weakness                7   7   15  15      040045
46  2E  Stone Skin              7   7   15  15      044845
47  2F  Disrupting Ray          7   7   15  15      040011
48  30  Prayer                  8   8   16  16      040845
49  31  Mirth                   1   1   2   2       040C45
50  32  Sorrow                  1   1   2   2       040445
51  33  Fortune                 1   1   2   2       040845
52  34  Misfortune              1   1   2   2       040045
53  35  Haste                   5   5   10  10      041845
54  36  Slow                    5   5   15  15      041045
55  37  Slayer                  1   1   1   1       040815
56  38  Frenzy                  10  10  20  30      040C15
57  39  Titan's Lightning Bolt  75  75  75  75      10A211
58  3A  Counterstrike           20  20  30  30      045845
59  3B  Berserk                 60  60  60  60      041485
60  3C  Hypnotize               25  25  50  100     081415
61  3D  Forgetfulness           1   1   1   1       001425
62  3E  Blind                   50  50  50  50      041415
63  3F  Teleport                20  20  20  20      041011
64  40  Remove Obstacle         1   1   1   1       000101
65  41  Clone                   20  20  40  50      041011
66  42  Fire Elemental          50  50  100 150     080001
67  43  Earth Elemental         50  50  100 150     080001
68  44  Water Elemental         50  50  100 150     080001
69  45  Air Elemental           50  50  100 150     080001
----------------------------------------------------------
=================== CREATURE ABILITIES ===================
----------------------------------------------------------
DEC HEX NAME                    AI VALUE             FLAGS
                                NON BAS ADV EXP
----------------------------------------------------------
70  46  Stone Gaze              1   1   1   1       00101C
71  47  Poison                  1   1   1   1       00101C
72  48  Bind                    1   1   1   1       001018
73  49  Disease                 1   1   1   1       00101C
74  4A  Paralyze                1   1   1   1       00101C
75  4B  Age                     1   1   1   1       00101C
76  4C  Death Cloud             1   1   1   1       000018
77  4D  Thunderbolt             1   1   1   1       000218
78  4E  Dispel Helpful Spells   1   1   1   1       000018
79  4F  Death Stare             1   1   1   1       000018
80  50  Acid breath             1   1   1   1       000018

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 24, 2018 04:43 PM

You can see that it's not half as hard as it might seem to improve the way how AI picks secondary skills. All you need is to replace AI estimates with your own. In simplest value-based scenario you can even solve this with just hex-editing.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
phoenix4ever
phoenix4ever


Legendary Hero
Heroes is love, Heroes is life
posted October 24, 2018 04:53 PM
Edited by phoenix4ever at 16:54, 24 Oct 2018.

Hmm dont know if I wanna mess with that, but it is at least interesting to see how it works.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 26, 2018 04:21 PM

AI and University

If AI hero decides to visit University, he'll try to learn all available secondary skills there at once, as if they are offered as new skills at level-up; provided, of course, AI player has enough gold to pay for them. AI hero cannot learn, for example, just one skill of four, if all four are among his most valued skills.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Maurice
Maurice

Hero of Order
Part of the furniture
posted October 26, 2018 06:30 PM

AlexSpl said:
AI and University

If AI hero decides to visit University, he'll try to learn all available secondary skills there at once, as if they are offered as new skills at level-up; provided, of course, AI player has enough gold to pay for them. AI hero cannot learn, for example, just one skill of four, if all four are among his most valued skills.


This begs a few additional questions:

- What happens if the Hero is eligible for more Skills, but the faction doesn't have enough Gold to buy them all?
- Will it return to it at a later moment to get the rest, or will it not buy anything at all?
- Will it visit it just once and consequently ignore it, or keep visiting it?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 26, 2018 07:36 PM
Edited by AlexSpl at 20:48, 26 Oct 2018.

Quote:
- What happens if the Hero is eligible for more Skills, but the faction doesn't have enough Gold to buy them all?

He learns those with highest values until he runs out of gold, provided they are among (8 minus number_of_already_occupied_secondary_skill_slots) of most valued skills.

Quote:
- Will it return to it at a later moment to get the rest, or will it not buy anything at all?

I think, he will return*, if the sum of secondary skill values at University isn't zero too low** (he calculates it before visiting, as he knows what skills are inside), and he has no other objects with higher priority to visit.

Quote:
- Will it visit it just once and consequently ignore it, or keep visiting it?

He won't visit* University again if he already knows all the skills there, or if their values are 0 too low.

* More tests are needed, as I'm not sure if the value of University itself is zero.

** Well, actually the_strongest_spell_efficiency_delta() cannot be less than 10. That means magic skill values can be greater than 0, even if a hero doesn't know any spells.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
chucktar
chucktar


Hired Hero
posted May 16, 2019 01:24 AM

Thanks for extra informations.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
longtry
longtry


Adventuring Hero
posted June 26, 2019 06:37 AM

AlexSpl said:
This is how it's intended to be. Players should be satisfied No one would play the game where you cannot beat the AI. Look at chess. To beat a modern professional chess AI is quite an achivement, I'd say.
It seems you're really interested in algorithms. What would you say to be some elements that, when added to board games, will pose huge obstacles to the AI? So that we humans will have better chance?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 3 pages long: 1 2 3 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0769 seconds