MNAI-U: unofficial build & bugfixes

lfgr

Emperor
Joined
Feb 6, 2010
Messages
1,095
Download setup (not recommended if you have a GOG installation)
Download archive
Code repository
Older versions of MNAI-U

See the download pages for installation instructions. If you have an earlier version of MNAI installed in the "Mods/Fall from Heaven 2" folder, I recommend removing it and re-installing Fall from Heaven 0.41 with patch "o".

What is this about?
This is a continuation of Tholal's More Naval AI mod. It doesn't intend to add major new features, instead I mostly do bugfixing and polishing of the features already present.

Goals
Plainly: Fix any remaining bugs in MNAI. This includes bugs that exist in MNAI only surface in MNAI modmods such as MagisterModmod. If there are other serious flaws (for example related to performance) that are easy to fix, I will consider them too. I will not accept feature requests for the time being, and will not touch balance.
I will, however, consider requests that aim to make MNAI a better modding platform, such as adding new tags, although they should be simple to implement and not likely to introduce new bugs or performance problems.

If you find a bug, just report it here! :)
If you want to help me (and increase the chances that I actually fix your bug), include a detailed description of the bug, how to reproduce it and ideally a savegame from directly before the bug happens.

Terkhen wrote an excellent Testing Guide for Extramodmod that also applies to MNAI. To produce assertions, you'll have to replace your CvGameCoreDLL.dll with CvGameCoreDLL_assert.dll, which is also included in the download (backup the former and rename the latter file). Please note that the CvGameCoreDLL_debug.dll included in MNAI 2.7 is not being updated by me.
Moreover, please consider setting
Code:
AutoSaveInterval = 1
in your CivilizationIV.ini file (see Terkhen's Guide on how to find it). This makes an autosave every turn. The impact on turn times should be negligible, and you will be able to provide saves directly before bugs happen, making it much easier for me to fix them.

Known Issues
The installer will not work it you have Steam installed, but Civilization 4 is installed from some other source (e.g., GOG, retail). Please use the archive in that case.

Acknowledgements
 
Last edited:
CHANGELOG

Changelog of mnai-2.8.1u and later versions is included in the download and can be viewed on notabug.org.

Spoiler mnai-2.8.0u :

Should be compatible with 2.8-beta2u saves.

Bugfixes:
  • Worldbuilder loading/saving works again
  • Signs use proper encoding in wordbuilder saves (fixes python exception when playing in spanish)
  • "Gift of Kylorin" Scenario doesn't show popups when enemy units try to open chests anymore
  • Fixed item duplication bug occuring near Acheron's city
  • canCast() now considers PromotionImmunes of targets
  • Captured units now retain their original name
  • Pre-Chop now only acts if the feature is not maintained by civilization, e.g. forests for elves (report by MagisterCultuum)
  • Transport units unload their cargo when they sacrifice themself for a trade mission, a golden age, research, a great work or hurrying production
  • Misc. text fixes

AI:
  • Choke/canal points are no longer overvalued as city founding sites; added defines for manual adjustment (report by Lamabreeder)
  • Barbarians no longer build forts

Features, UI:
  • Minor tweaks to Revolution code and RevolutionWatchAdvisor
  • Derandomized and tweaked revolution crime effects
  • World Builder now allows changing IgnoreHide and Blockading status (MagisterCultuum)

Code:
  • Release DLL is now compiled with whole program optimization (devolution)
  • Current infotype and tag is now displayed in XML-related asserts
  • Replaced "PromotionImmune1/2/3" tags by an XML list "PromotionImmunes" (old tags are still functional for compatability)
  • Added CvUnit::isPromotionImmune(PromotionTypes) and exposed it to python
  • Default iAdvancedStartCost for units is now 100 (as suggested by MagisterCultuum)
  • CIV4UnitInfos.xml now uses spaces instead of tabs (as suggested by MagisterCultuum)
  • pyAssert now actually throws AssertionError when condition is false
  • CvUnit::isBlockading() is now exposed
  • Added custom profiler for more reliable profiling (requires recompilation of DLL)
  • Removed unused event callbacks in CvRandomEventInterface.py (as suggested by MagisterCultuum)
  • Removed some non-existing python function calls, fixed a scenario callback in CIV4EventInfos.xml
  • Misc. documentation and cleanup
Spoiler mnai-2.8-beta2u :

Should be compatible with 2.8-beta1u saves.

Bugfixes
  • Fixed typo that caused CvCity::getNumBonuses to behave erratically.
  • Barbarians no longer attack simultaneously. This also fixes a problem where some barbarian units don't move at all because they try to attack while there is already fighting on their plot. (reported by Devils_Advocate, omegaflames)
  • Fixed typo inherited from bts that screwed up help messages for units with <FeatureImpassable> (applies to MagisterModMod)
  • Fixed spanish Stasis text

UI
  • New BUG option to hide ownership of water tiles in the minimap

Code
  • Removed all default values in CIV4UnitInfos.xml
Spoiler mnai-2.8-beta1u :

Not compatible with 2.7 saves.

Bugfixes
  • Fixed some recurring events not having effects when triggering again. This includes the reported Mushroom and Volcano events.
  • Newly joined civs (such as Infernals) no longer get effects by already triggered global events.
  • The "Declare War" trade deal that makes your trade partner X declare war on Y, is no longer available if X is already at war with Y.
  • The Hidden Attitude mod from BUG works now, can be enabled and disabled in the BUG options (Ctrl-Alt-O).
  • The Pre-Chop mod from BUG (workers pause 1 turn before chopping done a forest) works now, can be enabled/disabled in the BUG options, too.
  • Various parts of the code are no longer confused by FfHs pseudo-eras that change the Improvement art based on religion.

UI
  • Added two missing [ICON_BULLET] in french texts (omegaflames).
  • RevCDM no longer has a second, unnecessary "Hidden Attitude" option.
  • Removed "Events with images" BUG option.
  • Removed duplicate spaces and invalid characters (that showed as spaces in-game) in text files, additional text fixes (MagisterCultuum)
  • Removed an old BtS hint about fighter jets.

Code
  • Removed duplicate text keys, fixed some technical problems in text files (omegaflames, lfgr)
  • ForceCivic and NoBonus resolutions now apply to all players part of the respective council instead of being tied to the Overcouncil. This has no effect in MNAI.

Other changes
  • The World Builder now allows triggering votes (MagisterCultuum)
Spoiler mnai-2.7.2u :

Should be savegame compatible with 2.7 saves.

Bugfixes
  • Griffon Illusions are no longer displayed as red blobs (reported by Spaceman98)
  • Dragon slaying no longer shows up in sevopedia promotion tree (reported by Antuano le Reddit on bitbucket)
  • Sailor's Dirge cannot spawn on ice anymore (reported by omegaflames, spaceman98)
  • Player score now counts land correctly, there were minor problems when specific plots had their PlotType changed.

Code
  • Erebus Mapscript no longer causes assertion errors
  • Exposed CvGame::castVote(), CvGame::addVoteTriggered(). For details see CyGame.h and CyGameInterface.cpp in the code repository.
  • Fixed a few XML/Schema problems

Other changes
  • The fact that the organized trait allows building command posts without great generals is now shown (thanks Bickendan, Devils_Advocate)
Spoiler mnai-2.71-ubf-1.1 :

Should be savegame compatible with 2.7 saves.

Non-AI Bugfixes:
  • Removed some duplicate Art and Audio entries. Fixes Great Lighthouse video, and makes Balseraph catapults moo again.
  • Empty boolean, int or float elements now revert to default value and show a moderately useful assertion error.
  • Prevent some invalid assertion erros
  • Other minor code fixes and cleanup with no direct gemeplay impact

AI:
  • AI somehow thought Adepts in cities with a river could cast spring. This also lead to AI loops, possibly slowing down turns.
  • Terraformers don't try (and fail) to move to unreachable city. Again lead to AI loops.
  • Presumed embassy value no longer includes presumed open borders value - AI doesn't basically consider embassies and open borders the same anymore.
  • AI is now less paranoid about players winning religious victories, and will trade open borders more willingly.
  • The two above changes should fix at least one instance of the deal-autocancelling behavior.
Spoiler mnai-2.71-ubf1 :

Should be savegame compatible with 2.7 saves. Contains unpublished changes from the repository and 2 additional fixes.

Bugfixes:
  • Unhealthiness in city and global unhealthiness was swapped in Event description (lfgr)
  • Religious Influence overlay no longer shows Council of Esus cities to civilizations that don't follow the religion. (Terkhen)
  • When Hyborem or Basium are resurrected, the civilization will get its leader traits back. (Terkhen)
  • Mimics can no longer gain promotions from naval or mech units (Tholal)
  • fix for potential crash if you select a worker when you have no cities (fallout from change to prevent chopping production from being sent to settlements)
  • Other minor fixes (Tholal, Terkhen)
  • Snowgenesis no longer removes hell terrain twice (lfgr, found by omegaflames)
  • Negative Spell iResistModify no longer causes division by zero CTD (lfgr, reported by FireBlaze, applies to MagisterModMod)

AI:
  • Minor adjustment to how the AI values techs for their favorite UnitCombats (Tholal)

Other Changes:
  • Scorpion Clan goblins are now upgraded to Scorpion Clan wolf riders. (Terkhen)
 
Last edited:
it's nice to see it resurrected. Still playing in a multiplayer session. There are recent posts by others and me that report some bugs. Additionally for some reason the tower of mastery provides 3 health instead of 2 for some reason. Experienced this with a teammate in a permanent alliance. Also barracks don't show their additional bonus when building units.
 
Additionally for some reason the tower of mastery provides 3 health instead of 2 for some reason. Experienced this with a teammate in a permanent alliance. Also barracks don't show their additional bonus when building units.
Can you be a bit more specific? What happens vs. what did you expect to happen, why do you expect it that way?
 
Diplomacy: Treaties autocancel after 10(?) turns. (May only be in the Advanced Diplomacy option)
 
Right of Passage seems to be the only one that doesn't autocancel. Embassies, open borders, non-aggression pacts, defensive pacts, vassalage, and resource/money trades all autocancel.
Let me know if you still want a save, as I'll have to set it up in one of my current games.
 
Having played a bit on the latest official release I'd say I'm seeing things get cancelled a lot more than they did on the build I was on previously (not sure which as I haven't updated in several months until recently) I've gotten to the point where I just leave it at right of passage and don't ever do an open borders unless I really need to so that I don't lose that sweet sweet foreign trade route money. I've been suspicious that it's something in the dll so I haven't done much digging into it since I've been avoiding learning how to do dll stuff but if you still can't reproduce with open borders specifically then let me know and I'll provide some save games as well and do more hunting on my own with it as well. I'm not sure it's an exact number of turns thing as I've not counted and I always play on marathon game speed and I've just never kept track of it.

I'd also like to say if you are looking for bugs then any thread created after Aug 6 2017 is fair game in these forums because there have been a handle full of threads created since 2.71 release with a few bug reports in them.
 
Last edited:
Right of Passage seems to be the only one that doesn't autocancel. Embassies, open borders, non-aggression pacts, defensive pacts, vassalage, and resource/money trades all autocancel.
Let me know if you still want a save, as I'll have to set it up in one of my current games.
Okay, I'll check this when I have a bit more time.
It is most probably a DLL issue, but I never looked into that code so it might take some time to fix.
 
Last edited:
New release: mnai-2.71-ubf-1.1. Should be compatible with 2.7 savegames.

The most important fixes of this release are:
  • Bugs in the terraformer AI code made terraformer units do nothing. This led to an AI loop. As the game breaks the loop after 100 iterations, this didn't lead to a freeze, but might have slowed down the game.
  • Fixed at least one instance of AI deal "auto"-cancelling. The problem was that the AI was very wary of trading (or maintaining) open borders if their trade partner was even slightly on their way to a religious victory. Now they have this behavior only if the other player is actually close to a religious victory. Furthermore, the AI valued embassies basically the same as open borders, which led to them cancelling embassies, too.

For a full changelog, see the second post of this thread.

To help track down possible other causes for AI deal cancelling, please enable autosaves every turn, as explained in the first post of this thread.
 
Last edited:
I merged mnai-2.71-ubf-1.1 with MagisterModmod this afternoon. I copied both of the DLLs included into my modmod folder, without renaming either trying to get assertions, and have been getting these assertions anyway:
Spoiler :

Code:
Assert Failed

File:  CvXMLLoadUtilityGet.cpp
Line:  761
Expression:  false
Message:  Error in GetChildXmlVal function, unable to find a child node

----------------------------------------------------------

Assert Failed

File:  CvInfos.cpp
Line:  6277
Expression:  i < GC.getNumTerrainInfos()
Message:  Index out of bounds


----------------------------------------------------------
Assert Failed

File:  CvArtFileMgr.cpp
Line:  182
Expression:  false
Message:  get##name##ArtInfo:  was not found

----------------------------------------------------------
Assert Failed

File:  CvSelectionGroupAI.cpp
Line:  228
Expression:  false
Message:

----------------------------------------------------------
Assert Failed

File:  CvGameCoreUtils.cpp
Line:  2760
Expression:  iLevel > 0
Message:  iLevel must be greater than zero

----------------------------------------------------------
Assert Failed

File:  CvCity.cpp
Line:  7751
Expression:  getBonusGoodHealth() >= 0
Message:

----------------------------------------------------------

Assert Failed

File:  CvCity.cpp
Line:  7753
Expression:  getBonusGoodHealth() >= 0
Message:  getBonusGoodHealth is expected to be >= 0

----------------------------------------------------------


Assert Failed

File:  d:\dev\civ\repos\mnai_unofficial\cvgamecoredll\CvPlayerAI.h
Line:  25
Expression:  ePlayer != NO_PLAYER
Message:  Player is not assigned a valid value

----------------------------------------------------------


Assert Failed

File:  CvCity.cpp
Line:  8326
Expression:  getBonusGoodHappiness() >= 0
Message:

----------------------------------------------------------



Assert Failed

File:  CvInfos.cpp
Line:  2669
Expression:  i > -1
Message:  Index out of bounds

----------------------------------------------------------



Assert Failed

File:  CvPlot.cpp
Line:  8626
Expression:  getStolenVisibilityCount(eTeam) >= 0
Message:

----------------------------------------------------------


Assert Failed

File:  CvCity.cpp
Line:  8338
Expression:  getBonusBadHappiness() <= 0
Message:

----------------------------------------------------------
Assert Failed

File:  CvTeamAI.cpp
Line:  3726
Expression:  !isAtWar(eWarTeam)
Message:  should be at peace with eWarTeam

----------------------------------------------------------

In your previous release CvGameCoreDLL_assert.dll was larger than CvGameCoreDLL.dll, but now CvGameCoreDLL.dll is the larger of the two. Did you maybe get the names mixed up between them?
Edit:I seem to be getting the same asserts regardless of which of those DLLs I use.
 
Last edited:
Very good news.

FFH2, MNAI and Extra Mod Mod are the best and smartess Civ IV mod ever done !


You only focus on bugfixes, or you can work on balancing the mod too ?
 
Edit:I seem to be getting the same asserts regardless of which of those DLLs I use.

Sorry, I packaged the debug DLL in place of the release DLL. Please redownload. You should only get asserts with CvGameCoreDLL_assert.dll.

You only focus on bugfixes, or you can work on balancing the mod too ?
I will not work on balance.
 
Units appear to be able to release themselves from prisons (I freed a Beast of Agares and a Lizardman Beastman this way).

Tooltip for Command Post (Great Commanders) lists Organized as a requisite. I built it anyway as Hannah the Irin.
 
It lists that because you need the Organized trait to build a Command Post using 180 :hammers: instead of sacrificing a Great Commander to create one.

The description of the Organized trait should probably include "Can build Command Post without using Great Commander". Not having to spend a Great Person on a building is a bit more notable than double production speed, I think.
 
Tooltip for Command Post (Great Commanders) lists Organized as a requisite. I built it anyway as Hannah the Irin.

It lists that because you need the Organized trait to build a Command Post using 180 :hammers: instead of sacrificing a Great Commander to create one.

The description of the Organized trait should probably include "Can build Command Post without using Great Commander". Not having to spend a Great Person on a building is a bit more notable than double production speed, I think.

Thanks for the report and suggestion, I'm going with "Allows building Command Posts without using a Great Commander".
 
Had a Flurry get himself trapped and free himself from said cage.

Does Bloom work on floodplain tiles? I play on a mapscript that generates them on any tile (so, floodplain grasslands away from rivers), but Bloom doesn't seem to be allowed on those tiles. If working as intended, great. If not, well, the Elves aren't thrilled...
 
Both forests and floodplains are features and you can usually only have 1 feature at a time on a plot. Improvements work the same way in that there can usually only be 1 at a time on a plot. If you want to get rid of the floodplain and replace it with a forest then you could try some of the terraforming spells to try and get rid of it but not sure that would actually work since the python code for scorch does not specifically remove floodplains (you would have to hope the game recognizes that plains does not normally have floodplains) and the python requirements for spring won't let it be cast on a floodplains unless there are flames or smoke nearby.
 
Last edited:
Top Bottom