[MOD] More Naval AI

Congratulations Tholal.

Just noticed a couple of things in my latest game. The Bannor have just appeared in the game adn they have kept their good alignment despite following the Veil. I'm pretty sure that they just emerged through a revolution so it might be to do with that.
I also watched an AI (Hippus) escort a Galleon and galley with a privateer, where the privateer had the hidden nationality promotion.
I do like how in the last few versions of the mod the Barbarians have been using galleons and galleys to land troops. Keeps you on your toes!
 
AI -lanun - did not use "tsunami" neither attacking nor defending although conditions were met.Had AI used tsunami correctly, no chance for me.
They had Cultists? (And Octopus Overlords to build them?)

AI - IMO still overuses mages/adepts. Melee line is used rarely. even ljofo AI rarely uses archers....prefers mages, etc.
I've noticed this as well -- the AI loves adepts. And chariots... which does play into my counterattack strategy...
 
I did have some issues related to trading mechanized units though. I'd strongly prefer it if you added a new tag to control what units can be traded rather than using bMechanized.

What mechanized units do you have that you dont want to be tradeable? I'm probably not going to add a new XML tag just for this, but I might try and set up a CannotTradeUnit python callback that will give you more control. Though I haven't done anything like that before, so it may not be in the next release.

It would also be great if you could make a new promotion tag that blocks the ability to cast spells and remove that aspect from the bHeld tag.

Looks like the code is causing Held units to also be flagged as Immobile for 999 turns. I'll see what I can do to make that work better.

I also wish that units had a tag to determine whether they took the default racial promotion, rather than basing this on whether they are living, mechanized, or world units.

Not a priority for me. You can always add some code to onUnitBuilt function in python that strips out the racial promos.

I have seen Standing Stones appear on peaks in two different games.

That's a new one. I'll take a look at it.

In a recent game, we had Gargoyles entering our culture.

In 2.1 I still had the problem where gargoyles spawned by that unique mountain annihilated AI first city. Gargoyles possibly spawned within city border.

Arg! Damn Gargoyles. I'll look into this again.

If the AI uses the same rules as the governors then there could be problems here.

I'm pretty sure that the AI does not use the Governor code. I haven't done anything to the Governor code myself. I'll add it to the list.


I'm also at the point where I'll end the turn, the AI's slowly cycle through, just as everything finishes and the game prepares to begin my turn (recenter the map), CTD

Any chance you can send me this savegame?


Is there anything in the code that tells the AI to upgrade their defending units?

There is, but defending units rarely leave the city they are in, so if that city doesn't have the proper training buildings, the chance of them upgrading is rather slim.

If an opposing army is threatening your towns, some number of troops should be breaking off to form defensive stacks. Instead, they will often divert their entire army, ignoring my weakly defended towns and being picked off by cultists/stygian guards hanging out off the coast.

In my recent game I was able to defeat a drastically numerically superior opponent using similar tactics. I picked off cities behind the stack of doom, causing it to march back and forth, getting near my cities before turning back to re-take its own. I was able to wear the SoD down over the course of 15 turns or so (Nox Noctis was helpful, of course) and crushed him once the SoD was gone. If he had split the stack into three and defended with one while the other two razed my cities, he could have destroyed me.

I can try futzing around with the code a bit, but this sort of Unit AI is difficult to code.


But allowing items to be dropped would be a nicer workaround.

There are some exploitation issues with being able to drop items at will, but the main hindrance is that it would require a new spell for every single item in the game (manipulating items is a 'spell'), which is a major pain in the ass.

I've noticed lately in my modmod that priests no longer seem capable of upgrading to anything

My bad. Will be fixed in the next release.

Speaking of upgrades, could you make it so that upgrading a unit that is the avatar of a leader does not leave the player without traits, but instead causes the upgraded unit to be the new avatar? While you are at it, could you do the same for avatars that are converted to other units through xml spells or the python pNewUnit.convert(pOldUnit) call?

Seems like that should be possible. I'll look into it.

Is there some way to prevent the def onUnitLost(self, argsList): call from being activated when a unit is actually being upgraded rather than destroyed?

Its definitely possible. I'll have to make sure that it doesn't result in any other issues.

(Also, in what order are unit upgrades handled? Is the new unit given the info of the old, including its custom name, before or after the old unit is lost?

Before.

Do we really want all buildings and units to be displayed in the Sevopedia?

Yes, otherwise there are a large number of buildings and units that a player would not be able to get any information about. Though it does result in some strange entries, I would prefer to have the information available to players so they can find answers in-game rather than trying to dig through outdated manuals or comb through forums.

What is the point of having the bGraphicalOnly tag if it is ignored?

You are free to change it in your mod. It's handled in python.

SevoPediaMain.py - look for and not getInfo(iItemID).isGraphicalOnly()) . That's the line that I changed.

In my last real game I ran into this error:
Code:
Traceback (most recent call last):
  File "BugEventManager", line 361, in _handleDefaultEvent
  File "Revolution", line 635, in onEndPlayerTurn
  File "Revolution", line 1075, in updatePlayerRevolution
  File "Revolution", line 2118, in checkForBribes
  File "RevUtils", line 1007, in computeBribeCosts
ZeroDivisionError: integer division or modulo by zero

OK. The revolutions code has lots of confusing formulas in it. Looks like you've hit one that wasn't properly coded. I'll have to try and figure out what that section of code is trying to do.

I also found it quite annoying to repeatedly get revolution events where a city I had conquered from the Calabim asks to be given back to Alexis and says that Alexis may declare war on me if I refuse, when I was already at war with Alexis the entire time.

OK. I'll look into this as well.

I don't think that it should be possible to get a revolution a city asked to be made independent under a new leader while it is your only city.

Was it the event where you cede power for 10 turns? If so, having only a single city shouldnt necessarily prevent it from happening.

I also tend to think that puppet states should not be so willing to liberate their only cities, as doing so is suicide and makes the event where they ask to give up independence pretty pointless.

Not entirely sure what you're referring to. Can you give me a more detailed example?

In the last game where I summoned Basium I noticed that I was unable to have diplomacy with him until he gained his first city. (I'm pretty sure that was never the case before v2.2.)

I blocked civs without cities from engaging in diplomacy because it was resulting in lots of strange diplomatic occurrences with rebels and also just made sense from a gameplay perspective.

I really think that we should be able to gift cities to vassals, not only liberate them.

I can look into that.

I decided to go ahead and attach (a zip archive containing) an edited version of GameFont.tga that will make your modmod use the obsidian gate icon for which you were hoping.

Awesome! Thanks!

The "Toggle manabar display" text is not using the defined txt. At Assets/python/Screens/CvMainInterface.py:

Should be:

Code:
szText = "<font=2>" + localText.getText("TXT_KEY_MANA_TOGGLE_HELP", ()) + "</font=2>"

Otherwise, the text will not work with translations.

And thanks to Terkhen as well!

AI - IMO still overuses mages/adepts. Melee line is used rarely. even ljofo AI rarely uses archers....prefers mages, etc.

OK.


Basium proceeded to charge solo into the middle of enemy territory

Kuriotate hero, a centaur charger, committed suicide charging (solo) towards Acheron who was closeby.

Damn Heroes! I've tried before to make Heroes stay in groups, but for some reason they seem to often end up out on their own. I'll look into it again.
 
ah, Tholal - catapults are overpowered - especially for the ranged attacks. Catapults - IMO wildly inaccurate siege engines(IMO weakness to fire is a must have promo for siege engines, and cannons always explode on "dying" but are resistant to collateral dmg from archer line) - only good for breaking walls and palisades.

so far cannons are worse than catapults - due to lower withrawal rate. I'd remove attack and witrawal from catapults completely(only collateral dmg and dmg vs defence) and I'd give flanking bonuses for cannons against of archer line(on attack, but withrawal rate no higer than 50%).
 
Tholal said:
Bickendan said:
'm also at the point where I'll end the turn, the AI's slowly cycle through, just as everything finishes and the game prepares to begin my turn (recenter the map), CTD
Any chance you can send me this savegame?
It's a v2.1 save, not v2.2.
Also, the error that generates on CTD is 'Reduce graphics settings', so I believe that this will be a system specific error (P4 2.5 GHz, 2 Gb RAM, nVidia GeForce 5200FX).

However, it may be worth sending just because the Balseraphs culture flipped themselves out of the game. Capria had captured all but one of Perpentach's cities, forced him to capitulate. Later, I found out during game replay, Perpentach's last city flipped over to Capria's side.
 
AI Arthendain is not using his destry undead spell although my city is full of undeads. And yes, he wandered around alone.

AI - stacks with cultists - no tsunami and mixed with other units - tends to walk away from water anyway.
 
Yes, the AI is still fond of letting heroes run into enemy lands alone. Hyborem does that all the time, even when I have far more militar strength.

I also noticed two weird things regarding war and peace in our last multiplayer game. I was about to conquer one city, when my adversary used the Seven Pines spell. All of my heroes and catapults where expulsed of his territory... but my Grigori Medics stood there. Then he immediately declared war against me again (still in the same turn), and killed my medics which where still there.

I would expect Grigori Medics to be expulsed when a war is declared, even if they can normally move across enemy lands when on peace. Also, IMO the peace granted by the Seven Pines should have the usual "cannot declare war" turn limit.
 
What mechanized units do you have that you dont want to be tradeable? I'm probably not going to add a new XML tag just for this, but I might try and set up a CannotTradeUnit python callback that will give you more control. Though I haven't done anything like that before, so it may not be in the next release.

The mechanized units that seemed to cause the most trouble being traded are Severed Souls, but I also really dislike how the Lanun are so eager to give away their hero The Black Wind. (I suspect that the Doviello will also trade away their hero The War Machine, but they haven't engaged in diplomacy with me after building it yet.)

I also think it would be a good idea to allow some non-mechanized units to be traded in diplomacy. I'm mostly thinking Slaves, but maybe Mercenaries too. (Of course, since Mercenary in my mod is a promotion rather than a unit that would probably require a python callback.)
Looks like the code is causing Held units to also be flagged as Immobile for 999 turns. I'll see what I can do to make that work better.

Bear in mind the reason why Kael made the Held promotion block casting spells. It was to prevent units that got the Held promotion from the Cage outcome of exploring a lair from freeing themselves, as that would make that lair result completely pointless.

Personally I always thought that it would be much better to allow promotions to block units from casting specific spells.

Yes, otherwise there are a large number of buildings and units that a player would not be able to get any information about. Though it does result in some strange entries, I would prefer to have the information available to players so they can find answers in-game rather than trying to dig through outdated manuals or comb through forums.


You are free to change it in your mod. It's handled in python.

SevoPediaMain.py - look for and not getInfo(iItemID).isGraphicalOnly()) . That's the line that I changed.
I had actually changed it just before asking.

It just seems like it would make a lot more sense just to change the bGraphicalOnly tags on anything you want to be visible.
OK. The revolutions code has lots of confusing formulas in it. Looks like you've hit one that wasn't properly coded. I'll have to try and figure out what that section of code is trying to do.

Was it the event where you cede power for 10 turns? If so, having only a single city shouldnt necessarily prevent it from happening.
I don't think it said anything about ceding power only temporarily, but I have never selected Agree so I don't know its actual effect.
Not entirely sure what you're referring to. Can you give me a more detailed example?
I believe that Firaxis coded the game so that players cannot trade away the city containing their palace, in order to make sure that the player retains at least one city and does not trade itself out of existence. Since puppet states do not have palaces, they are able to trade away every last city they own. Since they usually have very good relations with their masters, they are typically very willing to liberate cities even when they only have a single city and liberating it is thus suicide.

Edit: This does not seem to be the case in my current game, but maybe I just don't have enough culture in their cities for liberation to be an option.

I blocked civs without cities from engaging in diplomacy because it was resulting in lots of strange diplomatic occurrences with rebels and also just made sense from a gameplay perspective.
Could you at least make an exception so that they can engage in diplomacy with members of their own team? And maybe so that human players without cities can still use diplomacy?

----

I've noticed in my current game that all of the players that keep spawning from violent revolutions are being given Adventurers. These are essentially useless before the rebels have captured a city in which they can be upgraded, and giving out Adventurers so easily to any civilization don't quite seem fair to the Grigori.


I've had complaints in my modmod thread that the AI is never using any world spells. I can recall at least one worldspell being used in the version based on v2.1, but none since v2.2; did that version do something to the AI that makes it forget about worldspells?
Edit: Right after I made this post my permanent ally Arendel Phaedra used March of the Trees, so I guess that is not a real issue.
 
The mechanized units that seemed to cause the most trouble being traded are Severed Souls, but I also really dislike how the Lanun are so eager to give away their hero The Black Wind. (I suspect that the Doviello will also trade away their hero The War Machine, but they haven't engaged in diplomacy with me after building it yet.)

Severed Souls are mech units? That's a little strange.

I meant to add a catch to keep hero units from being traded but never got to it. I'll do that for the next release.

Bear in mind the reason why Kael made the Held promotion block casting spells. It was to prevent units that got the Held promotion from the Cage outcome of exploring a lair from freeing themselves, as that would make that lair result completely pointless.

OK. So why do you want Held units to be able to cast?

Personally I always thought that it would be much better to allow promotions to block units from casting specific spells.

You can probably do that in python via spellinterface.py

It just seems like it would make a lot more sense just to change the bGraphicalOnly tags on anything you want to be visible.

Hmmm. Looks like you're right! I thought the bGraphicalOnly tag was also used to, you know, display graphics, but apparently not! I'll revert my change and use your suggestion instead for the next release.

I don't think it said anything about ceding power only temporarily, but I have never selected Agree so I don't know its actual effect.

I believe the text says something about demanding a change in leadership. I'll try to track that bit of text down and make it more informative.

Since puppet states do not have palaces, they are able to trade away every last city they own.

OK. I should be able to fix that.

Could you at least make an exception so that they can engage in diplomacy with members of their own team?

That should also be doable.

I've noticed in my current game that all of the players that keep spawning from violent revolutions are being given Adventurers. These are essentially useless before the rebels have captured a city in which they can be upgraded, and giving out Adventurers so easily to any civilization don't quite seem fair to the Grigori.

I thought it was kind of an interesting occurrence and sort of viewed the Adventurer unit as the 'leader' of the rebel forces. Didn't seem like it was particularly unbalancing or unfair to me, so I never bothered to try and track down the issue. But I'm willing to add it to the bugfix list if you feel strongly about it.

I've had complaints in my modmod thread that the AI is never using any world spells.

I just ran a test game and saw several World Spells being cast and notifications appearing for them as well. The AI isn't especially smart about when to use their World spells though. I'm open to suggestions for improvements on this front.
 
What about instead of adventurers .... spawn [unit at tech parity X] with the Hero and Great Commander promotions?

That way, less flexibility than an adventurer, but can be used immediately.

Never a tier 4 unit mind you ... but a tier 2 or 3 unit (say a Swordsmen, or Hunter, or HorseArcher, or Chariot, or Champion, or Assassin), just depending on the civ type, tech level, and a few other variables.
 
Hey there guys. Just wondering if I can switch in and out the mod features, namely, plugging only the Naval AI improvement, or getting it standalone. The Naval AI passiveness is quite nasty, but I suspect that new features in modmods lay additional burden on it, due to fewer testers and attention.
 
In my most recent game, I know I saw the Llosafar, Clan of Embers, Dovielo, and Amurite world spells. I'm pretty sure some others got shot out too, but I didn't notice. In most cases, they were fairly well-timed; the Llosafar in particular easily won a war that they probably would have lost otherwise by hitting the panic button and burying the invading Hippus in Treants. So world spells seem to be working fine.

I did also see Basium wander into enemy lands unsupported, despite having some angels and Paladins to draw from.
 
Hey there guys. Just wondering if I can switch in and out the mod features, namely, plugging only the Naval AI improvement, or getting it standalone. The Naval AI passiveness is quite nasty, but I suspect that new features in modmods lay additional burden on it, due to fewer testers and attention.

Revolutions and Advanced Tactics are optional. You can disable both via Custom Game.
 
In my most recent game the AI was consistently choosing to move its units into a desert (-25% defense) instead of a forest (+25% defense). I had a city fairly close to Acheron, so every few turns an axeman would be sent towards my city. Adjacent to my city were a forest and a desert that were both equal distance for the axemen. The axemen consistently moved into the desert rather than the forest which made it easier for me to use a chariot to wipe each one out when it was in the desert. However, it might be possible the axemen weren't charging the city, but were after something else like my workers or something. (I don't have a saved game from that point in the game anymore to go see what they were really after)

P.S. World spells seem to be working okay from what I have seen.
 
Worldspells work fine, the AI is not to smart about it sometimes though.
Also i had the Lanun and Mercurians pop their worldspells the same turn once, killing pretty much all defenders(PZ´s) in my costal citys and acctualy winning them the game.
 
Hey all. Thanks for the continued feedback! Just wanted to let you know that I'm still here and trying to work on the mod when I can, though it would be nice if I could sit down at my computer for more than a half-hour at a time!

Just last night I discovered that I had been making some improper calls to getGroupSize(), which apparently has something to do with the artwork and not the size of the unit's stack. I should have been calling getGroup->getNumUnits() instead! :hammer2:

I think this is what was causing the AI heroes to run around alone, and was likely also causing other unwanted unit behavior.
 
I would like Acheron to be able to cast Breath Fire and Roar while still stuck in his city.

I would also be nice to be able to make the Committed to Asylum promotion hold the unit in a city while allowing it to cast a spell to remove that promotion and add back Crazed and Enraged. (Currently I use a spell with a python prereq that checks to see if the unit is still in the city and switch the promotions otherwise. I'd like to be able to cut down on such spells, as they can be processor intensive.) In the past I wanted arcane units on a certain improvement to be able to cast a spell that would boost their magical abilities so long as they were immobilized in the tile. I'm not as keen on the idea now, but would still consider it if it were possible.

I'd also considered the possibility of a spell that give enemies a promotion that disables their magic until it wears off, but without immobilizing them.

Note that if you don't add another tag that allows a promotion to block all spell casting then I would much rather you left bHeld alone. It is very important that I be able to prevent my Sluagh units from using any spells or abilities. I guess could make it so that the Barbarians build a DOMAIN_IMMOBILE version of Acheron that can use his abilities and changes to the normal dragon once captured.


I just got that same divide by zero error in RevUtils.py again.

On the issue of trading mech units, I could settle for simply blocking all world units, limited duration units, and any unit that has a summoner (including permanent summons) from being traded.

I've never been a fan of how Kael made permanent summons immobile for their first turn. Would you mind changing that?

Is there a way to set one unit as the summoner or the summon of another unit in python? How about to identify all the summons of a summoner without cycling through all the player's units? If not, these would be welcome additions. It might also be nice if you could add a way in the game to identify what summoned what, as I believe is already done in other modmod's using code by xienwolf.
 
On the issue of trading mech units, I could settle for simply blocking all world units, limited duration units, and any unit that has a summoner (including permanent summons) from being traded.
I assume those latter blocks would be for the benefit of your modmod, as there aren't any limited duration or summoned mechanical units in the base game, right?

For my part, one annoyance with trading mechanical units is the city that they end up in. In my most recent game, there were two pole-to-pole continents that split the world into two distinct oceans. I had a decent naval presence in one, but almost nothing in the other. When I traded for boats from a civ in the other ocean, rather than gaining those boats in the nearest port city to the boat's position, or any port city I owned that the boat could reach without flying, I gained that boat in the port city nearest to my capital... on the other ocean.

I've never been a fan of how Kael made permanent summons immobile for their first turn. Would you mind changing that?
Personally, I like this - it means that if you want to use permanent summons as cannon fodder, you have to plan ahead a bit. It makes their role a bit more distinct from the temporary summons. I suppose you can look at that both ways, but I wouldn't like the change.
 
Personally, I like this - it means that if you want to use permanent summons as cannon fodder, you have to plan ahead a bit. It makes their role a bit more distinct from the temporary summons. I suppose you can look at that both ways, but I wouldn't like the change.

I agree with doktarr. This should not be changed. Magister should make this change (and possibly some of the other ones he/she requested) himself/herself in his/her own mod.

edit: It should be kept the same in More Naval AI, but it would be fine if it was made easily moddable through python or a new XML tag then both Magister and us would be happy.
 
Top Bottom