I would caution against making the default AI for the Machine Gun the CITY_DEFENSE, better to use CITY_COUNTER. The reason is that the AI will probably favor the Machine Gun over Infantry for city defense, as it is a cheaper unit than Infantry. While this may be fine as far as defense goes, those Machine Guns are useless on offense, an so you're making the AI build an army which is less versatile.
In the unmodded BTS, Infantry uses CITY_DEFENSE as the default AI, and so the AI will know to build those units as the "backbone" of the army. This is fine, because the Infantry also has ATTACK in its AI list. So the computer will use Infantry both for attack and defense of cities.
I don't think I agree... I looked at a lot of AI routines for various units.
In unmodded BTS and in recent previous versions of the Wolfshanze Mod, the default AI for the MG was "CITY_SPECIAL".
In unmodded BTS, the AI almost never made MGs at all... a simple change in the AI Routines (without changing the DEFAULT AI) in the previous version of the Wolfshanze Mod made the AI spam MGs like crazy and include them in all stacks.
Obviously the DEFAULT AI is not the most important factor in what the AI produces... because no-change was made in the default AI between default BtS and the previous Wolfshanze Mod, but the other AI's having different values drastically altered the way the AI built/used the MGs.
Having said that, I did read-up on AI useage... from my understanding, the main difference between CITY_COUNTER and CITY_DEFENSE is that the CITY_COUNTER is more likely to "rally out" as in some sort of attack, where-as the CITY_DEFENSE is more static. I also looked at other units, Archers for instance are CITY_DEFENSE, where as Spearmen are CITY_COUNTER. I think MGs should be more like Archers and less like Spearmen in AI use... MGs are very good at defending cities.
Having said that, the other important changes I made were the "NON_AI" tags which haven't been used before on the MG... I used NO "AI_ATTACK" and NO "AI_CITY_ATTACK", meaning the AI will never build these units for attack stacks of any kind. In the last version of the Wolfshanze Mod, the AI would indeed build MGs for attack stacks even though the default AI was not CITY_DEFENDER... I really don't think CITY_DEFENDER is as important as you say it is, especially if I force the AI to never build them for attack purposes.
In my last version, the AI did overproduce MGs... I seriously think they will build them less and use them less with this version... my goal is the happy medium. Because in default Civ4, the AI ALMOST NEVER built MGs... and in my last version they built too many... this version should be somewhere inbetween... there's probably multiple ways to setup the AI to accomplish this... mine should be one of those.
PS
If anyone has downloaded this mod AFTER reading this post, you've got the new version... if you downloaded v2.84 before reading this post, you've probably got the older MG AI code. Anyways, the new code is posted if you want to update it, and I'd like any feedback on the AI's use of MGs with the new code... I don't really have the time to test it, but
in theory the AI should use MGs more then default BtS and less then in previous versions of the Wolfshanze Mod... so if you've played a game and noted AI use of MGs, I'd like to know what you think... too much, too little, or just about right.