What does modifying <FLAVOR> do?

SinniX613

Warlord
Joined
Jun 27, 2011
Messages
105
Location
Ontario, Canada
What does modifying <FLAVOR> do?

Is this how it's used?

If I wanted a building to add +1 culture, I'd do this:

<Row>
<BuildingType>BUILDING_HUNTINGLODGE</BuildingType>
<FlavorType>FLAVOR_CULTURE</FlavorType>
<Flavor>1</Flavor>
</Row>

???

Sorry if this is obvious...
 
Not at all.

If you want to modify an existing building to add +1 Culture, you do the following:
Code:
<GameData>
  <Buildings>
    <Set Culture="1"/>
    <Where Type="BUILDING_HUNTINGLODGE"/>
  </Buildings>
</GameData>
If it's a building you made yourself (presumably, given the name), just insert
<Culture>1</Culture> into the building's definition.


Flavors are how the AI determines what sorts of buildings it wants to build. They're weighting factors for the AI's decision-making process, because the AI can't actually see how much culture, food, production, etc. a building generates. They ONLY affect the AI's likelihood of building a specific building; they do nothing for the player and do nothing to the effects of the building.

So assigning FLAVOR_CULTURE of, say, 50 for a building tells the AI "this is a very culture-oriented building; if you need culture, this is a good thing to build". The AI takes these values and weights them by its personal preferences (Aztecs wanting more military-oriented stuff, etc.). Then it takes each possible building that it can build right now, does a random draw, and picks what to build next this way; the AI has no ability to plan ahead, so this is how it makes decisions.

A Flavor of -999 means "don't EVER build this if you even remotely value this category", 0 is the default, ~50 is typical for a lot of buildings, and 100+ means that the AI should really build it as soon as possible (which is pretty much reserved for the Factory, Apollo Program, Manhattan Project, and spaceship parts).
 
Not exactly. Culture and Happiness aren't yields, and so can't be adjusted through most of the secondary tables. So if you want anything to adjust culture or happiness, then you can only do so if that particular XML table has stubs for it, and you'll need to find the explicit names for the stubs. Some tables have them, some don't.

Obviously, buildings CAN add Happiness. There are really only two stubs you need to worry about there: <Happiness> and <UnmoddedHappiness>.

<Happiness> is what the Colosseum, Theater, Stadium, etc. add; it's limited to +1 per population in the city, to keep small cities from running positive Happiness. Many other buildings have this, too: the Stone Works, the Satrap's Court, the Burial Tomb, and Circus. Wonders that have Happiness as a secondary effect also do this, like Chichen Itza. (Secondary as in, it's not the main reason to build the thing.)

<UnmoddedHappiness> is mainly for Wonders; it ISN'T capped by population, and just adds straight to your empire's total. This only includes the Circus Maximus national wonder, Notre Dame, and the Eiffel Tower. It's similar to the Happiness from policies that go through buildings; if a policy says "+1 happiness per Temple", then this happiness won't be capped.
 
Very helpful information good sir. In a few days I'll be posting the reason behind all these questions I promise, :)

Thanks again!
 
So assigning FLAVOR_CULTURE of, say, 50 for a building tells the AI "this is a very culture-oriented building

Something else to point out is these numbers aren't consistent. What's high for one flavor category might be low for another, so the only way to know for sure what numbers to use is to look at others in that category. They also aren't organized well in the file... it's sorted by item type instead of flavor category.
 
Something else to point out is these numbers aren't consistent. What's high for one flavor category might be low for another

The only two flavors that seem to follow a significantly different weighting scheme are Nuke and Spaceship, which you basically need to set to 150-250 before the AI's behavior will really change. For the rest, it seems fairly consistent, although it'll depend heavily on your choice of leader.

The thing to remember is that the AI has other overrides on behavior. For buildings, there aren't many overrides at all, so the AI will almost purely follow the Flavor ratings. The early-game buildings might total 20-30, and the endgame ones up in the 60s, but the idea is that the weightings are heavy enough that the AI can just use them semi-randomly.

Policies and Units tend to have much lower Flavor ratings; most units are in the 15-30 range, depending on era, with no single flavor above 10. Likewise, all policies total to 20. But each of these has significant other overrides affecting behavior; the policies, for instance, are limited by the fact that the AI has some hard-coding telling it not to open too many new branches before it finishes its current ones, regardless of flavor, and before this last patch the AI treated Tradition and Liberty as being mutually exclusive (even though they aren't). Units also have several overrides by type (most notably the Worker, where the AI classifies itself as "need/want/enough"), where the flavors are ignored.
There's also a variation argument; it's okay to specialize a city, which the Flavors encourage somewhat by having later buildings in a chain have higher values, but you really need your army to have a wide mix of unit types. Keeping the Flavors low makes it so that no single unit is seen as far more desirable than the others, which makes the random nature of the AI create a well-balanced army.

You can see this in the Improvements tables, actually. Improvements can have a flavor, but none of the default ones were given any flavors and so were all left at zero. So when the AI suggests an improvement to you, it's doing so purely on the basis of yields. But if you give an improvement a flavor of even 20, you'll see it suggested far more often (and what the AI suggests to you is what the AI players build), even if it's inferior in yield to one of the other improvements.
This is very handy when the improvement adds some Lua-based extras, like my terraforming code in my mod.
 
Back
Top Bottom