Just pushed to SVN (3714):
- Tweaked AI assessment of withdrawal and knockback effects on desirability of outcome (prevents potential suicides against high value enemy units)
- Added substantial stats logging to the BBAI logs (see below)
- Fixed a nasty issue in AI civic evaluation that was causing it to oscillate between matriarchy and patriarchy (and a few other combos)
- Added pedia text for auto-build buildings to say in the pedia that they are
- Added messages to the player when auto-build buildings get built in your cities
- Fixed a potential crash in use of the pedia from the main menu
The stats dump will cause a lot of statistics about the current state of each player's civ to be added to the BBAI log at the end of that player's turn. The idea behind this is to be able to see, in one place, where the AI is falling behind and get some clues as to why. The stats logged are as follows:
- Treasury
- Income from self
- Income from trade deals
- Units costs
- Unit supply costs
- Maintenance costs
- Corporation taxes
- Inflation costs
- Civic costs
- Total science output
- Total espionage output
- Total culture output
- Total population
- Total production
- Total food production
- Number of cities
- National rev index
- Total count of animals subdued
- Number of times a civic switch has occurred
- Number of total civic changes made
- Number of turns spent in anarchy
- For each city:
- Population
- Production
- Food surplus
- Net happyness
- Net health
- Local rev index
- Maintenance cost
- Income
- Science
- Espionage
- Culture
- Current values for all properties present
- Count of each unit type the player possesses
- Count of each building type that has been constructed by a unit that the player has (so indicates how subdued animals are being used primarily)
Testing this is what enabled me to find the civic issue with patriarchy/matriarchy, which is also fixed in this rev. This was actually a problem with ANY civic that had city growth modifiers, because the AI evaluated the value of growth modifiers based on how much faster (in actual turns given the food supply, happiness excess, etc. it has) it would actually make it grow. If a city has no food surplus a changed modifier won't help, so these modifiers got very low values for cities with no net food production. The bug was that cities currently producing units using food (settlers etc.) appeared to give no benefit from these modifiers, so while a civ is buildings settlers and workers the value of things like matriarchy appeared to drop suddenly, and as a result it would often switch. After the settler/workers complete it then finds matriarchy looks much better, so it switches back...and so on. I fixed this by using the nominal food surplus (i.e. - ignoring revolutions or build-by-food in the calculation), and that seems to have settled things down.
As an example, I have included below the output from my BBAI logs a sample AI for the last turn after playing 350 turns on a small map in autoplay from a game start (this has lost its indentation for some reason when I pasted it, so it's actually slightly easier to read in real BBAI log):
As you can see it probably is still a bit civic-switch-happy, but it's doing a decent job both hunting and using its subdued animals.
Anyway, games started under this rev or later, will now include the necessary information to produce these stats at any time, so if you have a game in which the AI falls behind (or suddenly implodes), turn BBAI logging on and play a turn or two then send me the BBAI logs (or take a look for yourself as you see fit)