[MOD] More Naval AI

(Be sure not to make DOMAIN_SEA units try to guard super forts on land though, as ships are destroyed in forts just as easily as inside a city.)

Speaking of super forts, it seems wrong to me that Hidden Nationality units can be used to claim forts from other players with whom you are not at war. Changing the owner of the tile gives away the unit's nationality just as much as conquering cities would. It would be better for super forts taken by HN units to be given the barbarian state, and probably better still for them simply to belong to no one until a non-HN units comes to claim the tile.

Agreed. I didn't think of Hidden Nationality units when I made the restrictions on who can claim forts. Can HN units capture cities? (I don't remember) If they can then I would like to keep things as they are now so that things are more consistent between cities and forts.

p.s. I would also very much like it if automated Work Boats could build Pirate Coves in order to claim valuable naval territory much as workers do with forts, instead of only building them near cities to boost the yields of workable plots. Of course, you probably would not want to do this unless Tholal decided that he wants to make Pirates Coves act like super forts in this modmod too. Before my changes, work boats were only allowed to use the Pirate Cove spell within their own territory. Having them venture out in order to claim territory and the not be able to do so could be a problem.

If Pirate Coves were built in the normal way instead of by a spell then this would be easier to do. There is a function in the DLL just for helping the AI use the pirate cove spell. As you said, unless Tholal also want pirate coves to act as Super Forts then it doesn't make sense for us to change that AI.
 
Agreed. I didn't think of Hidden Nationality units when I made the restrictions on who can claim forts. Can HN units capture cities? (I don't remember) If they can then I would like to keep things as they are now so that things are more consistent between cities and forts.
HN units aren't even allowed to enter rival cities (whether at war or not), so as to prevent them from capturing them. They can still attack and kill units in the city, but after killing the last defender they stay put rather than moving into the city's plot. I believe that Kael added this check during the first patch after the HN promotion was first added to the game, a very long time ago.



In MNAI v2.3, I noticed that I could use an obsidian gate to airlift my HN units into the cities of my vassals. That allowed me to capture them. It also kicked all of the defenders out of the city and did not require any combat.

I reported this exploit and thought that Tholal had fixed it for the MNAI v 2.4 release, but a quick test just revealed that it is not the case.



Speaking of HN, I noticed in a recent game as Jonas that I was able to use an HN unit to kill my own units when those units were in a barbarian city.

(Actually the city in question was originally my capital, but I placed a Hellfire improvement in it to see what would happen. In my modmod I made Hellfire able to claim territory like superforts, but also made doHellTerrain cause hellfire to revert to barbarian control each turn unless it is owned by the Infernals or a player with The Ashen Veil State Religion.)
 
In your modmod can Hell terrain spawn units? (and does it give 10-15% fire damage to those that enter/ try to attack the tile), and does it give a defensive bonus to the defender?

Personally I think Hellfire should spawn Balors :)


In regular FFH, the passive barbarian champions just aren't that interesting (that get 1-shot spawned with the pathetically weak Hell fires)
 
Hell terrain does not by itself spawn units. It doesn't passively deal damage (although the hell version of tundra and snow in my modmod are much more likely to generate Blizzards, which do cold damage). It does give a defensive bonus to demonic units.


In More Naval AI, like in Base FfH2, Hellfire still spawns Champions. These champions start with the barbarian's default race of Orc, and since the orc champion art was removed when Ogres were made to replace them they look like normal human units.



Hellfire in Magister modmod does spawn Balors instead. (Note that my Balors get most of their strength from affinity though; the Barbarian state does not have a capital, cannot own resources, and cannot benefit from affinity. The barbarian balors spawned from Hellfire are weaker than Balors from base FfH2. They can still get free spell sphere promotions from evil spheres though.) My Hellfires are also permanent, so merely defeating the spawn and entering he tile will not clear the lair. They can be removed by the Sanctify spell. They are also explorable lairs, and can be cleared the same way as Barrows. They change their plot counter to 100 when created, and again every turn.

I changed the Hellfire spell to be the Infernal world spell. (It did not seem right for other demon lords to use Hyborem's Whisper) It creates multiple hellfire plots across the world and gives the caster units on it.

When there is not a valid city for a demon lord to steal when he enters the world, he is spawned on a random tile with a Hellfire improvement on it.

Hellfire also has a chance of discovering the mana types of the evil gods.

I just now decided to make it so that entering a hellfire tile deals both Fire and Unholy damage to the unit, unless the unit is a demon or belongs to the owner of the hellfire plot. (In the same onMove call I go ahead and give the hellfire plot back the barbarians if it is owned by a non-AV, non-Infernal player. This would happen anyway when the next turn starts, but it seems less odd for it to happen immediately and doing to before dealing damage helps make sure whether damage should be dealt.)
 
Awesome! :evil:
 
I just decided to play the Lord of the Balors scenario game with the Advanced Tactics option (in my modmod). I made peace with Sallos, who several turns later asked me to make peace with "the Infernal" (there were of course seven Infernal players in the game and I wasn't really sure which one he meant). I agreed, and got peace with Hyborem without having to agree to his temptation event. (Hyborem is the one demon lord without a temptation event in the base game, but in my version I gave him one that requires the player convert to The Ashen Veil state religion).

I pointed out that Advanced Tactics can allow the player to get around the Permanent War/Peace setting and should be changed so as not to do so. For some reason I assumed that this issue was addressed in the v2.4 release, but clearly it was not.
 
although from magister's mod...

civ4screenshot0002f.jpg
 
I never even realized that the Infernals had temptation events.
 
although from magister's mod...

civ4screenshot0002f.jpg

Could you post PythonErr.log in my modmod thread so I can see the actual line where the problem is? It is possible that I made a mistake merging and the problem might not be Tholal's fault. (Or lfgr's fault for that matter, as I updated some of the revolution code based on what he posted after the v2.4 release.) I did not just copy the revolutions code exactly. My version references the new religions and terrain types of my modmod. Where MNAI only blocks a rebel civ from getting a religion if the leader has the agnostic trait, my modmod also block it if the leader's religion weight modifier to that religion is less than -90.
 
I'm working on a fix for issues 3593005 and 3597356. I plan to do this by adding a UniqueCiv to technologies. For example, seafaring would have:

Code:
<UniqueCiv>CIVILIZATION_LANUN</UniqueCiv>

When a new empire is initialized in the initNewEmpire function of CvPlayer, it will only assign a tech from the original empire to the new empire if the tech does not have a UniqueCiv or if the UniqueCiv of the technology is the same than the new empire's civilization type. What are your thoughts on this change with regard to revolutions and other similar features?
 
It seems to me like such a new tag would be unnecessary.

You can already set <DisableTechs> in a civilizations XML defines. I believe this was added in BtS, although Kael never used it. I chose to use it rather than using python to block research in CvGameUtils.py.

(I removed the Seafaring tech, preferring instead to add free food from the Lanun Palace and a civilization trait that adds a promotion to ships that boosts their movement, withdrawal, and cargo capacity. I use <DisableTechs> to stop the agnostic civs from researching the religion founding techs, the Calbim from researching Honor, the Mercurians from researching Necromancy, the Infernal from researching Righteousness, etc.)

pPlayer.canEverResearch(iTech)
(which is itself called within pPlayer.canResearch(iTech), False) ) would already take into account whether the civilization of the player in question is blocked from having that tech.


Edit:
I would recommend fixing issues 3593005 and 3597356 by adding the bold portion of this code to line 837 of RevUtils.py:
Code:
		for techID in range(0,gc.getNumTechInfos()) :
		[B]	if toPlayer.canEverResearch( techID):[/B]
				if( fromPlayerTeam.isHasTech( techID )) :
					knownTechs.append( techID )
					if( gc.getTechInfo( techID ).getResearchCost() > minMostExpensive ) :
						if( len(mostExpensive) < numMostExpensive ) :
							mostExpensive.append( techID )
						else :
							for j in range(0,len(mostExpensive)) :
								if( gc.getTechInfo( mostExpensive[j] ).getResearchCost() == minMostExpensive ) :
									mostExpensive.remove( mostExpensive[j] )
									break
							mostExpensive.append( techID )
							minMostExpensive = gc.getTechInfo( mostExpensive[0] ).getResearchCost()
							for j in range(0,len(mostExpensive)) :
								if( gc.getTechInfo( mostExpensive[j] ).getResearchCost() < minMostExpensive ) :
									minMostExpensive = gc.getTechInfo( mostExpensive[j] ).getResearchCost()

				if( doTakeAway and toPlayerTeam.isHasTech(techID) and toPlayerTeam.getNumMembers() == 1 ) :
					# take away all techs
					#if( LOG_DEBUG ) : CvUtil.pyPrint("  Revolt - Taking away %s"%(PyInfo.TechnologyInfo(techID).getDescription()))
					toPlayerTeam.setHasTech(techID,False,toPlayer.getID(),False,False)
and adding this to CIV4CivilizationInfos.xml for every civ but the Lanun
Code:
			<DisableTechs>
				<DisableTech>
					<TechType>TECH_SEAFARING</TechType>
					<bDisableTech>1</bDisableTech>
				</DisableTech>
			</DisableTechs>

Actually, if you don't want the pedia entry for those civs to show their inability to research this Lanun-only tech, you could probably just give the tech itself <bDisable>1</bDisable>. That tag would make canEverResearch return false regardless of the player. The Lanun would probably still get the tech though, as it is under <FreeTechs> for them. If not, then you should probably use python to give all new players techs that pass CvCivilizationInfo BOOL isCivilizationFreeTechs (INT i).





I believe that inserting this code into line 4982 of CvUnit.cpp (just before the return true; statement at the end of bool CvUnit::canAirliftAt(const CvPlot* pPlot, int iX, int iY) const) would be the way to stop HN units from airlifting into and capturing vassal cities (issue 3597358).

Code:
	if (pTargetCity->getTeam() != getTeam())
		{
		if (isHiddenNationality())
			{
			return false;
			}
		}






p.s. When I was looking for where the new civs are given techs I came across a reference to TECH_POLYTHEISM (which does not exist in this mod) in Buffy.py. It is under def canTriggerTheVedicAryans(argsList):, which I don't think needs to be included at all.
 
Is there any possibility that broader alignments would get added to this mod eventually?
 
@Tholal, MagisterCultuum

My Lord of the Balors scenario is still causing an auto-defeat even after installing 2.4. The error I'm getting is:

error in gamestart event handler <bound method autologevent.onGamestart of <autologeventmanager.autologevent object at 0x165F1DF0>>

It's auto-defeating as Keelyn, Varn Gosam and Basium.

On a side note, has anyone tried playing Mulcarn Reborn with MNAI? The Illians are attacking with their Priests of Winter on turn 15 and I don't know how to stop them. Do I just need to spam archers at the beginning?
 
Lord of the Balors works fine in Magister Modmod.

(Actually, there is a python error pertaining to redrawing the scoreboard or something like that, related to the way I cause a demon lord player to be defeated, and his units turned over to the barbarian state, once its avatar is killed. This doesn't seem to cause any actual problems with gameplay though.)

I just tried playing the MNAI Lord of the Balors scenario and got the same problem as in previous versions. I then looked at the file in Notepad++ and found that Tholal had not actually added Einion Logos to fill the empty player 3 slot as he claimed to have done.


I haven't tried Mulcarn Reborn recently.
 
Thanks Magister. Is there a way that I can manually add Einion Logos so that I can play the scenario?
 
I didn't see anything about it in the features list, but I assume that you rolled the Pyre Zombie fix into this modmod?

Yep.


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.

I have some reports that Kuriotates and Infernals can cause OOS issues.


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!)

I played a bit and experienced nothing odd. Only Issue is that Growth bar is showing "Growth" rather than "Stagnant (Growth Control)" when that button is activated

When I was merging in WildMana code I was mainly looking for AI stuff so I probably just skipped the interface files. I have your changes now and will take a look at them soon. Thanks!


Speaking of super forts, it seems wrong to me that Hidden Nationality units can be used to claim forts from other players with whom you are not at war.

Agreed. Will enter a bug report for this.

I have a few goodies that should be ready for inclusion in that new version if you want to use them :)

Spanish translation: It includes a spanish translation for all strings except for those which are only "fluff" text. It includes a new text file, which fixes translation errors of the spanish translation of vanilla BtS. the only changes to existing strings are removing trailing whitespaces from the end of the string.

Excellent! Thanks!

Kuriotate settlements: This ModComp prevents Kuriotates from always creating cities without being given the chance to decide between cities and settlements in multiplayer. The first Kuriotate settlement will still be upgraded automatically to a city. The rest of the new settlements will not be upgraded automatically; they can be upgraded later (if the player chooses to do so) by activating the Promote Settlement ability in the settlement.This ModComp should not modify this behavior in single player games.

I seem to remember a time when building a new city as the Kuriotates would bring up a popup window asking if you wanted a Settlement or a real city. Am I imagining that or was it in a modmod?


I also noticed that the area available for putting the mouse over a promotion of the currently selected unit and showing the promotion's tooltip is quite small, just a small line at the right of each promotion. Can anyone else confirm this issue?

Known Issue.


In MNAI v2.3, I noticed that I could use an obsidian gate to airlift my HN units into the cities of my vassals. That allowed me to capture them. It also kicked all of the defenders out of the city and did not require any combat.

I reported this exploit and thought that Tholal had fixed it for the MNAI v 2.4 release, but a quick test just revealed that it is not the case.

Bug #359735


Speaking of HN, I noticed in a recent game as Jonas that I was able to use an HN unit to kill my own units when those units were in a barbarian city.

Ha! That's kind of funny. Added to the bug list!


In More Naval AI, like in Base FfH2, Hellfire still spawns Champions. These champions start with the barbarian's default race of Orc, and since the orc champion art was removed when Ogres were made to replace them they look like normal human units.

Added to the bug list!

I pointed out that Advanced Tactics can allow the player to get around the Permanent War/Peace setting and should be changed so as not to do so. For some reason I assumed that this issue was addressed in the v2.4 release, but clearly it was not.

Bug #3592835


I'm working on a fix for issues 3593005 and 3597356. I plan to do this by adding a UniqueCiv to technologies.

It seems to me like such a new tag would be unnecessary.

I think that using the canEverResearch() call would be the easiest solution. (and I closed bug 3597356 since it was a duplicate entry)


I believe that inserting this code into line 4982 of CvUnit.cpp (just before the return true; statement at the end of bool CvUnit::canAirliftAt(const CvPlot* pPlot, int iX, int iY) const) would be the way to stop HN units from airlifting into and capturing vassal cities (issue 3597358).

That looks like it should work. Seems like this issue arose because of some code earlier in the function I had previously commented out. I'll try and sort things out on this issue for the 2.41 release.

p.s. When I was looking for where the new civs are given techs I came across a reference to TECH_POLYTHEISM (which does not exist in this mod) in Buffy.py. It is under def canTriggerTheVedicAryans(argsList):, which I don't think needs to be included at all.

Good catch. I'll remove that section.

Is there any possibility that broader alignments would get added to this mod eventually?

Probably not.


My Lord of the Balors scenario is still causing an auto-defeat even after installing 2.4.

I just tried playing the MNAI Lord of the Balors scenario and got the same problem as in previous versions. I then looked at the file in Notepad++ and found that Tholal had not actually added Einion Logos to fill the empty player 3 slot as he claimed to have done.

Whoops! Forgot to include the scenario files with the 2.4 release. They'll be included with the 2.41 release.
 
about the mousovering over promotions issue, what about this possible fix by MC? http://forums.civfanatics.com/showpost.php?p=12092114&postcount=1610


btw, did you import the WM fix that makes treants summoned via Ljosalfar worldspell start fortified? you go crazy with a large empire otherwise :D

also if you want to address exploits, you could look into Orthus axe, making it 1. not equippable by animals and beasts and 2. solving the "keep attacking with suicidal warriors with the axe so each can use it"
 
Edit:
I would recommend fixing issues 3593005 and 3597356 by adding the bold portion of this code to line 837 of RevUtils.py:

I think that using the canEverResearch() call would be the easiest solution. (and I closed bug 3597356 since it was a duplicate entry)

Thanks to both of you for the pointers. I will take both posts into account when I try to resolve 3593005 :)

I seem to remember a time when building a new city as the Kuriotates would bring up a popup window asking if you wanted a Settlement or a real city. Am I imagining that or was it in a modmod?

That's the default behavior in single player. Sadly, the popup causes an OOS. If I remember correctly, I ran into problems when I checked the popup code because it was not readily available for edition in the python code. Since I always send at least one defensive unit with a settler, I did not find the omission of the popup as a huge problem (the defensive unit can cast improve settlement after creating a settlement if you want).

Also, thank you for including the spanish translation! It seems that I forgot to include one file in the spanish translation zip. It is an extra text file that includes fixes to some vanilla BtS strings which are either broken or mistranslated in the default spanish game or that become broken with regard to FFH2 or MNAI new features. I'm attaching the file to this post :)
 

Attachments

I'm sorry about the double post :)

I solved #3593005 by modifying the following line in the "PlayerTypes CvPlayer::initNewEmpire(LeaderHeadTypes eNewLeader, CivilizationTypes eNewCiv)" method in CvPlayer.cpp:

Code:
diff -r 1fc16dd17801 Assets/CvGameCoreDLL/CvPlayer.cpp
--- a/Assets/CvGameCoreDLL/CvPlayer.cpp	Thu Dec 27 21:08:04 2012 +0100
+++ b/Assets/CvGameCoreDLL/CvPlayer.cpp	Sun Dec 30 14:54:20 2012 +0100
@@ -23879,7 +23879,7 @@
 		CvTeam& kNewTeam = GET_TEAM(GET_PLAYER(eNewPlayer).getTeam());
 		for (int i = 0; i < GC.getNumTechInfos(); ++i)
 		{
-			if (GET_TEAM(getTeam()).isHasTech((TechTypes)i))
+			if (GET_TEAM(getTeam()).isHasTech((TechTypes)i) && GET_PLAYER(eNewPlayer).canEverResearch((TechTypes)i))
 			{
 				kNewTeam.setHasTech((TechTypes)i, true, eNewPlayer, false, false);
 				if (GET_TEAM(getTeam()).isNoTradeTech((TechTypes)i) || GC.getGameINLINE().isOption(GAMEOPTION_NO_TECH_BROKERING))

This solution introduces a problem of its own, though. Since Hyborem has no official religion when he is "created", canEverResearch returns false for Infernal Pact and because of this infernals do not get this technology with this fix.

I did not alter the python code for giveTechs because the revolutions code is not related to the #3593005 bug. Since I don't know much about revolutions I prefer to not touch it.

BTW, when are you getting a subforum? This thread is becoming cluttered with many parallel conversations happening at the same time, and there are a few modmods and even modcomps based on MNAI that could be moved to that subforum too :)
 
RE: Magister and Text Files

While moving some option-specific text into the appropriate files, I did discover a few text files from the RevDCM merge that aren't needed. I'll be removing them with the next release and also keeping an eye out for other text files that can be removed or merged.

[to_xp]Gekko;12106897 said:
about the mousovering over promotions issue, what about this possible fix by MC? http://forums.civfanatics.com/showpost.php?p=12092114&postcount=1610

Yes, that does work. But I commented that section out a while ago at the suggestion of Valkrionn (I cant find the original post at the moment) due to excessive lag that was being caused by the game constantly checking to see if it needed to push the promotion buttons to the front. I re-enabled that code when I merged in BUG, which moved the unit graphic back to its original spot, but after playing for a while, I realized that the game lag was very noticeable when selecting a large stack of units. Need to figure out some sort of solution. Perhaps I can make it so that the unit graphic is pushed to the back instead...

btw, did you import the WM fix that makes treants summoned via Ljosalfar worldspell start fortified? you go crazy with a large empire otherwise :D

Yes.


That's the default behavior in single player. Sadly, the popup causes an OOS. If I remember correctly, I ran into problems when I checked the popup code because it was not readily available for edition in the python code. Since I always send at least one defensive unit with a settler, I did not find the omission of the popup as a huge problem (the defensive unit can cast improve settlement after creating a settlement if you want).

OK. I'll check out your code.

It seems that I forgot to include one file in the spanish translation zip.

Got it! Thanks!

This solution introduces a problem of its own, though. Since Hyborem has no official religion when he is "created", canEverResearch returns false for Infernal Pact and because of this infernals do not get this technology with this fix.

Well that's a pain! Maybe we can fudge it by giving the Infernals Infernal Pact in python after the new civ is initialized?

Edit: Rebel civs getting inappropriate techs is also part of this bug IMO. I didnt realize that they had a whole function in python for giving techs to new civs. We should also fix it there, or (if possible), change Revolutions so that it also uses the initNewEmpire() call to the DLL (though I suspect that there's a lot of stuff going on in the Revolutions code that isnt part of the initNewEmpire() function)

BTW, when are you getting a subforum?

OK. I'll put in a request now and see what the mods say.


RE: 'Psychotic AI' at high difficulty levels.

Send me a save game (ver 2.4) from right before a civ declares war on you which you think is inappropriate for the AI in that situation and I'll look at it.
 
Back
Top Bottom