Tweak for AI Building, poke holes in it

notque

Artificially Intelligent
Joined
Nov 13, 2005
Messages
1,682
I have been making several changes to the building AI. One that has been successful for me is removing wonders and health buildings from the building choice of the AI if it's at war, and not close to finishing them.

The reason for the change: The AI will build all wonders in their cities as they are killed. Or all health buildings, watching themselves die.

What the change does: Makes it so the AI focuses on units, and if it builds a building, it's a quick sort of thing where they move back to units. Wonders were a big issue in this case.

Now, it's working well for me, but what I want to know is,

Why is this a bad idea? What unforseen consequences have I not thought up.

I've also been doing a similar thing with Settler_Sea boats. No new settler sea boats while in a landwar.

Why are these bad ideas?

Thanks.
 
If the AI is at war with a weak/distant foe, it might not be necessary to halt building production. Consequently, if the AI is being invaded (an invasion stack in their territory), I'd say the AI should halt production on ALL buildings that it's less than 2 or 3 turns from finishing (unless it can deal with said stack already).

Otherwise, I can't think of anything else. This is one of those things that always bothered me about the AI.
 
Landwar is the designation I'm using for war, so weak distant + the closeness changes happen much less often.

I don't halt the production of all buildings because I'm doing this for Fall From Heaven, and you have to build buildings to build units.

But health and wonder buildings being removed have improved the AI tremendously.
 
I've also been doing a similar thing with Settler_Sea boats. No new settler sea boats while in a landwar.

Well, on Earth scenarios it's not always wise for, say, France to halt all colonization if at war with Khmer.

Landwar is the designation I'm using for war, so weak distant + the closeness changes happen much less often.

What is that supposed to mean?
 
This seems like a good idea, but the one danger I see is that it will give the human player a clear way to manipulate AI behavior. If I declare war on the AI with no intention of actually pursuing the war, I can get them to derail their economy to mass produce units. The remedy to this I think would be to have the AI determine if its actually in any real danger. I don't know how you'd determine this though.
 
High on my list of things to do for the BTS AI is to remove wonder build decisions from the hands of cities ... it's simply not a decision that should be made at the city level. By centralizing decisions for the one-per-civ kind of buildings, it will be a lot easier to have the AI decide when is a good time to go for a wonder. In addition, it also allows the easy creation of an auction system where each city will submit a bid for the wonder or national wonder ... highest bidder wins. This addresses the problem of the AI building these unique constructions in a good city but not the optimal city. Finally, the centralized routine can also decide if an existing wonder build should be aborted because the situation is too dire.

So, I certainly agree with the principal of what you're doing. DPII makes a very good point though, the logic you describe could be manipulated because it's deterministic and easy to trigger. In addition, if an AI is stuck in a series of land wars, your proposal could limit their growth.

I would suggest perhaps a two-tiered system:

- If in a land war, add a dice roll where you currently have a block, so that perhaps the city only considers building a health building 1/2 of the time if at war.

- If losing a land war badly, then block completely. Or, alternatively, add some logic for building panic units if losing badly.

There exists some panic unit construction code already, but it has a flaw ... it compares the number of defenders the AI has to the number it feels it should have, if the fraction drops low then it will start churning them out. However, if the AI is losing cities, then the number of defenders it thinks it needs will drop also since it no longer needs to defend the lost cities. Particularly in the later parts of the game when armies move more quickly, the AI isn't reacting properly.

There will be some updates along these lines to the BBAI development sources next week or so, after I get over the big hump on Friday in RL.
 
High on my list of things to do for the BTS AI is to remove wonder build decisions from the hands of cities ... it's simply not a decision that should be made at the city level. By centralizing decisions for the one-per-civ kind of buildings, it will be a lot easier to have the AI decide when is a good time to go for a wonder. In addition, it also allows the easy creation of an auction system where each city will submit a bid for the wonder or national wonder ... highest bidder wins. This addresses the problem of the AI building these unique constructions in a good city but not the optimal city. Finally, the centralized routine can also decide if an existing wonder build should be aborted because the situation is too dire.

Sounds great, now to figure out how to build that :)

So, I certainly agree with the principal of what you're doing. DPII makes a very good point though, the logic you describe could be manipulated because it's deterministic and easy to trigger. In addition, if an AI is stuck in a series of land wars, your proposal could limit their growth.

Agreed. At the moment it was a dirty quick fix that improved the AI tremendously.

I would suggest perhaps a two-tiered system:

- If in a land war, add a dice roll where you currently have a block, so that perhaps the city only considers building a health building 1/2 of the time if at war.

- If losing a land war badly, then block completely. Or, alternatively, add some logic for building panic units if losing badly.

There exists some panic unit construction code already, but it has a flaw ... it compares the number of defenders the AI has to the number it feels it should have, if the fraction drops low then it will start churning them out. However, if the AI is losing cities, then the number of defenders it thinks it needs will drop also since it no longer needs to defend the lost cities. Particularly in the later parts of the game when armies move more quickly, the AI isn't reacting properly.

So the best way to start will probably be to look at the panic unit construction code, and attempt to fix the flaw.

Then figure out what the code is for determining if we are losing a war badly.

Then add that section to the building section to limit certain buildings based on these more advanced conditions.
 
Top Bottom