[MOD] More Naval AI

I've also noticed that when a settler that starts on a tile that has an improvement that acts as a city (including a super fort), it seems that the AI will never bother to move the settler off that tile in order to found a city.

In my modmod I place Hellfire on an Infernal starting tile (when there is not a city for the new Demon Lord to steal when the Infernal Pact ritual is completed), and have Hellfire act as a superfort and a lair. Those Infernal players do not bother to found any cities until someone comes along to sanctify the tile.
 
[to_xp]Gekko;12215455 said:
yes, it happens when 2 settlers move to the same spot and once bounces the other away with cultural borders before it can settle. AI starting settlers shouldn't move that far away from their starting spot :D

In fact, I don't think they should move at all. The AI should always found in place. We already have code that picks out decent starting locations and bumps up the resources found in designated starting locations. While occasionally the right play is to move one or two tiles away to found a capital, the advantage the AI might sometimes gain by moving is far outweighed by how bad the AI is at deciding where to move (or, perhaps more generously, how difficult it is to effectively program the AI on how to choose a starting city site). Allowing/encouraging the AI to move the starting settler, while a neat idea in theory, causes more problems than it solves.
 
I wholeheartedly agree, they end up settling in wacky places anyway and it throws off balance. imo three things need to be axed here:

1) AI moving settlers around ( more trouble than it's worth )

2) starting settler promotion ( otherwise human gets an unfair advantage - the extra sight can stay I guess, but the extra movement needs to go )

3) goblin forts start with a goblin archer on them ( otherwise it's crippling to start next to one, 6 def archers are hard to kill and if you fail your first attack you get them promoted which exacerbates the issue. imagine if they're on a forest hill... ouch )


fun fact: the starting settler promotion was added so players could move away from Barbatos if they happened to spawn next to the broken sepulcher. since he's no longer ingame, the workaround is no longer needed ( most MP games remove the promotion for the issues mentioned above ) .

otoh, something that would REALLY come in handy is code that removes some forests from the starting BFC (unless you're elves I guess ) , because a forest locked start is pretty bad. Flavourmod already includes such code for example, alongside with some other goodies like adding marshes, detecting chokepoints for forts, vantage points for towers, and flavourful unique feature locations. it also includes code that adds food resources to food poor starts, however that part needs to be tweaked as it considers plains as bad as tundra so overboosts plains starts ( also imo it shouldn't use livestock resources as animal husbandry is not a tech priority early ) . it could also be expanded to boost production ( by adding hills ) and commerce ( calendar resources I guess ) if needed.



another issue caused by AI settlers moving is that it's far too easy to walk your scout into their empty capital if they settle near the player, which almost feels like an exploit.
 
[to_xp]Gekko;12216750 said:
Flavourmod already includes such code for example, alongside with some other goodies like adding marshes, detecting chokepoints for forts, vantage points for towers, and flavourful unique feature locations.

I am curious about the chokepoint detection code. Do you know if Jean Elcard did it in Python or the DLL? Is there some place that tells any details about it? I am guessing he probably just improved upon this. I have completed my own code for detecting and calculating the value of choke and canal points in the DLL. I also made so the AI will use the values to build forts at those points. I just need to do some more testing on it.
 
not sure about the inner workings, but Flavourmod is a DLL mod so it could very well have moved it into the DLL. IIRC the installer used to include the sourcecode as well, and flavourmod is included in the major mods ( wildmana, orbis, rife - it's been removed from MoM though )
 
I've once again had an AI civ refuse to capitulate when their options were capitulation, or being eliminated that turn. I had the lone remaining Llosafar city surrounded (I had left a city in the middle of their empire for last, having conquered around it) and using a hidden nationality unit I had literally reduced them to zero troops. They despise me (-25 relations) but the choice is between capitulation and death.

It just seems like it's impossible to force capitulation in the more recent MNAI versions. Has anyone been able to do so?

EDIT: as an aside, is there any way to avoid a steady decline in relations with all AI civs? The issue is that they will regularly request for you to join their wars and/or demand tribute, and every refusal is a -1 hit. It's just a matter of time before they all dislike you. Perhaps there should be a timeout on the negative effects for refusing to give tribute or join wars? Actually, there should probably be a timeout on all event-based relation events.
 
[to_xp]Gekko;12216750 said:
I wholeheartedly agree, they end up settling in wacky places anyway and it throws off balance. imo three things need to be axed here:

1) AI moving settlers around ( more trouble than it's worth )

2) starting settler promotion ( otherwise human gets an unfair advantage - the extra sight can stay I guess, but the extra movement needs to go )

3) goblin forts start with a goblin archer on them ( otherwise it's crippling to start next to one, 6 def archers are hard to kill and if you fail your first attack you get them promoted which exacerbates the issue. imagine if they're on a forest hill... ouch )


Tholal, if you consider this and choose to keep things as they are - could you add a toggle for AI settlers moving + starting settler promotion in globaldefinesalt.xml, or something like that?

the code that governs max distance they can travel used to be in civ4worldinfos.xml , but it seems you've moved it into the DLL so it's now impossible to easily tweak/remove it

otoh I think the starting goblin poison archers just need to go, they add nothing but annoyance to the game... kinda like mini-acherons that you can start right next to, they are just too strong for turn 0.
 
I'd agree .. poison goblin archers are insane.

Strongest goblin fort guardian (turn 0) should be, maybe, a poison goblin (imho).


I'd opt for keeping the Starting Settler bonus, but maybe making the AI settle in place 99.9% of the time, or just at default.

Maybe its the map code that needs changing ... so that settler starting location (for AI at least) is always viable.

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

One recent game, I literally killed an AI starting settler with my scout, on like turn 4, turn 5 I think (had no protection). After that ... all Doviello units were frozen in place, AI wise. Lucian just sat there on a hill, frozen in space and time, crying about his lost nation ... little did he know that he may well could have taken *my* city had he just attacked :p
 
I definitely think that starting settlers should keep their Starting Settler promotion, and that the AI should be able to move its settlers. The AI needs to be much more willing to move its settlers in situations when it is not possible to found a city on the current tile, whether due to other cities nearby, permanent improvements on the tile, etc.


@[to_xp]Gekko: You don't really need Tholal to change anything, as you can easily get things working the way you prefer by editing GlobalDefinesAlt.xml.
Code:
	<Define>
		<DefineName>STARTING_SETTLER_PROMOTION</DefineName>
		<DefineTextVal>PROMOTION_STARTING_SETTLER</DefineTextVal>
	</Define>
I have not looked into the SDK code to see whether it might cause problems change PROMOTION_STARTING_SETTLER to -1 or NONE, but I know there would be no issue to change it to PROMOTION_SENTRY if you want to eliminate the extra movement while keeping some extra sight.


The Scorpion Clan archers are added at lines 429-435 of CvEventManager.py, and can very easily be removed. (I commented these lines out in my modmod while writing this post, but then noticed Tasunke's post and decided to see how it goes using a Scorption Clan Goblin instead.) The Goblin Forts placed by mapscripts would still generate more scorpion clan units, but the players would have a chance to explore and clear them first, or to fortify a unit on the tile to prevent them from spawning.
 
thanx for the help MC!

@Tas: 1) poison goblins would work, but I kinda like the consistency of knowing all lairs start empty. it gives some choices: a. pop now b. farm for xp c. park a unit to avoid spawns

2) something that could work would be forcing the game to always call all the start balancing functions available regardless of mapscript, there are plenty: add rivers, remove bad features/terrain, add good features/terrain, etc.

3) yeah, I've done the settler decapitation a couple times lately, poor AI :D




@MC: " The AI needs to be much more willing to move its settlers in situations when it is not possible to found a city on the current tile, whether due to other cities nearby, permanent improvements on the tile, etc."

well, the "AI unable to found due to nearby city" issue is CAUSED BY moving settlers.

also I'm pretty sure you can't settle on unique features and the code doesn't allow a settler to start on an unsettleable tile either.
 
If the code doesn't allow a settler to start on an unsettleable tile, then how about this?

1) AI forced to settle on starting location (possibly an option- set to DEFAULT)

2) Option for 'no bad starting positions', forces the game to make a few (but not all) calls concerning map/ starting location, regardless of mapscript.

I'm not familiar with the calls ... but probably turning any tundra into plains/grassland if within a starting BFC, turning snow into plains, adding a river (potentially) if none are nearby ... or just moving the starting position to a viable start. One of the two angles, but not both.

(also, possibly turning some of the plains into grass if too many plains)
 
As I've said before, my concern is largely over how in my modmod Infernal settlers tend to stay on their Hellfire improvements rather than founding a city. I supose I could change my Infernal Pact code to place the Hellfire adjacent to the Infernal starting units instead of on the tile tile though.


You know, you could just change the effects of the Starting Settler promotion. You could make it make the unit slower, or do nothing at all. You could even use it to force settlers to found a city at their current positions, if you set up a passive spell like this:
Code:
		<SpellInfo>
			<Type>SPELL_FORCE_SETTLE</Type>
			<Description>TXT_KEY_SPELL_FORCE_SETTLE</Description>
			<Civilopedia>TXT_KEY_SPELL_FORCE_SETTLE_PEDIA</Civilopedia>
			<UnitPrereq>UNIT_SETTLER</UnitPrereq>
			<PromotionPrereq1>PROMOTION_STARTING_SETTLER</PromotionPrereq1>
			<bAllowAI>1</bAllowAI>
			<PyRequirement>effectStartingSettler(pCaster)</PyRequirement>
			<Effect>EFFECT_SPELL1</Effect>
			<Sound>AS3D_SPELL_HOPE</Sound>
			<Button>Art/Interface/Buttons/Units/Settler.dds</Button>
		</SpellInfo>




def effectStartingSettler(pCaster):
	iPlayer = pCaster.getOwner()
	pPlayer = gc.getPlayer(iPlayer)
	if not pPlayer.isHuman():
		iX = pCaster.getX()
		iY = pCaster.getY()
		if pPlayer.canFound(iX, iY):
			pPlayer.found(iX, iY)
			pCaster.kill(True, iPlayer)
	return False

I could also very similar code to give Infernal settlers a spell that lets them change hellfire to a city.
 
Removing fort archers would make mapmaking a lot less irritating too.
 
EDIT: as an aside, is there any way to avoid a steady decline in relations with all AI civs? The issue is that they will regularly request for you to join their wars and/or demand tribute, and every refusal is a -1 hit. It's just a matter of time before they all dislike you. Perhaps there should be a timeout on the negative effects for refusing to give tribute or join wars? Actually, there should probably be a timeout on all event-based relation events.

I agree to this, AI should forget things quicker.

Note: Some information about modding this is found here
 
Top Bottom