[MOD] More Naval AI

Thanks for the new release, Tholal :)

Lately I have been having more time and I have been updating my changes to work with all the changes that were introduced in these 200 revisions. I hope to have some time soon to help with testing and some fixes again.
 
I'm unhappy to hear that the psychotic AI is part of the design as playing on immortal or deity is pretty much as playing with always war. There is no way to keep up with the AI early.
 
I have no idea how to use that, but perhaps I should learn. I think the code which reserves the (0,0) plot for the sluagh's is what causes the python errors in certain mapscripts, so eliminating the need for it would be a good thing.

I use these dummy units called Sluaghs (which is the canonical term for a disembodied spirit that has not yet left the place of Erebus to enter Arawn's netherworld or the service of another god) to store the xp, levels, promotions, religions, and unique names of various units when they die. There is a different version for the unitclass of every world unit (except The War Machine, The Black Wind, and the Armageddon heroes) plus one for adventurers and another one for each unitcombat of other units. I'd rather be able to keep track of exactly what type of unit it was that died, but I didn't want to create that many types of dummy units.

The Resurrection spells in my modmod will only work if they can find the proper type of Slaugh on plot (0,0) and if said Sluagh does not have either the Netherbind or Vindexbind promotion. Those promotions are respectively given to units that are killed by the units wielding the Nether Blade or Clava Vindex equipments. In addition to blocking Resurrection, they also stop units from returning as Angel or Manes. (The Clava Vindex only effects those who might otherwise return as Manes.) The Destroy Nether Blade ability removes the Netherbind promotion from all the Sluaghs, thus allowing them to resurrected again by the Life III spells. The Destroy Clava Vindex causes all the Sluaghs with Vindexbind to return and serve the Infernals.

Not every unit creates a Sluagh when it is lost. Those units who die in lands whose owner controls the Soul Forge create no Sluaghs and can never be resurrected. World units (except The War Machine, The Black Wind, and the Armageddon heroes) otherwise generate Sluaghs, as do units with the Adventurer promotion (unless they have the same name as a living adventurer, which would typically indicate that the unit was merely upgraded instead of killed). Other units would only generate Sluaghs if they have an extremely high levels, or if they were given the Netherbind/Vindexbind promotion. Adventurers and world units have their own Resurrection spells (limited by civilization, technology, and in the case of leader avatars also leader type), whereas more mundane units use the version that requires a Graveyard. A Sluagh with random xp is also generated whenever a Graveyard appears on the map. (It just crossed my mind that that may actually be source of the Erebus.py mapscript problem.)

If I understood correctly and you just want to store unit information, SDToolkit is probably the right thing. it's found in "SdToolKitCustom.py". Original Thread is here, advanced version here. It is used in the Revolution code, if you need examples.
 
I just discovered that the game crashes when an automated Lanun work boat tries to use Pirate Cove ability.

It does not happen when a human player directly orders the work boat to use this ability, or when a work boat belonging to another civilization (which cannot use the ability) is automated.

(I found this first in my modmod, but then confirmed that it also happens in base More Naval AI version 2.4 with the updated DLL.)


If I understood correctly and you just want to store unit information, SDToolkit is probably the right thing. it's found in "SdToolKitCustom.py". Original Thread is here, advanced version here. It is used in the Revolution code, if you need examples.

I've looked over this briefly, but frankly do not understand much of what I'm reading. I don't think there is much of a chance that I'll get my modmod working that way in time for my next release. Maybe I can manage it next year.


-----

Edit: I just gifted a Hidden Nationality unit to a rival right after using it to kill one of said rival's units. That seems rather odd.


Edit2: I just noticed that XML.log keeps saying "info type SPELL_WALL_OF_STONE not found, Current XML file is: xml\GameInfo/CIV4EspionageMissionInfo.xml"

I removed the Wall of Stone spell from my modmod recently,since the Ring of Warding is a better defensive building and a new spell I call Diligence is generally more useful and betters fits the philosophy of the Earth sphere.

When I used the Find in Files function of PyScripter, it could not find any reference to SPELL_WALL_OF_STONE in my modmod except for the TXT_KEYs in CIV4GameText_FFH2.xml. I couldn't really think of anything that uld be causing the problem.

When I tried searching for SPELL_WALL_OF_STONE using Find in Files in Notepad++, it found it in CIV4GameText_FFH2.xml and in CvGameCoreDLL.dll.


I really did not know that you could search in a compiled DLL. Most of the file is illegible characters in Notepadd++, but I can make out a few words. SPELL_WALL_OF_STONE is found rather close to SPELL_TEACH_SPELLCASTING,

It seems like there might be some hardcoded reference to the spell. I cannot say for sure, but it might be a problem. I recall at one point years ago there being some problem caused by my modmod not having a SPELL_TEACH_SPELLCASTING or UNIT_VAMPIRE, because Kael had hard coded such references into it in the DLL. I believe he solved this by moving the hardcoded references to instead be set in GlobalDefinesAlt.xml and ignored if nothing is set there. I would probably be best if you avoided such DLL hard coding the same way. (If the Wall of Stone reference helps the AI know to use the spell to defend cities, then I would probably want it to do so for Ring of Warding instead in my modmod.)

SorceForge wouldn't happen to have some sort of Find in Files ability I could use to search through the whole source code of your DLL, would it? I'm trying to see where the hard coding ight be, but have no idea in which files to look.

Edit: Ok, I found it in CvUnitAI.cpp

I see that Kael added the line if (GC.getDefineINT("SPELL_TEACH_SPELLCASTING") != -1) before if (canCast(GC.getDefineINT("SPELL_TEACH_SPELLCASTING"),false)) so that the code does not try to see if he spell can be cast or try to force it to be cast if the spell does not even exist. You don't seem to have included such checks for any of the many similar hard coded references to spells you added.


edit: Just in case the missing spell would cause a problem, I have decided to call SPELL_RING_OF_WARDING SPELL_WALL_OF_STONE for now. It isn't like one can see the actual spell type while playing the game anyway.
 
confirming what someone else said earlier; that when you have a unit selected and hover the cursor over a promotion icon the tool tip isn't coming up explaining which promotion it is... other than that working great!
 
it seems goblin forts no longer start with a goblin archer on them. intended?

edit: now that I think of it, I used regenerate map so that might be why.

edit2: it also causes unique features to not have their tags on the map.
 
I'm unhappy to hear that the psychotic AI is part of the design as playing on immortal or deity is pretty much as playing with always war. There is no way to keep up with the AI early.

I'm not sure what you mean. Are you saying the game is difficult on the highest difficulty levels?

I just discovered that the game crashes when an automated Lanun work boat tries to use Pirate Cove ability.

OK. Will be fixed in the next release.


Edit: I just gifted a Hidden Nationality unit to a rival right after using it to kill one of said rival's units. That seems rather odd.

Agreed. Will also be fixed.


Edit2: I just noticed that XML.log keeps saying "info type SPELL_WALL_OF_STONE not found, Current XML file is: xml\GameInfo/CIV4EspionageMissionInfo.xml"

...

It seems like there might be some hardcoded reference to the spell. I cannot say for sure, but it might be a problem.

I think all that spell hardcoding came about as part of the Wildmana merge I made early on. My goal is to remove all of those hardcoded functions and just have all units use the chooseSpell() function instead. I'll bump up the priority on that plan.
 
[to_xp]Gekko;12095267 said:
it seems goblin forts no longer start with a goblin archer on them. intended?

edit: now that I think of it, I used regenerate map so that might be why.

edit2: it also causes unique features to not have their tags on the map.

I think those are old FFH2 issues but I went ahead and added bug entry for them. Thanks!
 
While updating my components to version 2.4, I noticed that some of my changes in the Rev code are not included. I probably forgot to upload. They are attached now.

DynamicCivNames.py now supports alternative civ names, to prevent doubling of names. Note that it at the moment contains my old names, which you changed.

RevCivUtils.py has been updated due to bugs

Revolution.py just contains one little bugfix to prevent an occasional null-pointer exception.
 

Attachments

  • Rev updates.zip
    67.7 KB · Views: 44
[to_xp]Gekko;12095267 said:
it seems goblin forts no longer start with a goblin archer on them. intended?

edit: now that I think of it, I used regenerate map so that might be why.

edit2: it also causes unique features to not have their tags on the map.

Regenerate map has always been a bugged pile of crap.

Anyway, great work Tholal, et al!
 
OK. Will be fixed in the next release.


Agreed. Will also be fixed.


I think all that spell hardcoding came about as part of the Wildmana merge I made early on. My goal is to remove all of those hardcoded functions and just have all units use the chooseSpell() function instead. I'll bump up the priority on that plan.

Any ETA on these? I was planning to release the new version of my modmod tomorrow, and would prefer at least having the crash fixed. If the next update will be a while tough then I might go ahead and release anyway.

Edit: I just removed SPELL_PIRATE_COVE's <bSacrificeCaster>1 tag from and added pCaster.kill(True, pCaster.getOwner()) to the end of spellPirateCove(pCaster), and found it is no longer any problem. I could go ahead and release what I have now (which includes lfgr's Rev code updates ), but I think I'll wait until tomorrow to see if you go ahead and release another update first. There is no pressure if you don't want to yet though.

----
I've just been updating some of the Concepts entries for my modmod and I got to wondering whether some of the things Kael included are sill true in you modmod (or indeed in base FfH2). For instance, does the AC really still effect the Good vs Evil attitude?


Most of that came with BUG but I kind of like it that way. Keeps the text for the individual components more organized. The FFH2 file is for text specific to FFH2 while your text file is for your mod and the Puppet States text file is for the Puppet States components, etc etc.

It seems like the version of the FFH2 file in the latest version of this modmod actually is not specific to FfH2; I noticed a few TXT_KEYS (mostly your new game concepts) were missing from my modmod, and then found them in CIV4GameText_FFH2.xml.

I think it would be best for your modmod not to change CIV4GameText_FFH2.xml, but to include those changes in another file (whether new or combined with other MNAI stuff). I do not include CIV4GameText_FFH2.xml in my modmod, since it is such a massive file. Your installer could be smaller without it too.

I say in my modmod thread's that Magister Modmod will work whether you install it based on Base FfH2 or More Naval AI. While this is certainly true in single player games, I just started worrying that disparate versions of CIV4GameText_FFH2.xml might cause problems in multiplayer games if one player installed my modmod based on on basic FfH2 and the other based on this modmod.


The best way to ensure that would never happen would be to change your installer so that it copies all the FfH2 stuff into a new folder for your modmod instead of overwriting base FfH2. Personally I find the need to make a backup and rename things manually a bit annoying anyway. It is easy to make the installer do it all automatically.

I use Inno Setup Compiler like this:
Spoiler :

Code:
[Setup]
AppId={{71C68BFF-4F7F-4A95-927D-C32B6A4EDE07}
AppName=Magister Modmod for FfH2
AppVerName=Magister December 12 2012
DefaultDirName={reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Mods\Magister Modmod for FfH2\
OutputBaseFilename=Magister Modmod December 12 2012 Setup
Compression=lzma
SolidCompression=yes
DisableProgramGroupPage=yes
SetupIconFile=C:\Program Files (x86)\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\Magister Modmod for FfH2  December 12 2012 Changes\govannon.ico

[Types]
Name: "full"; Description: "Default installation"

[Components]
Name: "Magister"; Description: "Magister Modmod for FfH2 December 12 2012 Changes"; Types: full; Flags: fixed
Name: "FfH2"; Description: "Copy Fall from Heaven 2 Files"; Types: full; Flags: fixed

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags:

[Files]

Source: "{reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Mods\Fall from Heaven 2\*"; DestDir: "{app}"; Flags: external recursesubdirs createallsubdirs comparetimestamp; Components: FfH2
Source: "C:\Program Files (x86)\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\Magister Modmod for FfH2  December 12 2012 Changes\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Magister
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{userdesktop}\Magister Modmod for FfH2"; Filename: "{reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Civ4BeyondSword.exe"; Parameters: "mod=\Magister Modmod for FfH2"; Tasks: desktopicon; IconFilename: "{app}\govannon.ico"

[Run]
Filename: "{reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Civ4BeyondSword.exe"; Parameters: "mod=\Magister Modmod for FfH2"; Description: "{cm:LaunchProgram,Magister Modmod for FfH2}"; Flags: nowait postinstall skipifsilent

Keep in mind that if you want your modmod to be independent of the Fall from Heaven II folder then you must also edit the path found in Resource\Civ4.thm.
 
While updating my components to version 2.4, I noticed that some of my changes in the Rev code are not included. I probably forgot to upload. They are attached now.

DynamicCivNames.py now supports alternative civ names, to prevent doubling of names. Note that it at the moment contains my old names, which you changed.

RevCivUtils.py has been updated due to bugs

Revolution.py just contains one little bugfix to prevent an occasional null-pointer exception.

Thanks for the updates! I did receive some of the changes in DynamicCivNames before, but I had been making numerous adjustments to it myself at the time and wasn't able to easily reconcile the two versions. I took a quick look at the compared files and think I should be able to sort things out.


Any ETA on these? I was planning to release the new version of my modmod tomorrow, and would prefer at least having the crash fixed. If the next update will be a while tough then I might go ahead and release anyway.

Hope to have a new release with a few bugfixes and AI updates before the new year. Heading out of town tomorrow for a few days. Since the crash bug could be easily avoided (don't automate workboats) I didn't think it warranted an emergency release.

I've just been updating some of the Concepts entries for my modmod and I got to wondering whether some of the things Kael included are sill true in you modmod (or indeed in base FfH2). For instance, does the AC really still effect the Good vs Evil attitude?

Yes it does. Did a search and found this code.

Code:
iAttitude = GC.getDefineINT("ALIGNMENT_ATTITUDE_EVIL_TO_GOOD") - (GC.getGameINLINE().getGlobalCounter() / 10);

There's another line for the good to evil adjustment that's basically the same.

It seems like the version of the FFH2 file in the latest version of this modmod actually is not specific to FfH2; I noticed a few TXT_KEYS (mostly your new game concepts) were missing from my modmod, and then found them in CIV4GameText_FFH2.xml.

Certainly moving the Revolutions, Puppet States and Advanced Tactics text keys into their respective text files makes sense (and I'll do that for the next release), but there are still a number of bugfixes in the original CIV4GameText_FFH2.xml that I have implemented (typos, references to things and effects that no longer exist (such as the civic 'Public Healers' for example), links that were improperly formatted) so I will still be attaching that file as part of my install.
 
I didn't see anything about it in the features list, but I assume that you rolled the Pyre Zombie fix into this modmod?
 
Hey guys got a quick question!

I haven't played in a year or so, but for the holidays my friends and I are organizing a big multiplayer FFH game. Is More Naval AI still the most stable choice out there for large multiplayer games including AI as far as not getting out of syncs is concerned?

Last time I played, I remember this mod was very stable for multiplayer compared to others, so I'm just wondering if that's still the case.

Thanks a bunch!
 
Tholal, what I mean is that the game is loosing it's depth on the higher levels.

The AI has bonuses enough to be far ahead of you every game. That is fine. But since the tries to conquer you when they are far ahead all games play out the same. It does not even matter you you are meeting. They will all declare war on you. It reminds me of playing civ 5 on deity in the first release. It was a long long battle.

I'm able to win on immortal but there is no diplomacy. It is the same as playing always war.

I think a lot of the improvements to the AI are very nice and the game plays out well on monarch or emperor. But I miss being able to manipulate the AI or having reliable allies. If I want to rollplay anything then Enion Logos killing of the Bannor and the Malakim ruins that.

A problem with how it is now is that it removes any personality from the AI. They are all warmongering s on immortal+.

I would like to see wars much more seldom if you are pleased with someone. And perhaps only the Svartalfar will declare at Friendly and only if you are much weaker and low probability.

An other problem is that the AI will declare war on you because you are weak even when you are not sharing border. i.e. there is 7 squares of land between us that we could settle.
 
Tholal, what I mean is that the game is loosing it's depth on the higher levels.

The AI has bonuses enough to be far ahead of you every game. That is fine. But since the tries to conquer you when they are far ahead all games play out the same. It does not even matter you you are meeting. They will all declare war on you. It reminds me of playing civ 5 on deity in the first release. It was a long long battle.

I'm able to win on immortal but there is no diplomacy. It is the same as playing always war.

I think a lot of the improvements to the AI are very nice and the game plays out well on monarch or emperor. But I miss being able to manipulate the AI or having reliable allies. If I want to rollplay anything then Enion Logos killing of the Bannor and the Malakim ruins that.

A problem with how it is now is that it removes any personality from the AI. They are all warmongering s on immortal+.

I would like to see wars much more seldom if you are pleased with someone. And perhaps only the Svartalfar will declare at Friendly and only if you are much weaker and low probability.

An other problem is that the AI will declare war on you because you are weak even when you are not sharing border. i.e. there is 7 squares of land between us that we could settle.

I completely agree on that.
 
@Tholal: I disagree on the "doesn't need a quickfix" , anything that causes a CTD needs to be solved asap imo.

@Skobrin: what's the pyre zombie fix? I guess you mean capping the damage of their explosions so they can't kill? I agree with that but it might be outside the scope of the mod.

@Lorak: yup, works fine with multiplayer. the only reported issue is OOS when AI Kuriotates found/capture a city ( oh, and when Infernals capture a city )

@Folket: agreed, AIs DoW decisions are based too much on power rating atm.
 
Tholal: While trying to merge the avoid unhappy citizens button, I found out that the emphasize infos EMPHASIZE_AVOID_ANGRY_CITIZENS and EMPHASIZE_AVOID_UNHEALTHY_CITIZENS are already there and working. I suppose you included them when you merged parts of wildmana. Is there any reason why you don't want them in the city screen? I actually managed to get it working in just half an hour, just some changes in MainInterface.py (I just wanted to try out the interface, and was very surprised to see it was already working!)
 
great work lfgr ! :D

could you also bring back the power rating next to the scoreboard?

autocasting is also still in and just needs the autocast tags to be reactivated in civ4spellinfos.xml , that would be another great thing to fight micromanagement.

also another thing Tholal wanted to look into but didn't get time to is that parts of civ4lerts aren't working for some weird reason.
 
Top Bottom