AI behavior

tachidi

Chieftain
Joined
Apr 1, 2010
Messages
23
I have a problem.
I've added some new resources and linked them with units ( it means that units consume them ). This resources are produced in some buildings. And everything will be fine, but AI don't "apply" this and don't build any constructions to gain this resource.

I think, this is due to AI strategy and politics, which should be linked with this resource, but i dunno how. Can anybody help with it?
 
The AI doesn't work that way. AIs choose to build buildings based on the Flavor values you gave the building, but they have absolutely no knowledge about the building's effect. So it won't understand that the reason it can't build that unit it wants can be fixed by building that building. In fact, the AI doesn't actually "want" any unit, either; it simply picks the current unit to be constructed from the list of ones it CAN meet the requirements for, and won't consider the ones it lacks a resource for. So changing the Flavor for the resource itself wouldn't increase the AI's desire for that building, because it doesn't actually connect the resource to the building to the unit internally.

I'm assuming you're using Whys' Building Resources mod to add the resource, since there's nothing in the existing game that can do that. Outside mods like that, especially, aren't integrated into the AI very well. But even it were part of the core game, it's just not how the AI is constructed.
 
Changing a Flavor for a building makes the AI more likely to build it, but it'll be more likely to build it in ALL situations. You can't make it more desirable when you're short on that resource but less desirable when you have plenty. It's basically all-or-nothing, outside of a few specific situations (like how an AI that's short on Food might temporarily value FLAVOR_GROWTH buildings more highly). There's nothing like that that helps your situation.

And Flavor values only affect probabilities. Setting a high value means that the AI will be more likely to choose to build the building, but it's easily possible that it'll still never build one, unless you set the Flavor rating so high that it drops everything to build one whenever it can. (Which is bad for other reasons.)

But yes, the only way to make an AI more likely to build a certain Building is to increase its Flavor ratings. Adjusting flavors for the resource itself just won't help.
 
Back
Top Bottom