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 > Heroes 5 - Modders Workshop > Thread: Creating a more challenging AI
Thread: Creating a more challenging AI
ZombieLord
ZombieLord


Promising
Famous Hero
that wants your brainz...
posted February 23, 2007 05:46 PM

Creating a more challenging AI

This thread explains how to make the AI stronger by making it cheat even more giving more starting money and extra growth for the AI.

Perhaps you think: "why did I not create a MOD for this?". Well, there are many versions of Heroes V and this MOD requires to modify a base stat file, which differs from version to version. If you follow me step by step, you'll create this mod yourself!

Let's start:
- Go to the directory where you installed Heroes V.

- Open 'data' folder.

- Use WinRar or WinZip to open your latest patch .pak file. There should be a pak called pX-data.pak (X is a number here). Open the one with the greatest number. If you do not find any of these pX-data.pak files, then open data.pak.

- Enter the GameMechanics folder and then RPGStats.

- You should find a file called DefaultStats.xdb here. If it doesn't exist (or one of the folders above), then it means this latest patch does not include this file so check the previous patch pak (the pX-data.pak with the greatest X, excluding the paks you already tried), and repeat the step above; also, if there doesn't exist any other pX-data.pak, open data.pak.

- Extract the DefaultStats.xdb file to Heroes V directory/data/GameMechanics/RPGStats (create these folders if they don't exist).

- Open the extracted file with a Text Editor like NotePad.

- This file contains information about various Game Mechanics. First we want to give the AI more starting resources. Find the <StartComputerResources> section. The first Item section is for Easy, the second for Normal, the third for Hard and the last one for Heroic. I think you can figure out yourself how to modify the AI's starting resources now. Here is the section of my MOD: (you can use other values, of course )
Quote:

<Item>
 <Wood>15</Wood>
 <Ore>15</Ore>
 <Mercury>8</Mercury>
 <Crystal>8</Crystal>
 <Sulfur>8</Sulfur>
 <Gem>8</Gem>
 <Gold>30000</Gold>
</Item>
<Item>
 <Wood>25</Wood>
 <Ore>25</Ore>
 <Mercury>12</Mercury>
 <Crystal>12</Crystal>
 <Sulfur>12</Sulfur>
 <Gem>12</Gem>
 <Gold>50000</Gold>
</Item>
<Item>
 <Wood>30</Wood>
 <Ore>30</Ore>
 <Mercury>15</Mercury>
 <Crystal>15</Crystal>
 <Sulfur>15</Sulfur>
 <Gem>15</Gem>
 <Gold>60000</Gold>
</Item>
<Item>
 <Wood>50</Wood>
 <Ore>50</Ore>
 <Mercury>25</Mercury>
 <Crystal>25</Crystal>
 <Sulfur>25</Sulfur>
 <Gem>25</Gem>
 <Gold>75000</Gold>
</Item>



- Now find the <AI> section, then the <Adventure> sub-section. Now, go to the <DifficultyHard> sub-sub-section and find <TownCreatureGrowthCoef>. Set the value to 1.5 to have the Hard AI have 50% more growth (you can set it to other values if you like). Now, for <DifficultyHeroic>, set the <TownCreatureGrowthCoef> to 2 to give the Heroic AI double growth.

With these modifications, the Hard AI is challenging (sometimes it's still easy), but the Heroic AI sure becomes difficult. Of course, only fanatic Heroes V gamers like me would play this changed Heroic and enjoy it

Hope you'll enjoy a more challenging AI now. You can tweak the values if it's too weak/hard for you.


Now, to create a MOD from this:
- Use WinRar or WinZip to create a new .zip file. Add a new folder to this Zip called GameMechanics. Now, open this folder and create another one named RPGStats. Open this one too and add the modified DefaultStats.xdb here. Save this Zip file in your Heroes V directory/data folder (the name doesn't matter, just make sure the extension is .pak and not .zip!).

- And you're done. You can even delete the modified DefaultStats.xdb file along with the created folders (those that are OUTSIDE the pak file, of course) as the game engine will read from the pak file you just created.

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

Tavern Dweller
posted January 16, 2022 09:43 PM
Edited by Loran at 21:45, 16 Jan 2022.

ZombieLord said:
This thread explains how to make the AI stronger by making it cheat even more giving more starting money and extra growth for the AI.

Perhaps you think: "why did I not create a MOD for this?". Well, there are many versions of Heroes V and this MOD requires to modify a base stat file, which differs from version to version. If you follow me step by step, you'll create this mod yourself!

Let's start:
- Go to the directory where you installed Heroes V.

- Open 'data' folder.

- Use WinRar or WinZip to open your latest patch .pak file. There should be a pak called pX-data.pak (X is a number here). Open the one with the greatest number. If you do not find any of these pX-data.pak files, then open data.pak.

- Enter the GameMechanics folder and then RPGStats.

- You should find a file called DefaultStats.xdb here. If it doesn't exist (or one of the folders above), then it means this latest patch does not include this file so check the previous patch pak (the pX-data.pak with the greatest X, excluding the paks you already tried), and repeat the step above; also, if there doesn't exist any other pX-data.pak, open data.pak.

- Extract the DefaultStats.xdb file to Heroes V directory/data/GameMechanics/RPGStats (create these folders if they don't exist).

- Open the extracted file with a Text Editor like NotePad.

- This file contains information about various Game Mechanics. First we want to give the AI more starting resources. Find the <StartComputerResources> section. The first Item section is for Easy, the second for Normal, the third for Hard and the last one for Heroic. I think you can figure out yourself how to modify the AI's starting resources now. Here is the section of my MOD: (you can use other values, of course )
Quote:

<Item>
 <Wood>15</Wood>
 <Ore>15</Ore>
 <Mercury>8</Mercury>
 <Crystal>8</Crystal>
 <Sulfur>8</Sulfur>
 <Gem>8</Gem>
 <Gold>30000</Gold>
</Item>
<Item>
 <Wood>25</Wood>
 <Ore>25</Ore>
 <Mercury>12</Mercury>
 <Crystal>12</Crystal>
 <Sulfur>12</Sulfur>
 <Gem>12</Gem>
 <Gold>50000</Gold>
</Item>
<Item>
 <Wood>30</Wood>
 <Ore>30</Ore>
 <Mercury>15</Mercury>
 <Crystal>15</Crystal>
 <Sulfur>15</Sulfur>
 <Gem>15</Gem>
 <Gold>60000</Gold>
</Item>
<Item>
 <Wood>50</Wood>
 <Ore>50</Ore>
 <Mercury>25</Mercury>
 <Crystal>25</Crystal>
 <Sulfur>25</Sulfur>
 <Gem>25</Gem>
 <Gold>75000</Gold>
</Item>



- Now find the <AI> section, then the <Adventure> sub-section. Now, go to the <DifficultyHard> sub-sub-section and find <TownCreatureGrowthCoef>. Set the value to 1.5 to have the Hard AI have 50% more growth (you can set it to other values if you like). Now, for <DifficultyHeroic>, set the <TownCreatureGrowthCoef> to 2 to give the Heroic AI double growth.

With these modifications, the Hard AI is challenging (sometimes it's still easy), but the Heroic AI sure becomes difficult. Of course, only fanatic Heroes V gamers like me would play this changed Heroic and enjoy it

Hope you'll enjoy a more challenging AI now. You can tweak the values if it's too weak/hard for you.


Now, to create a MOD from this:
- Use WinRar or WinZip to create a new .zip file. Add a new folder to this Zip called GameMechanics. Now, open this folder and create another one named RPGStats. Open this one too and add the modified DefaultStats.xdb here. Save this Zip file in your Heroes V directory/data folder (the name doesn't matter, just make sure the extension is .pak and not .zip!).

- And you're done. You can even delete the modified DefaultStats.xdb file along with the created folders (those that are OUTSIDE the pak file, of course) as the game engine will read from the pak file you just created.


I know this is an old post but I came by this post and was very interested in it since I love H5 but the ai is way to easy for me.

I did everthing you said and it worked without any bugs. I played a map (rise to power I think it is called, its a vanilla h5 map) and I noticed the increase in the AI creature growth (I choose the double one) but the problem is that the AI flees, even if I am only just 1% stronger than the ai, we are almost the same and it flees! the game became easy again for me and sadly it was still was not a challange.

The problem now that I see with h5 AI is not the creature growth (though that was a problem too) its that the AI flees to much, when he could do a ton of damage to you or even defeat you!

is there any way to change that? make the AI not flee when he clearly can do a bunch of damage to you or as I said, even defeat you.

is there also any way to make the AI less aggressive to other AI and more aggressive towards the human player since I noticed that is a problem too. In the first two weeks the AI can start fighting each other and like 4 AI have been defeated within two weaks of the month while they completely ignore the human player. It would be more fun if the ai was more aggressive and kept attacking the human player rather than fight each other until you then defeat them all since they drained their creatures fighting eachother, the human player just comes along and kills off the remaining now weaker AI.

I see there is an option called <AttackHumanAggressivityCoef>, is this the option to make the ai attack you more and the other AIs less? and if thats true, what valure should it be to make it very difficult. Right now it has value 1

The other one is called <CowardiceVersusHuman>, is this the option to make the ai flee less from humans in battle? if that is true, what value should it be to make the ai more aggressive towards you and be less aggressive against other computer players. The current value of this option is 0.3

Anyway, I hope I explained the issue of the ai well and what I am hoping to achieve through modding the ai.

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


Admirable
Legendary Hero
modding wizard
posted January 17, 2022 02:48 PM

There is not much you will achieve in this section, its not about combat AI, if you want all AI to team up against you in H5 vanilla you can ally them in the map editor, but use the map properties list instead of the regular settings since that pane is bugged.

In h55 I added a variable in the setting-pak that does it automated for advanced players. I'm currently trying to have the option more easily available in the custom game menu, maybe in next version, maybe not.
____________
MMH5.5 Downloads | MMH5.5 Translations | MMH5.5 FAQ

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

Tavern Dweller
posted August 24, 2022 02:42 AM
Edited by DmanRangerD at 02:44, 24 Aug 2022.

My thoughts... It's not that the AI just runs from me often! I also notice it hardly ever fights monsters on the map! It never seems to defeat those guarding gateways, or areas guarded with treasures and artifacts, it just leaves those. Eventually I come around, and the enemy heroes sees me coming and runs, and than I defeat the neutral monsters, claim a mine, maybe a dwelling, etc, and continue on. The next turn, once it seen me travel far enough out of way, I'll see AI stop by my mines, or resources, and the dwellings, and claim them for his own use?? ONLY because, I've already cleared the neutrals, and their nothing guarding it.

I have seen the AI heroes fight neutrals, but not often enough. I know when I mouse over a fight, albeit neutrals, heroes, or castles, I get a predictive outcome on the window before the fight! I'm assuming, the AI gets the same thing. I can't ask it though!! LOL! Seeing as it's a computer, it likely looks, calculates, decides, and moves, in the blink of an eye, but the ai probably decides to fight if it's an easy enough fight!

SO. Is their a way to possibly increase it's Risk Taking chances?
Another thing I noticed. It always seems to spam the same combat spells in a fight. Whomever I fight in game, what ever spell book they have, once I see Stone Spikes, i see that the whole, I hardly see it change it spell casting. Maybe Endurance after i've hit a monster and it's going to die soon, or haste 2 turns in, after it's moved that creature. but mostly, it spams the same combat spells most of fight, Fireball, Stone spikes or Winter Circle. It's as if it has not tactical processing in a combat. It sticks to simple procedures.

But you can't teach AI tactics... Can't teach the ai to learn from it's mistakes.

Btw, I'm only on H5 ToE!
____________
HoMM V ToE passionately!
Map Editor in training!

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


Admirable
Omnipresent Hero
Endless Revival
posted August 24, 2022 12:36 PM

Do you play at least hard? Maybe it can't use magic above your highest tier because of easier difficulty. Either way H5 AI is pathetic. The only reason it may look capable is because it gets building discounts and can see the map so it can rush you soon.
____________
H5 is still alive and kicking, join us in the Duel Map discord server!
Map also hosted on Moddb

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

Tavern Dweller
posted October 07, 2022 10:23 PM
Edited by richmond33 at 22:34, 07 Oct 2022.

Im glad this thread got necroed. Heroescommunity has such a wealth of resources and info about the game that get burried and forgotten with time.

When i want a challenge i usually put 2 AIs in the same team as magno said - pick the map, take a couple mins to edit teams in map editor and go. So thats one way to boost difficulty - you can even go 1v7 if u like to. But Zombielord's findings are great for buffing the enemy on 1v1 maps.

Loran said:
The problem now that I see with h5 AI is not the creature growth (though that was a problem too) its that the AI flees to much, when he could do a ton of damage to you or even defeat you!

is there any way to change that? make the AI not flee when he clearly can do a bunch of damage to you or as I said, even defeat you.



Yes there is. Our friends over at the russian forums have alot of good stuff. I was digging around in forum.heroesworld.ru and i found these:

megaAI_mod_1.2
Version: 1.2
Author: Alexoff (creator), Ogo-i (idea and initial testing)
Pavlan (further development).
Description:The mod enhances artificial intelligence in heroes 5. The main difference is that the AI now more often chooses skills that are useful for its race and it knows how to use well (and most often just passive ones). Rangers and Knights can take retribution, and the Necromancer likes to take fiery warriors and much more. Also, AI now likes to visit the library, prefers to hire own faction heroes etc... At the same time, the mod does not touch the game difficulty settings in any way (like the Classic AI mod), it only improves enemy heroes.

Version 1.1 - fixed a bug with "forgetting" the necessary items. AI has become even stronger and more stubborn.
Version 1.2 - Allows you to prevent AI heroes from running away from the battlefield and further strengthens the AI.
Version 1.2XL - for cards larger than 176x176


no_escape_for_ai
This is just the enemy-no-flee script from megaAI, if for some reason you dont want the whole mod. It asks at the start of the game if you'd like to ban the AI from fleeing.


DmanRangerD said:

Another thing I noticed. It always seems to spam the same combat spells in a fight. Whomever I fight in game, what ever spell book they have, once I see Stone Spikes, i see that the whole, I hardly see it change it spell casting. Maybe Endurance after i've hit a monster and it's going to die soon, or haste 2 turns in, after it's moved that creature. but mostly, it spams the same combat spells most of fight, Fireball, Stone spikes or Winter Circle. It's as if it has not tactical processing in a combat. It sticks to simple procedures.



Here's another great one. I highly recommend this. Only done a few fights with it but i already consider it a mandatory mod for TotE:

CombatAIFix
Author: RedHeavenHero
Description: A small mod aimed at improving the behavior of AI in combat. At the moment, the mod covers the most obvious hole in its behaviour - casting spells. AI will become more active in using mass and other abilities and spells that do not require a target (like summoning a phoenix and elementals), as well as more adequately assess the power of Deflect Missile spell.
The mod does not use materials from other AI mods. It implements the potential laid down by the game developers, that does not work due to errors in the code.
Compatibility: The mod is only compatible with game version 3.1. Apart from the AI, the mod does not change other aspects of the game, so you should expect full support for version 3.1 features, with all their advantages and disadvantages.
If the mod is to be used in a game over a network, it must be installed for all its participants, otherwise desynchronization is highly likely.
Installation: Place the H5_Game.CombatAIFix.exe file from the zip into the game's bin folder. Use that file to start the game.



https://www.mediafire.com/file/g65blzxwdzrzxnz/105_MegaAI.zip/file
https://www.mediafire.com/file/8u2h6i4vzg5g9x9/no_escape_for_AI.zip/file
https://www.mediafire.com/file/2603rem0x3ecrn2/CombatAIFix_v1.1.zip/file

edit: For some reason i cant post hyperlinks

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


Adventuring Hero
*cookie magic*
posted October 10, 2022 07:46 PM

Thanks for posting the AI mods. I tried the CombatFix one and it seems like the AI cast spells a bit better but not much different than vanilla AI tbh. They still won't cast Fire Traps even when faced with all melee enemies and that is the only spell available. Instead they just do the auto-attack.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0678 seconds