MNAI-U: unofficial build & bugfixes

New release: mnai-2.9-beta2u.

Should be compatible with 2.9-beta1u savegames.

Thanks a lot for all the bug reports and discussion.

Download setup
Download archive

This is the first time I made AI changes, mainly based on reports in this thread:
  • AIs now build way less forts in unowned territory and should be a bit better at guarding them.
  • There is some emergency code that makes the AI guard it's only city better, if it only has one. This should reduce the number of early player kills due to barbarians. The AI seem still a bit too reckless when exploring lairs.

Let me know if there are any problems.

Otherwise, there are some fixes and tweaks as always. Also, there is now a BUG option to remove player death popups; this is especially useful in Revolutions, were players die all the time.

For a full changelog, see the file mnai_changelog.md included in the download or here (unfortunately, notabug.org doesn't render some of it correctly).

I thought I'd also sketch my plans for the next version(s). These things will also affect ExtraModMod and (probably) MagisterModMod.

Of course, I still have a long (and evergrowing) list of small bugs, possible interface improvements and MagisterModMod requests that I'm slowly, but steadily working through. Nothing particular exciting here.

On thing that requires a bit more work (and, crucially, larger contiguous chunks of free time) is the problem of the overflowing SoD help text discussed above. I plan to tackle this for the next version, but no promises.

Finally, I want to slowly go through the revolutions mod to make it more transparent and fitting for FfH. The first step is making a new advisor that is at least more clear than the previous one.
My original plan was to first make the current calculations (for local instability) transparent with tooltips in the new advisor, and then iteratively tweak them. However, the calculations are way too complicated to be displayed like this. As such, I will only make a rudimentary advisor (that shows e.g. that you get +2 instability from unhappiness, but not how it is calculated), and then revamp the whole system. I will make a post with my plans at that stage, so that interested people can discuss.
After local and global stability is revamped, I want to continue to tweak other stuff. For example, in my last game there was a revolution that seemed to receive exclusively scouts, while way better units where already available. Again after that, it would be nice to adapt the whole process better to FfH lore (custom messages, leaders, ...). But all that is for the distant future.

One more thing: From time to time I have to add new texts to the game, obviously in English, and sometimes I also add a Spanish translation. I'm not a native speaker of either language, though; so if you are and you see any weirdly worded phrase, feel free to post here. :)
 
Last edited:
Can you make sure that an AI identifies other AIs by the leader name instead of only the civilization type in cases where multiple leaders of the same civilization are present in the game at the some time?
OKSleeper just complained about trade demands while all 7 demons lords were in his game, but it is an issue that had often annoyed me in the past as well
Agreed, this is also a problem in MNAI with revolutions enabled.

Would it be possible to block units that have a religion from upgrading to unit types with a different religion as a <PrereqReligion> ?

I like letting my Wanderers upgrade to a wide variety of units, but I don't really want Tali's worshipers becoming UUs of other religions.

edit: I just realized this would also prevent me from letting Gaelan upgrade to his Burnt Priest form though. I guess I could always switch that to work through a spell, though it would be nice if a regular unit upgrade could have a python callback to block upgrades based on the upgrading unit's religion/promotions/alignment/etc.
There actually is a check that considers ReligionType in CvUnit::canUpgrade:
Code:
// no cross-religion upgrades for religious units
if (m_pUnitInfo->getReligionType() != NO_RELIGION)
{
   if (kUnitInfo.getReligionType() != NO_RELIGION)
   {
       if (m_pUnitInfo->getReligionType() != kUnitInfo.getReligionType())
       {
           return false;
       }
   }
}

If that doesn't help, the python callback seems the best solution to me. But be aware that it might affect performance; the AI probably calls it very often. I'd have it disabled by default in MNAI.

I'm not sure I'd seen these two asserts before this week.
[...]
My guess is that this is an XML mistake again. I can look at it if you have a save or a crash dump.
 
There actually is a check that considers ReligionType in CvUnit::canUpgrade:
Code:
// no cross-religion upgrades for religious units
if (m_pUnitInfo->getReligionType() != NO_RELIGION)
{
   if (kUnitInfo.getReligionType() != NO_RELIGION)
   {
       if (m_pUnitInfo->getReligionType() != kUnitInfo.getReligionType())
       {
           return false;
       }
   }
}
That would stop a Wanderer from upgrading directly to a Shadow, but not stop it from upgrading to a Hunter, an Assassin, and then a Shadow.

Would it be too big a change to check the religion of the unit to be upgraded rather than the religion type of that unit's current unit type?
(That change would mean, for example, that a Warrior randomly assigned the Runes of Kilmorph religion would not be able to upgrade to a Radiant Guard a Confessor could not become a Prior if its religion had been changed by a python spell.)
 
Would it be too big a change to check the religion of the unit to be upgraded rather than the religion type of that unit's current unit type?
Sounds good. I guess that's what was originally intended anyway. If there are other unintended side effects, we can see how to solve those intependently.
 
Could you make it so that Regenerating a map it clears any holy cities and de-increments any wonders that might have been added in advanced start, so that it is possible to build the wonders or get the holy cities again on the regenerated map?
 
Hi people, I wanted to check out this modmod, but can't get it to work.
My FfH2 0.41o works fine.

I can't use the installer, because it seems to find remnants of an old Steam installation and tries to copy files from there (I have civ4 from GOG now), and when I extract the archive to the FfH2 folder I'm getting an endless feed of XML load errors.
Let me check if I can upload a screenshot....
 
xml load error.PNG
 
Never mind, I got it working but had to install MNAI 2.7 first and then MNAI-U over it
 
It shouldn't be necessary to install MNAI 2.7 (and you might be just playing MNAI 2.7; you can check that in the flag tooltip in-game).
I noticed that there was a mistake in the installation instructions on the download page (corrected now). Maybe that was the problem.
Welcome to the forums, by the way. :)
 
Please check this thread...
https://forums.civfanatics.com/threads/good-lvl-15-but-cant-get-brigit-any-thoughts.313276/

In my opinion, Charadon and Clan leaders do not need to be at war with barbarians necessarily to get Brigit unit. (It is not described anywhere...) It may be not a bug but it seems that Kael also admitted it was not correctly implemented according to that thread. What do you say to letting the Barbarian trait leaders acquire Brigit without declaring war on barbarians?
 
Now that I have so many religions in my modmod, I would really like to have more extra game options so I could use one option for disabling each religion and still have a couple left over for other mechanics. Ideally I'd want to be able to add an arbitrary number of game options in xml rather than needing them hardcoded in the DLL.

It would also be nice if CIV4GameOptionInfos.xml had a tag for disabling a religion, or if CIV4ReligionInfo.xml had a tag for the game options that disables said religion, instead of relying on the hardcoded
Code:
bool CvGame::isReligionDisabled(int iReligion) const
{
    if (iReligion == 0)
   {
        if (isOption(GAMEOPTION_NO_RELIGION_0))
       {
           return true;
       }
   }
    if (iReligion == 1)
   {
        if (isOption(GAMEOPTION_NO_RELIGION_1))
       {
           return true;
       }
   }
    if (iReligion == 2)
   {
        if (isOption(GAMEOPTION_NO_RELIGION_2))
       {
           return true;
       }
   }
    if (iReligion == 3)
   {
        if (isOption(GAMEOPTION_NO_RELIGION_3))
       {
           return true;
       }
   }
    if (iReligion == 4)
   {
        if (isOption(GAMEOPTION_NO_RELIGION_4))
       {
           return true;
       }
   }
    if (iReligion == 5)
   {
        if (isOption(GAMEOPTION_NO_RELIGION_5))
       {
           return true;
       }
   }
    if (iReligion == 6)
   {
        if (isOption(GAMEOPTION_NO_RELIGION_6))
       {
           return true;
       }
   }
   return false;
which only works for the first 7 religions listed in CIV4ReligionInfo.xml and only in that order.

Please check this thread...
https://forums.civfanatics.com/threads/good-lvl-15-but-cant-get-brigit-any-thoughts.313276/

In my opinion, Charadon and Clan leaders do not need to be at war with barbarians necessarily to get Brigit unit. (It is not described anywhere...) It may be not a bug but it seems that Kael also admitted it was not correctly implemented according to that thread. What do you say to letting the Barbarian trait leaders acquire Brigit without declaring war on barbarians?
I personally never understood the need to have a tile with a minimum level prereq holding a Barbarian UNIT_BRIGIT_HELD just so that that can be captured as another Brigit by a high enough level unit. It is much simpler to do what I do in my modmod and have Rescue Brigit be a spell that requires the Ring of Carcer improvement and a unit with a high enough minimum level.

If you feel the need to see Brigit within the Ring of Carcer while she is still a prisoner, then you could probably change the improvement's art to include her art too.
 
It would also be nice if CIV4GameOptionInfos.xml had a tag for disabling a religion, or if CIV4ReligionInfo.xml had a tag for the game options that disables said religion, instead of relying on the hardcoded [...]
I already thought of this.
I'll have to look a bit more into the code before deciding whether adding unlimited gameoptions is possible.

If you feel the need to see Brigit within the Ring of Carcer while she is still a prisoner, then you could probably change the improvement's art to include her art too
Rise/Ashes from Erebus does that, IIRC.
 
Is there something that can be done to make AI respect lairs a bit more? It seems like currently they treat it like goody huts, go in with a level 1 scout and then get their capital smashed by skeletons or something...
Last game I had 3/7 AI civs destroyed within the first 30 turns of the game.
 
I recently discovered some bugs in the code used to save and load worldbuiler saves/scenarios. The code we have been using does not properly write or read the real terrain types associated with temporary terrain such as from the End of Winter Game option. I believe the file I'm attaching to this should fix the issue.
 

Attachments

I think there is a problem with the pedia mouseovers and the FeatureAttacks and FeatureDefenses tags in CIV4UnitInfos.xml

I tried adding a new unit with double attack and defence strength on Hallowed Ground, and found that I could not select such units and that mousing over them could cause the game to crash.

When looking for other units with those tags, I found that my Yvain is supposed to have
Code:
           <FeatureAttacks>
               <FeatureAttack>
                   <FeatureType>FEATURE_FOREST</FeatureType>
                   <iFeatureAttack>50</iFeatureAttack>
               </FeatureAttack>
               <FeatureAttack>
                   <FeatureType>FEATURE_FOREST_ANCIENT</FeatureType>
                   <iFeatureAttack>100</iFeatureAttack>
               </FeatureAttack>
           </FeatureAttacks>
           <FeatureDefenses>
               <FeatureDefense>
                   <FeatureType>FEATURE_FOREST</FeatureType>
                   <iFeatureDefense>50</iFeatureDefense>
               </FeatureDefense>
               <FeatureDefense>
                   <FeatureType>FEATURE_FOREST_ANCIENT</FeatureType>
                   <iFeatureDefense>100</iFeatureDefense>
               </FeatureDefense>
           </FeatureDefenses>
But it shows up in the pedia as +50% Tundra Strength and +100% Burning Sands strength.
 
I can confirm the above bug is also present in my installation of 2.71. There is one difference though and that's that instead of Burning Sands mine says Fields of Perdition.
 
Back
Top Bottom