[MOD] More Naval AI

I did take a look at the RifE code a while back and saw it used some new XML tags, which I wasn't ready to dig into yet, though that is probably the best route to follow.

Yeah. Only new xml would be the added entries into the aforementioned file (not hard, like adding a gameoption), a few tags in GoodyInfos (which would be necessary for lair results regardless, unless it's all python... In which case AI is a bit difficult), and then two lists, one in GoodyInfos and one on Improvements, both for GoodyClasses. Unless you import a bit of extra code lists won't work, but it wouldn't be hard to convert them to an array.
 
Knox Harrington said:
Does this mod modify any AI lair exploration code?
Only slightly. The only thing I changed was that I banned the AI from exploring any lairs before turn 10. This at least gives them the chance to build a warrior or two. It is one my to-do list for some future revision to improve the way the AI looks for and choose to explore lairs.
May I ask the location in gamefiles of that code? I took a quick peek around but couldn't find anything.
 
Thanks mate! Btw, I really appreciate that someone focuses on improving vanilla FFH! Alas, I am terrible at modding, or I'd try to mod stuff myself.
 
Wanted to chime in and say thanks for this mod! With Wildmana going in a different direction, it's awesome that there is still a good place to get AI fixes and improvements to the base mod.
 
Tested on Huge Archipelago map, Marathon speed, 7 civs.

-Not a single crash
-AI settled other islands and continents
-AI launched a few oversea invasions

As far as i'm concerned, this is the best mod by miles that could happen to FFH.
No longer am i stuck to pangea type maps, just awesome.
 
Thanks mate! Btw, I really appreciate that someone focuses on improving vanilla FFH! Alas, I am terrible at modding, or I'd try to mod stuff myself.

Wanted to chime in and say thanks for this mod! With Wildmana going in a different direction, it's awesome that there is still a good place to get AI fixes and improvements to the base mod.

Tested on Huge Archipelago map, Marathon speed, 7 civs.

-Not a single crash
-AI settled other islands and continents
-AI launched a few oversea invasions

As far as i'm concerned, this is the best mod by miles that could happen to FFH.
No longer am i stuck to pangea type maps, just awesome.


Thanks for all the kind words! Always good to hear that my effort isn't wasted. I have all intentions to continue working on this project and improving the AI as much as I can. In fact, I'll be releasing version 1.6 in the near future.
 
Playing my second full game, on a Highlands script so I'm afraid all your naval enhancements are going to waste. Immortal difficulty. I have several observations, compared to vanilla:

1) The AIs are better at teching, and much better at building wonders.
2) I have found it somewhat easier to maintain good relations with the AIs. This may just be due to a small sample size.
3) AIs are not particularly better at fighting. I've seen lots of strong units, like Stygian Guards, moving around seemingly randomly, rather than defending in cities or counterattacking. I haven't had any catapult or magic AoE spells used against my attacking stacks.
4) I just captured the Lanun capital. It has a Pirate Port on a lake, but could have had two more pirate ports on ocean tiles, and built neither.
5) The AI is really good at pumping culture in border cities (maybe this is just because OO was widespread in both games), and likes to plant a city right against my boundaries and then complain about close borders. I remember similar behavior in BTS, so this is probably not new. The Lanun walked a unit completely around my nation (from 12:00 to 7:00, with my empire as the clock face), and built an isolated city. Then they pumped 5-6 OO disciples into the city for cultural pressure. Cute, but not really an efficient use of hammers (espcially because I captured the city later).
 
Thanks for all the kind words! Always good to hear that my effort isn't wasted. I have all intentions to continue working on this project and improving the AI as much as I can. In fact, I'll be releasing version 1.6 in the near future.

Great news. Do you have a changelog yet?
 
Version 1.6 released (incompatible with previous saves) - DOWNLOAD LINK

Changes with this update:
  • AI
    • More tweaks to how the AI values religions
    • AI will always have some interest in researching their Favorite Religion, even if it has already been founded
    • AI favors units with its Favorite Unit Combat a little more
    • Pillaging large amounts will modify War Success rating
    • Updates to ConquestMove so that Barbarian Allies won't search for Barbarian cities to attack
    • Tweaks to how units are assigned as PermDefense (should keep Heroes from being assigned as city defenders)
    • Many updates and tweaks to AI_promotionValue()
      • Pushed the AI for mage promotions into the DLL (was previously handled in Python)
      • More code to handle FFH-specific promotion tags
      • AI will choose Inquisitor promotion when pursuing Religious Victory
      • Many formula adjustments to account for the fact that Combat promos give +20 rather than +10 as in base civ
      • Added in some adjustments for FFH-specific AI types (for example, AI_HERO and AI_TERRAFORMER just to name a couple)
    • Floating Eyes will now try to Recon rather than attack
    • Found and fixed an issue that would cause Mana Upgraders with Metamagic II to Dispel mana nodes right after building them
    • Re-allowed the AI to cast Dispel (AI will now properly dispel and rebuild mana for Tower victory given enough mana nodes and enough time)
    • Minister Koun will adopt a religion
    • Minister Koun starts with the same Favorite Religion as the leader that created him (this will actually work for any 'spawned' civilization that doesn't have a Favorite Religion)
    • AI will use the Lichdom spell
    • AI less interested in casting Wonder
    • Mercurians and Infernal enter Conquest mode immediately; other minor tweaks for how civs are put into Conquest mode
    • AI will enter Conquest mode when at war (should prevent the issue of large Barbsmasher stacks wandering aimlessly when at war)
    • AI should be better at building missionaries for cities on other landmasses
    • AI takes into account the Worker rates for the default race when deciding how many workers to build
    • AI more interested in building Missionary ships, especially when pursuing a Religious Victory
    • AI will switch AIs for Missionary ships that upgrade and then find themselves with no cargo space
    • AI more likely to build Priests when pursuing Religious Victory
    • AI will opportunistically cast Spring if they are next to Smoke or Fire in their territory
    • Units preparing for a city attack prefer to group rather than wander alone
    • Units designated as Counter units should be a little more aggressive about making opportunistic attacks
    • Better handling and AI assignment for captured animals
    • Warwizards use ConquestMove rather than MageMove (MageMove is for city defense adepts)
    • Naval Units will now choose Crew promotions (finally got this working!)
    • Terraformers and Mana Upgraders wont try to group
  • BUG FIXES
    • Bug fix - Barbarians no longer allowed to cast Resurrection
    • Bug fix - fix for text display for impassable terrains in Unit Help
    • Bug fix - catch for wrong units getting Mage AI
    • Bug fix - War Machine now given Hero AI
    • Bug fix - Wilboman now given Hero AI
    • Bug fix - fix for incorrect code that could prevent the AI from building a proper Naval force
    • Bug fix - AI civs now rewarded bonuses for exploring Letum Frigus as appropriate
    • Bug Fix - fix for a bug that would sometimes cause the AI to not upgrade a mana node if it already had mana of that type
    • Bug Fix - Make sure upgraded Workers get proper AI (fixes issue with Slaves upgrading to Lunatics)
    • Bug fix - removed leftover references to unused events from base Civ
    • Bug fix - fixed several internal assert errors that wouldn't cause crashes but would result in improper data being passed about
    • Bug fix / Flavor Tweak - Sons of Inferno no longer spawn directly. Instead, Disciples of Acheron will upgrade to Sons of the Inferno at level 7
  • GAMEPLAY TWEAKS
    • Gameplay tweak - Galleys allowed to upgrade to Caravels again
    • Gameplay tweak - Base movement for Caravels reduced to 5
  • MISC
    • Code improvement - isSummoner, isDebuffer, isBuffer and deBuffCast functions are now all dynamic (they were hardcoded. This should help out any modmodders than want to use my DLL and make changes or additions to the spells. AI will now be better at understanding new or changed spells without additional code)
    • Debug - display Religion values in debug mode
 
I was thinking about using your mod as a base and then going from there.

(I already have a couple mods using patch o FFH2 as a base, but I could easily transfer my ideas over) -> main reasons being is that I have no idea how to code the AI, and I figure your AI changes would be of benefit to my additions as well.

which brings me to a question. Is it some-what easy to give your new AI tags to newly created data? Like new leaders, new units, etc. Or will I have to go beyond the XML if I try to integrate newly created XML data (new civs and such) with your DLL based AI changes?
 
which brings me to a question. Is it some-what easy to give your new AI tags to newly created data? Like new leaders, new units, etc. Or will I have to go beyond the XML if I try to integrate newly created XML data (new civs and such) with your DLL based AI changes?

I'm not sure which new AI tags you're referring to. One of my goals with the DLL changes is to make it so that any changes or additions to the xml for buildings, units, civs, spells, etc, will be automatically understood by the AI. If you're adding coding behavior in python (such as spell effects), the DLL won't be able to understand the effects, so you would have to play around with AIweights to get the AI to use it.
 
Just wanted to thank you for keeping up the good work. I don't have much time on my hands to play FFH now but I hope to try patch 1.6 soon :)
 
I keep casting my worldspell even though i did not press any button.

Heres the save, the next turn, my caravel enters the Elohim city and the spell is cast.

Interesting bug. Thanks for the report and savegame!

Turns out that some code I had added to encourage the AI naval units to choose crews wasn't checking to make sure the owning player wasn't human, so when the ships decided that they didn't need a different crew, that were also checking for any other spells they might be able to cast. In this case, it was your world spell!

I'm not sure why this issue hadn't manifested in other ways, and in fact there was a whole section of special cases like this that weren't checking whether the player is human! Anyway, I have a fix for it, but it will require a new DLL and some testing to make sure that there aren't any adverse side effects from the fix. I'll get a new version up sometime this week.

Thanks again!

Edit: In the meantime, if you want to keep playing without having your world spell used up, try moving your ships manually rather than setting them to be automated.
 
That got me thinking...are there cases where Enraged units would choose to use your worldspell? That would suck.
 
Back
Top Bottom