Don't need no stinkin' factories!?

You can try higher numbers and they may work, the problme would be when you exceed a value of 65535 you'll 'flip' the counter and start again at -65535 or 0 depending on the data type (I don't have the source in front of me to look, sorry). Anyway, if a unit has a base value of 65 and you give it a weight of 1000 you'll be fine, but if the unit's base value is 130 your weight of 1000 would break it.

That's quite possible, if you figure in the leaderhead's unit weight x unit's own weight x unit's Flavor settings. Do both leaderhead and unit Flavor settings actually count against the 65535 count in this case?

The shame is that to get them to do what you want would only involve changes to maybe 5-10 lines of code in the SDK rather than tweaking weights and flavors on every unit and leader :)

Looks like you addressed that again in your following post. I'll skip to that...

Here's another question for you, what else can the AI build? Do you have wealth/research processes for them to convert production? Do you have a bunch of 'filler' buildings and units that aren't absolutely necessary? You may want to considering removing the research/wealth/culture processes and as many buildings as you can pull out. If your AA units have the city defense unitAI setting (and only that unitAI) there is already code in place to limit how many they'll build based on a preferred number of defenders per city although there is no guarantee that they won't just build a ton of those if they have nothing other than AA or air units to build.

The AI can build pretty much everything else that would be expected of a WWII era Civ -- as far as standard CIV4 buildings are concerned. A lot of these are already built at the start of the scenario. I have new buildings added in the scenario, including 4 different aircraft assembly plants for each Civ involved (only two playable Civs), plus IIRC two production type buildings (generating Rubber and Oil resources), one engineering center (research), a flight school (air unit experience bonus + Trained Pilots resource), a rocket launch base (requirement to build rockets + extra air unit capacity), and a "local resistance hideout" giving one of the Civs a series of big penalties in foreign cities under occupation. Which buildings are the ones that should be removed?

I have a hard limit on Flak units (40 total for the larger Civ, 20 for the smaller one) with a +5 gold instance cost added, which doesn't seem to bother the AI. Its UnitAI are Air_Defense, Counter, & City_Counter. Sounds like you're suggesting I add the City_Defense tag as well -- right? Right now it doesn't look like the AI is going nuts trying to build AA units. Generally, although it tries to build a good number of them, It also builds things like granaries, universities, jails, coal plants, and even naval units -- which in this scenario can take more than a hundred turns to construct (another thing that doesn't seem to bother the AI either). :crazyeye:
 
In fact, the SDK change is even easier for your case, just need to tell the AI it needs more aircraft when it chooses what to produce. Want a compiled version of the dll?

Code:
/*** Seven05 Begin ***/
			//if (iAircraftHave * 2 < iAircraftNeed) <- Old Firaxis code
			if (iAircraftHave < iAircraftNeed * 2)
			{
				if (AI_chooseLeastRepresentedUnit(airUnitTypes))
				{
					return;
				}
			}
/*** Seven05 End ***/

Sure, that would be nice. You'd need to work with the scenario's current DLL which comes in Dale's Combat Mod. I think he's planning to make an update soon, which might include a new DLL (???)
 
That's easy enough, Dale doesn't have any changes in the file this is in. I'll compile one for you later with DCM and this quick & dirty fix so you can test it out.
 
Which buildings are the ones that should be removed?
That would be up to you, I'd remove anything not essential to your mod. So thing like graneries, theatres, etc... You could even cheat and create a single 'infrastructure' building to handle any critical city improvements such as food storage or health & culture you need. The idea is to limit the number of choices the AI has to only those that are essential for the gameplay you want in the mod, that would go a long way towards improving their performance.

I have a hard limit on Flak units (40 total for the larger Civ, 20 for the smaller one) with a +5 gold instance cost added, which doesn't seem to bother the AI. Its UnitAI are Air_Defense, Counter, & City_Counter. Sounds like you're suggesting I add the City_Defense tag as well -- right?
If they're building them you should be ok, the +5 gold cost may be forcing them into financial trouble which will cause them to build fewer units though. Again, it really depends on what you're trying to accomplish as to what should be changed. If this is the only land unit they can build changing the unitAI to UNITAI_CITY_DEFENSE and removing the others will work well because of the way the AI handles that specific unitAI and its descision process for building them. I would remove counter & city_counter though regardless since those are normally reserved for units with attack capabilities you may be confusing the AI. The other big ones are the processes, if the AI has a choice it may feel that research, gold or culture is more important than additional units so it will build those instead of replacing losses until it desperately needs units.
 
I just realized you mentioned something about the unit's base value. What's that?

<<You can try higher numbers and they may work, the problme would be when you exceed a value of 65535 you'll 'flip' the counter and start again at -65535 or 0 depending on the data type (I don't have the source in front of me to look, sorry). Anyway, if a unit has a base value of 65 and you give it a weight of 1000 you'll be fine, but if the unit's base value is 130 your weight of 1000 would break it.>>
 
Civ4ProcessInfos.xml has the processes in them, you may be able to remove them all entirely but if that crashes the game you'll have to keep one and just set it's prereq tech to something you can't ever get.

The base value of a unit is complicated, its a calculated value based on the strength and abilities of a unit. That value is then adjusted by the UnitAI based on the AI player's current situation (war, peace, danger, etc). Finally, that 'base value' is then adjusted by flavor and ai weight settings. For most combat units this uses the units strength, air units and other units with no strength are handled differently.
 
My concern was what you wrote:

<<For most combat units this uses the units strength, air units and other units with no strength are handled differently.>>

I understand the above to mean that Basic Values for air units are calculated differently. If so, how?
 
Well... it's complicated for this will take a minute :)

First, before the AI even looks at the 'value' or an air unit it decides if it needs any more. This decision is based mainly on their number of cities compared to the number of air units they already have. This means that no matter how good an air unit is the AI will never build it if they already have enough air units.

Once the AI has decided it needs more air units it then selects it's 'least represented' air unit, or the air unit that it has the least number of with roughly 25% random deviation. In other words if you have 4 diferernt air units available and the AI decides that it needs 100 air units you should end up with 20-30 of each, not to exceed 100 total.

Not quite what you were expecting is it? I had to look it up to be sure since I haven't done much with this part myself. Funny thing is, this means AI weights and flavors are worthless for air units, I wonder how much work it would be to fix that.
 
Back
Top Bottom