Ok, several thoughts here. I think the AI has two separate problems that make it bad at building nukes:
1.) The AI does not properly value buildings that unlock nukes.
Important bits are in red. This code is for the AI, in valuing BUILDINGS. Not units. Late game, unit strengths are very high. So a building that unlocks a combat unit is given a high weight. But A nuke with a small range is given nearly no weight. 50 combat x 50 combat = 2500. 8 Range nuke is 400. I can tell you which unit the AI should prefer. (Hint: The nuke). I think the nuke range value should be squared, just like the combat. Leave the * 50 for good measure.
Ok that should help the AI build stuff to unlock nukes. For the units themselves, they still have issues.
2.) AI does not properly value Nuke units
(As far as I can tell, USE_UNIT_TENDERING is off. Is this correct? I checked the makefile:
http://svn.code.sf.net/p/anewdawn/code/Trunk/Sources/CBMakefile )
Basically in the code where cities choose to build units, cities only have two real chances to even select building nukes. The first chance is about half-way, in terms of code. Workers, city defense, etc, are all way above this. So if the AI needs more workers, or hasn't got enough defenders, well that sucks for the AI then, because they won't build nukes. IMO, there should be an earlier additional check. Basically something like this:
Code:
if city is tier 1 production city (in the top 3 hammer producing cities in the nation)
if city is not in immediate danger from enemy units and has > 3 defenders
if we are at war, or are planning war, or another player already has a nuke
try and build a nuke
Obviously not real code, but you get the idea. I'd stick it in CvCityAI, before this bit:
Code:
if( !bInhibitUnits && !(bDefenseWar && iWarSuccessRatio < -50) )
{
if ((iAreaBestFoundValue > iMinFoundValue) || (iWaterAreaBestFoundValue > iMinFoundValue))
{
// BBAI TODO: Needs logic to check for early settler builds, settler builds in small cities, whether settler sea exists for water area sites?
if (pWaterArea != NULL)
{
That code is for early settlers, and frankly, if nukes are available, settlers don't matter that much anymore. So extra nuke logic before settlers. Early game AI will just skip it since UNITAI_ICBM will return no units available.