View Full Version : Machine Guns and other units with City special and City Counter AI
Jun 28, 2009, 06:31 AM
I noticed the AI never seems to build that many units like Machine guns even though they are very strong defensive units (better than infantry in a lot of cases) to defend it's cities? i had a game with Agg AI recently and there were a handful (single digits) of MG's compared to hoardes of infantry
I noticed in XML that this unit has the city special and city counter AI, what do they mean exactly? when would the ai start to think about building these kind of units ?
I have been thinking about adding the city garrison AI to Machine guns as they seem somewhat underused at the moment, especially defensively, would this help or harm things?
I also don't see many sams, or AT infantry, although in the case of the former it's quite specialised, but AT infantry does also seem a bit underused especially when i spam lots of tanks
How does the AI decide to make up it's unit mix, as sometimes it just seems to have just one type of unit above all others, i notice this especially once infantry becomes available, (before this and during early ancient period especially the unit mix is far more varied) were i look over other civ's cities and they just have reams of infantry with the odd' marine, paratrooper or tank appearing
During war they do build more of this stuff, but during peace time it's like infantry everywere, would it not be a idea for a mix of infantry, MG's marines etc?
Jun 28, 2009, 08:36 AM
Nobody knows exactly what city special means, but my opionion is: "exactly 1 unit per city". you will notice more machine guns by replacing city special with city defense.
But also: The AI lacks in producing counter units. The machine gun has lower basis strength than infantry - like AT_infantry and SAM_infantry too. You will never see many AT_infantry even if the human player is going to invade with hundreds of tanks. This should really get fixed if possible.
Jun 28, 2009, 11:26 AM
Maybe it's because they can't have the city garrison promotions that they weren't considered a city defence unit but neither can axemen and they have city defence ai. It does seem like they're not using this to their advantage.
On a related note, the warrior has city defence AI under it's NOT list which seems odd considering they get a bonus to city defence, but maybe it's so the AI will never rely on them for city defence after any other unit is available. Also swordsmen have city defence AI, which makes no sense to me. Unless your being attacked by archery units there's always a better choice than defending with swordsmen (maybe if they attack with chariots and you don't have spearmen). Swordsmen have always seemed like too situational a unit to use anyway. If they defend with axemen then that one point advantage they have means nothing so why not city attack with axemen instead?
On a semi related note, the Chinese crossbowman doesn't have collateral AI. Should it? It's collateral damage will get used because it has attack AI, but should it be building it for that purpose?
By the way, what AI type is used to defend resources?
Jun 28, 2009, 01:28 PM
Yes i rarely see AT inf, i have changed the unit to have a base str of 18, and 75% vs tanks, much like the sam inf, and removed it's ambush promo, hopefully the AI will see it as a more valid counter unit now
Warrior is so once other stuff is available it's no longer used, as city defended by warriors would be easy prey.
I have noticed what you say about swords being used as city defenders, it's is a high str unit though, so other than axemen, not much beats it
I don't really find the early game a problem the AI has lots of variety to there units, i just started a new online game up now and the AI has archers, spears and axes a nice well varied force
It's later that it becomes a problem, with just infantry being the stable, hardly any marines? hardly any tanks, or MG, or AT infantry, just infantry, infantry, infantry
maybe it's because later on there are fewer counter units? marines, paratroops, tanks, artillery gunships, none of these have counter AI, like axeman do for example, and for some reason sams and AT infantry just don't get built often, sams i can understand, fighters are way better, but no AT?
Hopefully my change will see more built, but it would be good if later game armies matched the variety of early game armies more, with lots of marines, tanks, arty, MG's and infantry, rather than infantry being 95% of the ai's force unless it's planning a big attack and in the massing troops phase
Jun 28, 2009, 01:40 PM
would be glad if 95% of the AI forces were infantry... most of the time 95% of the AI forces are cavalry. :D
Jun 28, 2009, 02:04 PM
Well i think some units are lacking counter AI values, i know Jdog mentioned about CVplayerAI, allowing certain units to be counters, but i don't really see it being used, but the XML seems a bit funny in places for sure
Units like grenadiers have city counter AI? when they only get attack bonus's, should it not be counter AI?
Marines also get attack bonus vs arty and Machine guns, yet don't have a counter AI value, nor do gunships
I'm tempted to just whack all those values in now myself, as i'm sure it can't do any harm....famous last words
Jun 28, 2009, 03:19 PM
You can always experiment with the UnitAI's. Just be aware that if you "force" the AI to build more MG's, you're doing it at the expense of probably more infantry (or any other unit). While this might be what you were initially after, you also must realise that an AI with more MG's and less infantry is also an AI that is not as potent offensively.
Jun 28, 2009, 07:55 PM
Giving MGs the UNITAI_CITY_DEFENSE solves this issue :)
Jun 29, 2009, 11:20 AM
Is that by adding it in place of the city special AI or in addition to it?
I had a good looksy through the AI files and basically think the following would make good additions, please add your comments
Most cavalry, which gunships are a modern extension of, have unit AI attack + pillage, a few like Numidians, Conquistador also have a counter AI entry, due to there bonus against certain units, melee in this instance. Gunship to have Counter AI added, due to it's 100% armour bonus.
Cossack, to get the same counter AI entry due to it's cav bonus
Janisary to get counter AI added due to it's bonus vs archer, mounted and melee, (side note musketeer has had a pillage AI added to the standard muskeman AI entries due to it's two moves, so i guess jans should get the counter one considering)
Grenadier to have it's AI changed from city counter to counter, it only get's offensive bonus's so city counter seems a strange entry to have there?, chariots have counter AI and there bonus are the same as grens purely offensive
I think thats all of the things i found were missing or out of place there, 1 last one is the attack sub which has no unit AI attack, unlike most other naval warships, which is strange considering it's an attack sub? any reason to this?
Jun 29, 2009, 11:50 AM
maybe city_counter means attacking an enemy stack while in a city too? dunno.
Jun 29, 2009, 12:14 PM
maybe city_counter means attacking an enemy stack while in a city too? dunno.
There is a attack function called AI_leaveAttack which is usually inside AI scripts that are for defenders. It has a unit that is meant to defend attack if it has a high chance of success. I think that's how it works. I don't know if city_counter has conditions for AI_leaveAttack though.
Jun 29, 2009, 04:19 PM
There are several other units with similar style attack only bonus, chariots/marines and these do not have it
Marines are the most similar style unit, (with 50%) vs arty but they do not get city counter on there list
Also arty is more likely to be used for assaults than rifles, it seems odd that grens are the only unit with this city counter, when if it is as suggested a defend via attack AI, there are quite a few other units that could benefit, Chariots, Marines, Cavalry units with there siege attack bonus's
I also have a question about the the paratroopers paradrop AI, can it be used in conjuction with other AI types like unit ai attack etc? so i can get the AI to build more of these units too? at the moment it has just the paradrop AI and in my experiance the ai builds 1 or 2 paratroopers if that
Jun 29, 2009, 07:10 PM
are you serious? the AI is spamming paratroopers. that's why they got a national limit of 24 in my mod. :D
Jun 30, 2009, 12:38 PM
It hardly builds any, i'd like it to build a few as there solid units in there time frame
Edited to say, the Panzer could use a counter AI in there aswell as it is a strong anti tank, tank