I'm thinking about ways I kick the crap out of the AI. And one big one is city specialisation.
Approach to fix this.
Step 1: Think about what kinds of city specialisation there are.
Step 2: Identify which cities should be specialised which way.
Step 3: Influence worker plot improvements that is effective for the identification.
Step 4: Influence city build decisions to bias towards specialisation.
Step 5: Feedback civilisation needs to create demand for various kinds of city.
Step 1:
The basic specialisations are "factory town", economic "cash+research" town, "culture factory", and GPP factory.
Factory towns can be specialised into "wonder towns" and "unit factories".
Economic towns can be specialised into "research towns", "flexible towns" and "cash cow towns".
GPP factories can be narrowly aimed at one type of GPP.
GPP settlement targets (where you aim to build oxford university, etc) also kick ass.
There are a number of other niche towns, like the national park town, that might have to be hard coded?
With slavery, the "slave town" also exists. It tends to be a short term phase, however.
Step 2 thoughts:
Build a "multiplier profile" based on current and/or future technologies, and a plot return profile. This includes a happiness/healthyness budget. Use a greedy binary search to maximise the return on a linear utility function, then do a post-process check for things like "I want zero or slightly positive food return at happy cap for my factory cities".
Tweak the utility function to search for an option that generates the most production (for a factory town), or most cash+research (for an economics town), or most GPP (for a GPP factory), or most culture, etc.
This is aimed at being a fast and efficient way of generating a good idea on how good we can make a given city at a given role. Because we are using a linear utility function, the greedy algorithm works, and we get O(n lg n) on the number of tiles/size of the city work to figure out what the ideal result of the city is -- we avoid combinatorics hell.
The post-processing pass then tells us if we are valuing the non-linear components (like food for a production city -- we want enough food to support the city, but we don't care much about excess food) too high. We then adjust their (relative) value down, and repeat. A binary search can then rapidly close in on the ideal price of food (for example) in a logarithmic number of steps.
This isn't perfectly ideal, but it will be pretty fast (the slow part will be setting up the plot/building profiles, which requires searching the tech tree and the like. These profiles are relatively constant over an empire, so can be built and cached and not saved).
Step 3 thoughts:
I think the AI already has workers bias their auto build decisions based on the preferences recorded in the city. An interesting side effect of step 2's greedy algorithm is that we might be able to use it for worker AI improvements.
Step 4 thoughts:
There is a difference between "A Unit Factory" and "The Unit Factory", with regard to things like the heroic epic. Building national wonders is a "no-going-back" choice. Making that decision (and factoring it into what to do with a city decisions) is tricky. There is also the question of "should I change my mind".
Step 5 thoughts:
A civilisation who is falling behind in power/production needs more factory/unit factory cities. Everyone needs at least a few. Economic problems can be solved by building economic cities.
Deciding if a production city, or an economic city, is a better choice is a tricky problem that needs information about the civilisation's global state.
Should the AI seek to find a good spot to build each national wonder as they get the national wonder? (as opposed to the current system, where cities decide if they feel like building a wonder ad-hoc)
Approach to fix this.
Step 1: Think about what kinds of city specialisation there are.
Step 2: Identify which cities should be specialised which way.
Step 3: Influence worker plot improvements that is effective for the identification.
Step 4: Influence city build decisions to bias towards specialisation.
Step 5: Feedback civilisation needs to create demand for various kinds of city.
Step 1:
The basic specialisations are "factory town", economic "cash+research" town, "culture factory", and GPP factory.
Factory towns can be specialised into "wonder towns" and "unit factories".
Economic towns can be specialised into "research towns", "flexible towns" and "cash cow towns".
GPP factories can be narrowly aimed at one type of GPP.
GPP settlement targets (where you aim to build oxford university, etc) also kick ass.
There are a number of other niche towns, like the national park town, that might have to be hard coded?
With slavery, the "slave town" also exists. It tends to be a short term phase, however.
Step 2 thoughts:
Build a "multiplier profile" based on current and/or future technologies, and a plot return profile. This includes a happiness/healthyness budget. Use a greedy binary search to maximise the return on a linear utility function, then do a post-process check for things like "I want zero or slightly positive food return at happy cap for my factory cities".
Tweak the utility function to search for an option that generates the most production (for a factory town), or most cash+research (for an economics town), or most GPP (for a GPP factory), or most culture, etc.
This is aimed at being a fast and efficient way of generating a good idea on how good we can make a given city at a given role. Because we are using a linear utility function, the greedy algorithm works, and we get O(n lg n) on the number of tiles/size of the city work to figure out what the ideal result of the city is -- we avoid combinatorics hell.
The post-processing pass then tells us if we are valuing the non-linear components (like food for a production city -- we want enough food to support the city, but we don't care much about excess food) too high. We then adjust their (relative) value down, and repeat. A binary search can then rapidly close in on the ideal price of food (for example) in a logarithmic number of steps.
This isn't perfectly ideal, but it will be pretty fast (the slow part will be setting up the plot/building profiles, which requires searching the tech tree and the like. These profiles are relatively constant over an empire, so can be built and cached and not saved).
Step 3 thoughts:
I think the AI already has workers bias their auto build decisions based on the preferences recorded in the city. An interesting side effect of step 2's greedy algorithm is that we might be able to use it for worker AI improvements.
Step 4 thoughts:
There is a difference between "A Unit Factory" and "The Unit Factory", with regard to things like the heroic epic. Building national wonders is a "no-going-back" choice. Making that decision (and factoring it into what to do with a city decisions) is tricky. There is also the question of "should I change my mind".
Step 5 thoughts:
A civilisation who is falling behind in power/production needs more factory/unit factory cities. Everyone needs at least a few. Economic problems can be solved by building economic cities.
Deciding if a production city, or an economic city, is a better choice is a tricky problem that needs information about the civilisation's global state.
Should the AI seek to find a good spot to build each national wonder as they get the national wonder? (as opposed to the current system, where cities decide if they feel like building a wonder ad-hoc)