[MOD] More Naval AI

This mod is still in the works, though it's scope has been greatly expanded.

After return from my vacation, I started by looking into why the AI wasn't valuing the Heron Throne, fixed that, and then saw lots of other places to tweak wonder buildings (such as giving extra weight to wonders when you have the resources to make them build faster; giving industrious leaders extra weight towards building wonders), which then also led to looking into lighthouses and shipyards, which then led to adding some build values for the Mercurians and the Infernals (to get them to focus more on troops and troop buildings instead of other buildings), then tweaking them some more to try and make them more aggressive...

And then I took the big plunge in an attempt to focus back on the Naval AI, downloading the latest Better AI files and starting a merge while attempting to preserve the FFH-specific code. After spending all of last night on that, I estimate I'm about halfway through getting a successful DLL build, at which point I'll need to figure out what AI logic got hosed by the merge, and making some tweaks of my own while copying bug fixes and other useful stuff from Wild Mana (such as getting the AI to understand that Pyre Zombies have collateral value).

Anyway, I just wanted to post an update. No idea when I might actually have a new version of the mod. Merging is a very labor intensive process :crazyeye:
 
Even just using your beta version, it looks like the AI uses naval power better than before. Unfortunately, that's going to be the only version that I can use, because one of your files (CIV4unitinfos.xml) overwrites a file in another mod I use, and I have just got done merging the changes from the two mods into a new file, and don't look forward to doing it again.:p
 
Even just using your beta version, it looks like the AI uses naval power better than before. Unfortunately, that's going to be the only version that I can use, because one of your files (CIV4unitinfos.xml) overwrites a file in another mod I use, and I have just got done merging the changes from the two mods into a new file, and don't look forward to doing it again.:p

It's awesome to hear that someone is actually using my code! Let me know if you run into any consistent issues with Naval production. I do know of one issue that will often result in the AI infinitely producing sea units if they have more than 10 coastal cities.

If I can't get the DLL merge stuff in a better state over the next few days, I might look at releasing my latest Python changes which includes a fix for the previously mentioned issue as well as improved AI for building wonders (in particular, the Heron Throne and Pact of the Nilhorn) and lighthouses, nudges to make the AI value buildings more when it gets a bonus towards building them (via resources or leader traits), and several pokes with a sharp stick for both the Infernals and Mercurians.
 
Progress on this project is coming along better than I expected. I've now been able to make a couple of successful DLL builds, though there is still a lot of work to be done.

Merged in the latest dev version of Better AI, though I had to replace quite a bit of code in doing so. Looks like I managed to keep most if not all of the FFH specific code intact except for where it was redundant with jdog's changes. Still haven't modified the FFH leaderheads to use his new AI victory system yet...

... because first, I wanted to try fixing the issue with AI switching religions too often. So I looked at Denev's mod, and ended up merging in his leaderhead and civ XML changes, as well as a majority of his unofficial bug fixes and code tweaks.

Managed to get a build of that merge last night, and then had an interesting bug crop up where the Minister Koun event would fail, resulting in the civ that received the event being awarded their very own Hyborem unit! Figuring that out is my next task.

Still to do:
  • Update leaderheads
  • Add in latest fixes from the bug thread and Wild Mana
  • Look into stealing some other AI improvements from Wild Mana
  • Figure out what else I broke with the merge and try to fix it

Once those are done and I don't notice any major issues, I'll release a beta 2.0
 
Latest Update: Spent most of the weekend trying to get my merge of the latest Wild Mana build to work. I probably should have solidified things a bit before taking that step as it turned out to be a very difficult process (though I do want to give props to the Wild Mana team for clearly labeling all of their changes in the code!).

I finally have a working build, though it seems to lock up fairly regularly. The good news is that the naval side of things seems to be working splendidly! Had a game last night where the Clan of Embers sent a fleet of Galleys halfway around the world to pick up their Sons of Inferno (I've since fixed that bug), and ferry them back to the homeland to aid in their war against the Bannor!
 
This is because FfH has a check, in the SDK, to stop AI units from moving if they can't move in any direction. This is to prevent a WoC issue. Don't think it would be an issue to exempt one tile islands from this rule (I did it before without noticing a problem) but it requires SDK modding :p

As the settler is surrounded by water it can't move in any direction, therefor the AI is not allowed to use it in any way (including settling).

I happened to run across this code the other night and commented it out. I'm not really sure why it was there in the first place, though I'm a little concerned that it was in place for a certain scenario??

Anyway, the AI can now settle on one-tile islands. Hoping to have a release up by this weekend.
 
Initial post updated. First build of the mega-merge released. Since I've greatly expanded the scope of this mod, I've de-ranked it back to beta 0.7. I would LOVE to hear any and all feedback!
 
I'm just a novice. This project is my leverage into teaching myself Python and C++. Most of what I've done so far is a bunch of copy and pasting (Beyond Compare has been a lifesaver) and then smoothing out the rough edges. A lot of this is already in Wild Mana. The main difference is the naval AI, most of which could be copied over in complete functions.
 
Version 0.8 beta posted. The mother-in-law is in town, so I haven't had much chance to test it, but I found a major crash bug (my code) that I wanted to fix. This patch seems to be very stable now, and I don't seem to have caused any new glaring AI issues.

Version 0.8



Tweaked Hyborem (from Denev) incorporated:
  • Hyborem player can examine the cities for Hyborem's Whisper before choosing which city to take
  • Infernal player starts with revealed map of civ that summoned them

Bug Fixes:
  • Fixed a bug in the new Missionary AI code that could result in a crash
  • Fixed an issue that kept civs from creating their unique buildings
  • Fix for a potential infinite loop (fix by Snarko and Spehi)
  • Fix for an issue with the Poisoned Blade Promotion during lair exploration (link)

Misc
  • More tweaks to early tech choices
 
A simple fix you might wish to consider is to give the Infernals / Mercurians some free ships if they arrive in a coastal city. The Mercurians have been lousy allies in my latest game, as I summoned them on a peninsula split from the rest of the continent by mountains and watched as they completely failed to expand or get involved in any holy wars. Starting the summoned Civs with a couple of ships would at least have given them the capability to settle overseas, if not the desire. Had the Infernals turned up (AC 40 and no sign of them so far), I suspect that they wouldn't have fared any better for the same reason.
 
Looks great. I like that you prefer AI improvements over adding lots of random stuff other mods do.
Wild Mana Merge

[*] Spellcasting AI

Does this include automated terraforming AI (sanctify, bloom etc)?
 
Does this include automated terraforming AI (sanctify, bloom etc)?

No, it does not. I'll consider implementing that feature in the future, but it's not on my radar at the moment.

Hope to have a new version out soon. This one will be updated to patch N and will include some major changes to the production AI (all production choices have been moved into the DLL). I've had some trouble wrangling it to understand certain FFH-specific priorities, but overall I think it will be an improvement.
 
Version 0.9 released! Link is in the first post. (I'll put up the latst DLL source files later tonight)

Lots of small changes in this update, including stuff from better AI and Wild Mana.

The main change was removing all of the python chooseProduction code, and letting the DLL AI handle the decisions about what to produce. This is a major switch, and the AI plays quite differently. I think having the production choices in the DLL will be a major long-term improvement, though it could still use some work. It was a difficult process to get it to this point, so I would love to hear any feedback from anyone about how this AI fares as well as suggestions for improvement.

Version 0.9


  • City production choices for AI players is now handled in the DLL
  • More Player and Team AI imports from Better AI
  • Updated with fixes from patch N

Wild Mana Imports
  • Treant defenders should be a little smarter
  • Tweak to Suicide Summons move
  • AI more likely to explore dungeons and shipwrecks
 
I tried to test this mod out a while ago but ran into some problems. Just to be clear, what are the requirements here? Just patch up to N, install and set sail?

Really looking foward to seeing it in action!:goodjob:
 
Top Bottom