MNAI-U: unofficial build & bugfixes

Is your mod folder called "More Naval AI"? I assume FfH 0.41o does run fine?

Lfgr (or is that Ifgr?), the answer would be yes to both.
 
Hm, okay. Maybe try simply disabling the intro movie in your .ini? I.e., open "Documents/My Games/Beyond the Sword/CivilizationIV.ini" and change the line "NoIntroMovie = 0" to "NoIntroMovie = 1". While you're at it, maybe also change "HidePythonExceptions = 0" to "HidePythonExceptions = 1", in case it's a python problem.

Another thing to try: Go to "Mods/More Naval AI/Assets", and remove (or rename) CvGameCoreDLL.dll, and rename CvGameCoreDLL_assert.dll to CvGameCoreDLL.dll. Then start again; it will (most probably) crash again, but if we're lucky there could be a "Assertion Failed" popup before that. If there is, make a screenshot or copy the text and post it here, and maybe I can identify the problem.

(Oh, and it's a lowercase 'L', not that it means anything specific.)
 
New release: mnai-2.9u.
Should be compatible with the 2.9-beta3u savegames.

Download setup
Download archive

Highlights of this release:
  • The Customizable Domestic Advisor (CDA) now works properly. You can activate it in the BUG options (you need to restart civ to actually activate it). The CDA allows arranging columns and saving and loading settings. The (now functional) tooltips should explain its usage.
  • If the Revolution gameoption is activated, the new "Revolution" page of the CDA that shows the stability modifiers in each of your cities. There is much more detail available here than in the old Revolution advisor. Please note that this is WIP and not very polished yet. The revolution tooltip in the city screen and the old Revolution Advisor are largely unchanged, but I plan to replace both in the long run.
  • I also simplified many of the stability effect calculations. I tried to restrict myself to simplifications that are necessary to (even roughly) explain the effects in a tooltip, and other things that I considered no-brainers. Please see the changelog for more details. I tried to keep balance largely the same, and, in doubt, tried to err on the side of caution (so, if anything, keeping cities stable could be slightly easier now). I do plan to rework the Revolutions component further, and I will make a separate post soon where you can read and comment on my ideas.
  • I made three gameplay changes: Illians can now build workshops on snow; the Clairone (Harpy) event has it's frequency reduced considerably; and the inquisition spell no longer removes wonders (but still removes temples).
  • I implemented several small UI improvements, notably, the civ pedia pages now show more information such as unique spells and civics.
  • Finally, I fixed several AI bugs and rewrote AI terraforming. You also should be able to automate your terraformers now.

For a full changelog, see the file mnai_changelog.md included in the download or here.

Thanks everybody for bug reports, discussion and contributions.
I've been very busy with work so I have not had much time for modding, and don't expect to have much time for bug testing in the next two weeks, but have just about finished merging this update with MagisterModmod now. I think the only thing left is making the new AI code take into account all the changed prerequites and effects of some spells in my modmod.


I notice that many spells now have tooltips very similar to the ones I added in python, but they are not quite as useful and having both seems rather redundant. My python tooltips for Summons also list the perks the summoned units get from their summoner's promotions. My tooltips for buildings name the city, and color code whether it is being added or removed. I have tooltips for removing promotions as well as adding them, and most importantly my tooltips for adding/removing promotions list which units will be effected. Often the most important thing I want to see in a mouseover when deciding what spell to cast is whether the spell would provide a buff promotion for only one unimportant unit or whether if could buff dozens of them. I'd love to have a faster more efficient xml/C++ DLL code that still gives such info.

Also, I notice that I can still sometimes cast spells like Bless even when there do not seem to be any eligible units to receive the promotion. I'm not sure that the code for spelling that add promotions is checking whether the units have other promotions that make them immune to the promotions in question.


I noticed that when I lost a city I got a message about how loosing the city caused a reduction in stability, but it gave the name of the wrong city. The city it names was quite safe on the opposite end of my empire, far from any enemies. The city I lost was one I had given a custom name based on the nearest unique feature. I also have some code in my modmod that randomizes the order of the names given to each city, as I just don't like the game always giving city names in the exact same order. I'm thinking I remember seeing some of your code that looks up city names based on that list which probably assumes the names were applied in order, while I think it really ought to check the actual name of the city.
 
I notice that many spells now have tooltips very similar to the ones I added in python, but they are not quite as useful and having both seems rather redundant. My python tooltips for Summons also list the perks the summoned units get from their summoner's promotions. My tooltips for buildings name the city, and color code whether it is being added or removed. I have tooltips for removing promotions as well as adding them, and most importantly my tooltips for adding/removing promotions list which units will be effected. Often the most important thing I want to see in a mouseover when deciding what spell to cast is whether the spell would provide a buff promotion for only one unimportant unit or whether if could buff dozens of them. I'd love to have a faster more efficient xml/C++ DLL code that still gives such info.
All of my tooltips can be disabled in the BUG options (FfH Tab).
If you want them disabled by default in MagisterModMod, go to Config/FfHUI.xml and change default="True" to default="False" for the three ShowSpellXXX options. To prevent people from enabling them, you can comment out the relevant lines in python/FfH/FallFromHeavenOPtionsTab.py.
I plan to extend this and I will definitely take a closer look at what you're doing in MagisterModMod.

Also, I notice that I can still sometimes cast spells like Bless even when there do not seem to be any eligible units to receive the promotion. I'm not sure that the code for spelling that add promotions is checking whether the units have other promotions that make them immune to the promotions in question.
I'll investigate that, thanks.

I noticed that when I lost a city I got a message about how loosing the city caused a reduction in stability, but it gave the name of the wrong city. The city it names was quite safe on the opposite end of my empire, far from any enemies. The city I lost was one I had given a custom name based on the nearest unique feature. I also have some code in my modmod that randomizes the order of the names given to each city, as I just don't like the game always giving city names in the exact same order. I'm thinking I remember seeing some of your code that looks up city names based on that list which probably assumes the names were applied in order, while I think it really ought to check the actual name of the city.
I simply use pCity.getName() there, so I don't think it has to do with city name order. I'll investigate that, too. A quick fix would be to simply replace "%s1" with "a city" a the end of the playerCityLost in python/Revolution/RevEvents.py.
 
I noticed when I tried Fall Further that the Erebus mapscript has options to reduce the % of peaks, change world wrap, and be able to toggle off/on flavor starts. The script is allegedly 1.07+ for both mods and the only marked change for this mod's version was to fix some errors; yet none of those options appear. Why is that?
 
The script is allegedly 1.07+ for both mods and the only marked change for this mod's version was to fix some errors; yet none of those options appear. Why is that?
Not sure if I understand you correctly. The Fall Further version still says 1.07 at the top of the script? That could just mean that they didn't list their changes in the script header.
I'll make a note to check their changes and see what could be ported to MNAI-U.
 
Not sure if I understand you correctly. The Fall Further version still says 1.07 at the top of the script? That could just mean that they didn't list their changes in the script header.
I'll make a note to check their changes and see what could be ported to MNAI-U.
Yes, it turns out they didn't label any changes in the header. I got confused when I glanced at it last night and saw a tuning variable SoftenPeakPercent in the header for both versions, but that appears to merely be a manual permanent option change for the user to leave in the file. The CustomMapOptions for all those are only in the Fall Further version.
 
I'll make a note to check their changes and see what could be ported to MNAI-U.
As an alternative to doing that work, how about including the Terkhen version with MapScriptTools.py? https://forums.civfanatics.com/threads/mapscripttools.540261/
It has all those changes included. The only worse difference vs the Fall Further version is it adds landmark signs, roads, and ruins without giving the user the ability to turn that off via in-game options; but otherwise it's the best version of the three.

(Does anyone else think High sea-level Erebus maps are better than either Erebus Continent or World of Erebus?)

EDIT: After testing it more, it crashes on map generation a lot for sizes greater than standard.
 
Last edited:
I may have found a couple bugs:
1. The Infernal Grimoire "Great Wonder" cannot be rebuilt after using the "Take Infernal Grimoire" Spell, as only the "Read the Grimoire" Spell is made available to the Unit with the "Infernal Grimoire" Effect. The entry in the Sevopedia and code would both seem to indicate that you should be able to build the Infernal Grimoire "Great Wonder" using the "Infernal Grimoire" Item, but it appears that this function is actually tied to the "Infernal Grimoire" Unit, which only appears when the caster of the "Read the Grimoire" spell is killed and because the Unit is not allowed to cast spells due to its type it cannot build the Infernal Grimoire despite that its description says it "Can Build the Infernal Grimoire."
2. The Pirate Coves can be built within 3 tiles of each other, contrary to the description and Sevopedia entry. The intent appears to have been at one time to do this to restrict the power of this Improvement, but when it was restricted to Coast tiles only instead of Ocean and Coast, then the functionality was changed to 2 tiles like Cities and Forts/Castles/Citadels because it made them too weak. Yet, the descriptions were not updated to reflect this change.
 
The BUG Event Signs option doesn't do anything. Truffles, Goblin dumping, etc never display.
 
The volcano event doesn't destroy any improvements around the trigged peak. Is this intended?
Civ4ScreenShot0029.JPG
After I have stolen the recently conquered Celo from the sheaim using Loki disruption ability, their priest, that was doing an inquisition in the city to remove RoK and Empyrean, ends removing the Ashen Veil too, its own religion. I'm know that this could be because my state religion, the Octopus Overlords, was not present in the city, but an inquisitor removing its own faith from a city doesn't seen right. I'm have attached a save, if its necessary.
 

Attachments

  • Perpentach TURN-0353 (I.B).CivBeyondSwordSave
    365.7 KB · Views: 24
1. The Infernal Grimoire "Great Wonder" cannot be rebuilt after using the "Take Infernal Grimoire" Spell, as only the "Read the Grimoire" Spell is made available to the Unit with the "Infernal Grimoire" Effect. The entry in the Sevopedia and code would both seem to indicate that you should be able to build the Infernal Grimoire "Great Wonder" using the "Infernal Grimoire" Item, but it appears that this function is actually tied to the "Infernal Grimoire" Unit, which only appears when the caster of the "Read the Grimoire" spell is killed and because the Unit is not allowed to cast spells due to its type it cannot build the Infernal Grimoire despite that its description says it "Can Build the Infernal Grimoire."
This is because there is a bug when you put the Infernal Grimoire back into a city it gives you another free technology. AFAIK that bug has never been fixed so there has never been made a way to put back or move from one city to another that particular wonder. It is frustrating for sure if you accidently pick it up.
 
I'm still playtesting my modmod post merge and found a few issues, which I assume exist in MNAI too although I have not checked yet.


Is the Trigger Python Effects toggle in Worldbuilder supposed to effect Advanced Starts games? Is the game supposed to remember the state of that toggle between games instead of going back to a default?

In my modmod the any player researching a religion-founding technology receives a free disciple or priest (depending on whether they know Priesthood yet). Normally they get these in Advanced Start games too, but I found that if I had turned off that toggle in worldbuilder during my previous game then I don't get them.



Using pPlot.setTempTerrainType(gc.getInfoTypeForString('TERRAIN_COAST'), iRnd) on a land tile seems to permanently changes the tile to coast rather than setting any sort of temporary terrain. Is this intentional, in order to prevent some AI issues or crashes related to land turning to water or vice versa?

(I was trying to see how a Water Affinity Channeling IV spell that changes land to water would work, although I wasn't sure I'd keep it that way as I vaguely recall some crashes in the past.)



I am getting a repeatable crash in my current game whenever I try to use worldbuilder to connect an island to the mainland.

The current map has an island with only two plots, one of which has a source of enchantment mana and the other a unique feature (Wode's Oak, which generates baby spiders and provides shadow mana), located between my continent and an unexplored continent. I wanted to add another land plot to the island so I could build a city or superfort to let me access those mana sources. For a while it seemed like the game would crash whenever I used the Plot Type Control but not the terrain control, but now I realize that I just happened to be using the Terrain control to change plots that would not connect the island to either larger landmass and Plot Type on tiles that would join landmasses together. Whether using Plot Type or Terrain, I now find I can slightly enlarge the island but that I get a instant Crash to Desktop if I try to connect it to any other landmass. I even get such a crash if I create new single tile islands and then connect them with each other.



Only the Lanun AI seems to able to use Workboats. AI or Automated Workboats owned by any player but the Lanun are just moving to places where the Lanun would be able to build Pirates Coves and staying there. I often find large stacks of workboats and a lot of unimproved coastal resources nearby.

I think that this issue though might be caused by a change I made to the Pirate Cove spell. I made it so that instead of requiring the Workboat unit type and the Lanun civilization, it could be used by any Naval units with Seafaring (except heroes or those carrying cargo). I have it so that unguarded Pirate Coves/Harbors/Ports generate barbarian ships with Seafaring which could then go on to make more Pirates Coves that generate more barbarian ships, largely as a way to give hidden nationality Lanun pirate ships more plausible deniability. I might need to rethink the mechanic if it stops anyone but the Lanun from using workboats though.

Speaking or Pirates Coves, I find it rather annoying that improvements that generate units have to be Permanent in order to prevent them from being automatically removed by any rival units entering the tile. I'd rather Pirates Coves/Harbors/Ports be able to be pillaged like normal units but still generate barbarian pirate ships. I made a onMovePirateCove workaround to simulate pillaging, but still. Having a separate tag determine which improvements get removed by rival untis entering them wuold make more sense.
 
Last edited:
I think that this issue though might be caused by a change I made to the Pirate Cove spell. I made it so that instead of requiring the Workboat unit type and the Lanun civilization, it could be used by any Naval units with Seafaring (except heroes or those carrying cargo). I have it so that unguarded Pirate Coves/Harbors/Ports generate barbarian ships with Seafaring which could then go on to make more Pirates Coves that generate more barbarian ships, largely as a way to give hidden nationality Lanun pirate ships more plausible deniability. I might need to rethink the mechanic if it stops anyone but the Lanun from using workboats though.
If you don't mind a suggestion, I would recommend either creating a 2nd spell exactly like the original Pirate cove spell but only usable by barbarian instead of only Lanun or if possible edit the original spell to be only usable by Lanun and barbarian.
 
Using pPlot.setTempTerrainType(gc.getInfoTypeForString('TERRAIN_COAST'), iRnd) on a land tile seems to permanently changes the tile to coast rather than setting any sort of temporary terrain. Is this intentional, in order to prevent some AI issues or crashes related to land turning to water or vice versa?

(I was trying to see how a Water Affinity Channeling IV spell that changes land to water would work, although I wasn't sure I'd keep it that way as I vaguely recall some crashes in the past.)
TERRAIN_COAST also changes the plot type to water, and there is no temporary plot type. This behavior specifically is surely not intentional, but I'm not keen on adding temporary plot type, it's some work and probably not worth the problems it might bring.

Only the Lanun AI seems to able to use Workboats. AI or Automated Workboats owned by any player but the Lanun are just moving to places where the Lanun would be able to build Pirates Coves and staying there. I often find large stacks of workboats and a lot of unimproved coastal resources nearby.

I think that this issue though might be caused by a change I made to the Pirate Cove spell. I made it so that instead of requiring the Workboat unit type and the Lanun civilization, it could be used by any Naval units with Seafaring (except heroes or those carrying cargo). I have it so that unguarded Pirate Coves/Harbors/Ports generate barbarian ships with Seafaring which could then go on to make more Pirates Coves that generate more barbarian ships, largely as a way to give hidden nationality Lanun pirate ships more plausible deniability. I might need to rethink the mechanic if it stops anyone but the Lanun from using workboats though.

The pirate cove AI is currently activated based only on the player, and it only checks the civilization requirement. So everybody is a pirate in your mod.
I will change this to use my relatively new CvUnit::canCastWithCurrentPromotions function – it does not check things like disabled spellcasting or python requirements, but most unit/player characteristics that only change when acquiring or losing promotions. Check the C++ code for the specifics.

A second spell currently wouldn't work, the AI can only be configured to use a single spell.

I'll look into the rest of your comments, thanks.
 
Top Bottom