How to force the AI to build weaker units

Yes, from AI build tests that have been done, we have found this to be correct.
http://forums.civfanatics.com/showthread.php?t=62138
'How the AI decides what unit to build'
So 5 units with the exact same stats will each have about a 20% chance to be built each (with some minor variation). The conclusion that I have come to in regards to AI builds, is that Firaxsis has an algorithm which takes each units stats and compares it to other buildable units; with this it formulates a 'percentage chance to build'. So every unit (no matter how weak) probably has a chance to be built, but the liklihood to build uber-weak units is SO LOW that players won't see it in a game.

But the thing to remember is, if you have a very large amount of units in your mod, and add this in for every unit, you will in essence double the amount of unit entries. Thus, for me personally, I would tend to keep it down to a minimum for player ease (so they don't have to upgrade every unit after it's built, and to keep the civilopedia looking a little cleaner).

Here's a rundown of a test I did on the importance AI places on flags to get weak units built more often:
CONCLUSION:
Flags which coerce the AI to build more of a particular unit:

1. Stealth (does not require a Stealth target for this to work)
2. Enslave (does not require an Enslave target for this to work)
3. Extra HP's (more HP increase AI chance of building a particular unit)
4. Radar
5. ZOC
6. Inconcluisve (Defensive Bombard/Amphibious does not seem to be factored in by the AI)
7. Unsure about the other flags available

Tom
 
Im pretty sure its something like that :p
How I wish I could allow in my mod the Peasants to be built and then upgraded to Settlers when the civ has enough money...

If your basic unit hasn´t an attack/def value and an offensive/def. tactics (better offensive), the AI won´t upgrade it. At least these were my experiences with upgrading to different workers/settlers. And here the AI behaviour in upgrading to these units is different for different civs (Egypt!).
 
QUESTION: Will the AI always upgrade these 'hull' units after it makes them? Or will it occasionally use them? I think as long as there is no upgrade costs, it would probably upgrade them immediately
If the upgrade has the same cost as the hull (ie free update) the AI will upgrade it. And if the unit is immobile, with a 0 attack and defense, it won't be used much...

However, this may be excessive :).

There is one thing that needs further consideration: if all the hulls have the same cost, it means the human player is likely to build only the stronger, to quickly get an army of BB...

So the balancing of the units had to be done carefully, to be sure all of them can have an interest for a human.
 
If the upgrade has the same cost as the hull (ie free update) the AI will upgrade it. And if the unit is immobile, with a 0 attack and defense, it won't be used much...

However, this may be excessive :).

There is one thing that needs further consideration: if all the hulls have the same cost, it means the human player is likely to build only the stronger, to quickly get an army of BB...

So the balancing of the units had to be done carefully, to be sure all of them can have an interest for a human.

I'm checking now to see if the AI will upgrade an Immobile Hull at same cost with Attack and Defense.

Much testing is needed still to find the balance... BB Hulls would have to be more expensive so human's can't take advantage of the AI. So, e.g., BB Hull cost 210 shields, and destroyer costs 60 shields. Then it's a matter of finding the right A/D for the Hull so it falls in line. I think more shields is sometimes more attractive to the AI, so the Hull's A/D may need to be very low initially (or even negative hitpoints).

One problem would be if the AI city does not have a harbor (or if it gets destroyed), the AI may decide not to upgrade the Hull unit.

Tom
 
I've been using this to allow limited numbers of elite units in my latest Alex the great version. I allow a unit (Greek infantry for example) to be built without the King flag which upgrades to a King unit (Hypaspist). It allows me to set a gold cost as well as the usual shield cost for the elites as there's a significant upgrade cost to pay. The fact that the elites defend after other units does make them pretty useless if they're in a stack on their own with artillery too, as the artillery in my game have hit points and will be destroyed before the elite infantry. This, and having to pay 200 gold to get an elite unit will convince a lot of players to stick with the standard infantry for garrison duty and as a main battle force.

As has been mentioned, the units to be produced in the first instance (in this case Greek infantry) should NOT be flagged as king or else they'll be named after the civ's ruler. In my experience the AI seems to be more likely to upgrade a unit if both units (the one to be upgraded and the one upgraded to) have the same AI strategy flags.
 
I've just found another bug that puzzled me for a moment.

If there is NO unit that you can build except the worker (ie all units are autoproduced, or have the "king" flag so they should be gained by upgrading autoproduced unit), then when you build an improvment in a city, the game will crash!

If you remove the king flag for at least one unit and make it available, then the game no longer crash.
 
This is new for me.:)
 
LOL! :)
Im still puzzled on how you're able to have a standard unit buildable in your cities and able to upgrade to a king unit and I couldnt do it when I first tested the system, im going to have to test again, because when I tried to make some Peasants (no tech requirement) upgrade to Settlers (no tech requirement either and king flag), the Peasants disapeared from the build list if I remember correctly, because the unit they upgrade to is available, even though unbuildable because of the flag.
 
LOL! :)
Im still puzzled on how you're able to have a standard unit buildable in your cities and able to upgrade to a king unit and I couldnt do it when I first tested the system, im going to have to test again, because when I tried to make some Peasants (no tech requirement) upgrade to Settlers (no tech requirement either and king flag), the Peasants disapeared from the build list if I remember correctly, because the unit they upgrade to is available, even though unbuildable because of the flag.

It's possible that was due to the unit upgrading to a Settler unit. It worked when I did it for a naval unit. Try testing it for the Settler, then for a non-Settler and see what happens.

Tom
 
Hmm, I am still not quite sure I am following what was done. Could Steph run through it again in a step by step order?
 
1) Create the "full" units, for instance a cruiser, a battleship and a destroyer. Give them the normal stats, make them available to the correct civ (ex: Yamato to Japan, Montana to America). Check the "king" flag. This means they cannot be built directly, but you can get them via upgrade. It also means they will defend last when their stack is attacked.

2) Create the "weak" units, for instance "cruiser hull", "battleship hull", "destroyer hull".
They need to have weaker stats. Low enough that the AI wants to upgrade it, but not to low so he wants to build them. Also, the stats need to be very close, so the AI has the same chance to build any of them. You may have to play a little with the stats to get the proper proportion.

3) Create at least one offensive or defensive unit that is normally available to everyone from the start. This is because the game will crash if you have NO offensive/defensive unit when you build an improvment in a city. It can be one of the hull done in 2. Just be sure you have one.

4) Make the hull upgrade to the full version.

Exemple:
Destroyer 8/8. Hull 6/6
Battleship : 20:20, Hull 5/5.

The destroyer hull and the battleship hull are almist identical, so the AI should roughly build 50% destroyer 50% battleship. However, as the BB is a bit weaker, the AI may build 60% destroyer 40% battleship (this need testing and balancing to get it right).

Then, as the full battleship is much better than the hull, the AI will upgrade. Especially if the hull are immobile.

End result: the AI will have 60% destroyer and 40% battleships.

Alternatively:

1) Make the full version as king units
2) Create the hull units, but available to no civ
3) Be sure you have an offensive/defensive unit available (at worst make a "garrison" generic infantry).
4) Make a building to autoproduce 2.

Interest: if you have a generic hull in 2, you can have civ specific units in 1, and thus with one "shipyard" produce "battleship hulls", upgradable to with Yamato for Japan, Montana for America, and thus have dozens of different building produced civ-specific units, with only a few buildings, and stay within the 256 building limitation.
 
It also means they will defend last when their stack is attacked.

This is another potential bad side-effect with this method. If for some reason you happen to have 3 battleships escorting a transport, the transport will be on top of the stack and would be the first to be attacked and sunk.

I suppose what this means is that transports and carriers must also be upgraded to King Units in the same way.

Also, the AI upgraded 5 Hull's in my test game to the actual ships. 4 of them were named correctly according to the unit's name, but 1 was named the Civilization leaders name.

EDIT: The AI is occasionally building the actual King Unit itself (even though it is not available to build on the list) as well as the Hull unit.

Tom
 
I was digging through my notes and found the following nugget (sorry, I didn't note the poster):

"When a unit in the chain is unavailable to the civ upgrading it will just skip it and move on to the next unit in the list for upgrades, so the chain:

Scout-Conquistador-Explorer

will allow Spain to upgrade Scouts to Conquistadors, but won't stop any other civs from upgrading them to Explorers."

I simply add this here as not all ship types were built by all Civs, so one might have an upgrade path (with mechanics as outlined above) of:

Battlecruiser => Battleship as standard &

Battlecruiser => "Hybrid Aircraft Carrier" => Battleship (NB: in this case, only the CV is a King unit.)

Granted, a simplistic example, but this could be useful in a (e.g.) a WW2 scenario wherein the Germans can only build CVs (e.g., the Graf Zeppelin) by this method. Having the CV be a King unit (and defending last) would also be realistic.

Best,

Oz
 
Ok, I'm putting this here to see if anyone else has ran into this. I have my Hull unit which upgrades to the King unit. The King unit is NOT buildable on the unit list.

The AI does build and upgrade Hull units, but occasionally it also Builds the King unit directly out of the city (thus it is made with the civ leaders name), and it is not on the unit list.

Strange? Yes. How does this happen? Don't know, it should be impossible. Anyone else see anything like this?

Tom
 
I don't know, although I have seen it before. I think the only situation it can occur in is when the adviser asks you if you want to build the unit(s) in question, whereby it completely skips the "obsolete" unit. I have had the ability to build said unit under said situation before.
 
I don't know, although I have seen it before. I think the only situation it can occur in is when the adviser asks you if you want to build the unit(s) in question, whereby it completely skips the "obsolete" unit. I have had the ability to build said unit under said situation before.

I suppose this will just have to do... I have went ahead and made most transports the same way (hull -> king) so they don't sit helplessly out in the open even when transported by 3 battleships. Something similar will have to be done with carriers as well. As far as the AI building the actual king unit when it should not be able to, I will just have to put up with it, since I don't think there is any way to avoid that.

Thanks for the info!

Tom
 
Back
Top Bottom