AI city production: Community brainstorming

45°38'N-13°47'E;13739317 said:
I might be wrong because I've only started a game, giant map, epic speed, but at the start of classical era only 3 wonders have been built, and 2 of them are mine. Also only Judaism, Zoroastrianism and Kemetism have been founded, usually some other religions have been founded. Also no war yet, but probably most civs are too far away from each other. It might depend on speed and mapsize though, so I'll continue testing
The AI is probably not as fast as before to start but I'm trying to improve that. I think there is no war because there is no diplomatic tense, but it will come! The AI isn't more agressive than before, it just prepares a lot better for war!
With Rev on, it's a lot of fun because some minors or emerged civ are really angry against the world and will try to build a lot a military (even if they go to financial trouble), so they attack everyone. From what I can see, civs appear, civ disappear, that's the life!

Afforess said:
Overall, I think it's a definite improvement. It's not perfect, but no code is.
I'm glad that you think that!

Afforess said:
I opted to rewrite this section of BBAI code and simply count up the total :str: of all land units, and the total strength of collateral and bombard units. If the bombard or collateral unit strength was below the desired level (5% and 10% respectively) then the value of these units were increased. If there were too many of these units, the value was decreased. It uses a cubic scaling, so having few siege units will encourage the AI to build more strongly, while extra will make the value of the next siege unit nearly worthless. The amount of siege units is not based on army size, but army strength (and the strength of the siege units). This change seems to create reasonable number of siege units, and encourages the AI to quickly replace lost siege while not overstocking.
I'll look at how it behaves now because there were too many siege units, but siege units are also really good at weakening stacks.

Afforess said:
A few mistakes in coding I noticed: dbkblk, you added our traits to CvEnums.h so you could reference them by name in the code. If you want to reference an XML element (like traits) directly, you should use GC.getInfoTypeForString("TRAIT_XXX") or GC.getInfoTypeForString(BUILDING_XXX), etc. It will give you the correct id of the XML item you want. However, usually it should be avoided entirely, as this hardcodes XML into the C++, and if anyone removes or adds more traits, your code will be immediately out of date. Usually new XML tags are introduced instead of hardcoding.
I added them here because I got the same conclusion: we won't add new traits and even if we do, it's easy to add one in the enum. However, I didn't knew about the cached value. I have to admit there is so many functions in the code that it's sometime difficult to find if what I want to do is already implemented. I will test with your changes and hope it will make the difference.

Afforess said:
I threw in a line of BBAI logging to log all of the affinity stats. Also I tweaked one of your AI_chooseUnitAI description strings. Keep the description strings unique so you can tell which function was selected from the logs. That's why they are there.
Yeah sorry about that. I've released some half-baked part of the code because it's not in the main code yet. I see that you've changed this, so thank you!

Afforess said:
If you are looking for suggestions in how to make more significant improves to the AI, I think that there are still plenty of big gaps in the AI abilities. I know the AI does a poor job of creating enough Nukes, Fighters, and Bombers, and also does an extremely poor job of correctly using Great Commanders. I think these areas could all benefit from improvements.
Here is other production related issues that I want to fix:
-> Check special units (UNITAI_PARADROP, UNTAI_SETTLER_SEA (to transport settlers or units), UNITAI_CARRIER_SEA, UNITAI_MISSILE_CARRIER_SEA, UNITAI_PIRATE_SEA, UNITAI_ATTACK_AIR, UNITAI_DEFENSE_AIR, UNITAI_CARRIER_AIR, UNITAI_MISSILE_AIR, UNITAI_DIPLOMAT)
- Pirates ?
- Bug: The AI builds galley on impassable water
- Bug: The check on explorer should be reviewed
- Decrease the 2nd defender creation randomness (to have a better defense faster)
- Make the AI to build missionary of state religion only

Afforess said:
Keeping in mind my comments and few minor tweaks in Rev 926, I see no reason dbkblk's AI changes should not be made the default AI behavior.
As the code is much easier to read and maintain now, when the corrections mentioned here will be implemented, I also think that would be a definite improvement. At least, for the fun factor! To me, this is the end of boring games :)

Platyping said:
Paratroopers were built in BTS though
Good point! For some reasons, some special units aren't built in our code; but this will change!
 
The AI is probably not as fast as before to start but I'm trying to improve that. I think there is no war because there is no diplomatic tense, but it will come! The AI isn't more agressive than before, it just prepares a lot better for war!
With Rev on, it's a lot of fun because some minors or emerged civ are really angry against the world and will try to build a lot a military (even if they go to financial trouble), so they attack everyone.

Going on with the game I see it's probably ok. Halfway in classical era they're developing very fast, so it's OK.
 
In fact, different AI have different approach. They all try to have a minimal floating defense and attack, but peaceful are developing theirs cities and aggressive are trying to steal other's cities. That's why it's sometime a total mess.
I think this fixes a lot of problems:
- The human won't be alone to conquer
- Sometime, the warmonger AI runs out of finance, but it can make damage before ;)
- The diplomacy is now critical. You wouldn't fight with the greatest warmonger, wouldn't you?
- It improves Revolutions because agressive AIs prefer war over and thus it increases instability, like in real life.
- The AI resentment is increased as they can take cities more easily and such will want to revenge.
 
Top Bottom