Blues about blue circles.....

r_rolo1

King of myself
Joined
May 19, 2006
Messages
13,818
Location
Lisbon, Portugal
First of all, I want to give congratulations to this project and the effort made by this team to make BtS AI a little less bad :goodjob:

But ,in spite of all the very solid work made so far, the improvements made so far had been centered in the Combat area of AI behaviour. I wanted to suggest another area that if tweaked would certainly make the AI in game more solid: the blue circles routine....

I bet that everyone that ever made a test game with AutoAI for a whole game ( or atleast some hundred turns ) had seen the horrifing job that the AI makes in terms of city settling and tile improvement. In fact, even without AutoAI, there have been some threads in BtS forum regarding less than optimized moves from the AI in terms of settilng, that in fact probably hamper more the AI than its inability of making a good fight.

The main issue about the settling blue circes it that they establish a grid of suitable points to settle ( atleast as far as I understand the code, that is not as much as I would like :( ). The rules about the decision of the points to settle of that grid can be discussed or not, but the simple fact that there is a grid is bad for the AI. Why? Because the AI will never have infinite settlers with infinite speed and because there is a thing called maintenance.....

I do not have solid ideas about this, but why not try to mimic the expert human way of getting settlers spots? How about trying to get :

-Clusters of resources

-Minimum maintenance ( that normally translates in less distance of palace )

-Enough food to work the target tiles

-in a far lesser degree: coastal and/or riverside, defense, choking spots ( that one would be hard ). AI now tends to shun more to settle near coast or river than it should be and overemphatizes cities on hills, even sometimes at the cost of the short and long run future of the city or of the nearby ones.

-Last, but definitely not least: the AI should work that with no more than a handful of cities in mind. IMHO that is one of the things that hurts them more, the fact that they work with the presumption that they have all the land of the world to settle for free..... if they were thinking in 6 or 7 cities at the time top ( like humans normally do ), probably the results of the settilng would be far better.........
 
It's certainly true that city placement is fundamental to how well a player (AI or otherwise) does. Blake focused a lot on city placement, so I haven't really looked at it other than to see that the current method is very complex with lots of "magic" numbers all over the place.

If you try out the chipotle cheat mode and mouse around while holding down ALT you can see where the AI is considering and how much it likes different spots. Note that the AI will only have four or fewer city sites in mind on a continent at a time, so at least your last point is already taken care of.

The biggest concern I have is that the AI crowds its capital by building cities which overlap ... if the AI has any chance at winning these cities will always reach full size and so they've clipped the growth of both. There seem to be a couple of reasons for this, the use of a distance weighting which encourages a little overlap plus an apparent attraction to resources already in the cross of another city.

I'm also wondering about whether exploration plays a role in city placement, as early AI explorer units tend to runoff instead of making a loop around their capital looking for city sites.
 
My biggest gripe is that the AI tends to overvalue hills as settling spots ( ok, the extra hammer helps sometimes and the extra defense too, but most of the times it is simply a city wrecker ) and that it undervalues settilng on river/coast....

I understand your concerns about AI overcrowding the cap neighbourhood ( in fact , that alrealy happens more than it should happen IMHO ). Probably a good "potential valley" equation applied to the distance component could make the trick......

And surely that giving the AI 1st scouting unit a spiral pattern would help
 
My primary complaint re AI city locations is they are rarely ON the river, but one tile off. As one who embraces use of levees, it is very frustrating.
 
I think one of the problems with this is that Blake did alot of the coding for this before he knew about levees.
 
Well, the value of things like being on the Ocean and on a River varies with the game rules.

Should the AI attempt to read the game rules, and guess how good being on an Ocean or River is from the set of buildings, and the trade effects encoded? Or should it be hard coded? Or should we have a config file that encodes these kind of long-term planning biases?
 
The AI should move the first settler if there is a way better position at beginning.
 
Well, the value of things like being on the Ocean and on a River varies with the game rules.

Should the AI attempt to read the game rules, and guess how good being on an Ocean or River is from the set of buildings, and the trade effects encoded? Or should it be hard coded? Or should we have a config file that encodes these kind of long-term planning biases?
I would prefer the first solution if viable..... it would probably help the AI to get less bad in less "normal" ( you know... Pangea/Continents , normal weather, Normal speed, Standart size ... the situations where the AI sucks less ;) ) maps. A config file would probably make the AI to perform well in certain situations and far worse than that in others ( like, for example Dutch in M&S if you don't take in account the UB ), not mentioning that it would be hard to get a consensus about the value of some improvements to boot ( I'm starting to imagine ppl discussing the value of cottages ... :p ) and that would bork the whole city settling routine ( because for having a good settling routine, we need to make the AI to "imagine" what it can put in the terrain and that is critically dependent of what the improvements worth for it )

OFC this all also depends of the worker improvements "AI".... ;) that it is not that bad at all if you can convince to let old improvements alone more often :p
 
actually the blue circle shows you what the AI thinks is the best spot - given what you can see - the starting position evaluates more (takes into account hidden tiles and non-revealed resources). I guess in most cases it would be a bad move for the AI to move the starting settler (though certainly not always)...
 
So, one idea is to have city strategies?

Building a production city, a cottage city, or a specialist city. This generates three different 'metrics' for how "good" a city site is.

That decision -- production, commerce or specialist -- could also be used by workers to decide what to build in an area (and possibly reduce the cottage flip-flopping). And if it is cheap to evaluate, it could even be used to bias where to put national wonders.
 
So...

Forward looking: how forward looking should we be? Eventually happiness and unhealthiness will be very different, and biology and civil service will change our food budget hugely.

For a quick hack, how about we split things between "current tech" and "endgame tech" (being more fine grained, we might do "current tech", "full era tech", "next era tech", and "endgame tech").

---

So we have an effective happiness cap. We also have a health softcap -- past the health cap, each person costs 3 food instead of 2. Toss in a rule of thumb for "future expansion" and "military happiness"...

...

How about we use marginal utility model?

Fix the value of food to 10 units.

Set the value of commerce, production and specialists to:
(2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 50).

(This is an attempt to allow for reasonable ratios between the values of commerce, food and production. By picking discreet values, we can examine the space exhaustively, and use a greedy algorithm for tile selection and improvement selection).

That's 4096 entires. (while we are at it, specialists should be worth 3x the listed amount).

For each tile, work out which improvement gives the best 'total utility'. That gives you a utility number for each tile.

Figure out the happiness cap. Pick the best utility tile selection by a simple sort.

Examine the 4096 entries for ones that are relatively food-neutral (or food-positive) at the happiness cap, accounting for sickness. Those are the city possibilities of interest.

Now we test these against the city specialization options. These are:
Production city
Fast-growth city (sort of a sub-specialization, except during slavery)
Commerce city
Specialist city

An empire with a poor economy will want more specialist and commerce cities.

An empire will tend to want only one specialist city (because GPP are worth less if they are spread out).

An empire will tend to want some fraction of the empire as production cities.

How is that for an attempt to use the link to build a computer-understandable plan?
 
That could be a start......

But i'm not sure if it would handle trade route stuff easily as it is ( especially the GLH resolutions ones )....

Other issue that could prove dificult to fine tune is the hammers that come from the levee/other modded similar buildings. They are not very important for the first cities, but discarting them would probably be suboptimal ( most human players pan cities with them in mind even in the begining... well, far more than they consider the extra biology food )

And OFC there would be needed to be included some kind of maintenance checker and bias the program to close cities ( that would need a bias vs overlap as well :p )
 
Part of that is comparing "fully upgraded" to "not fully upgraded" options (ie, how future-looking should you be?)

Trade routes and location bias can be applied differently and after the fact, for the most part. And if the results of this is the AI building specialized super-hammer and super-commerce and super-specialist cities, with the ability to realize it after the fact, and building national wonders in a biased way based off of city specialization... I'd be ecstatic!

And if the AI doesn't pay enough attention to what happens in 4 eras from now, that can be written down as roleplaying. :-)
 
A related factor which needs to be taken into account is how to handle overlapping city crosses ... a human player can think "well, I'll let the new city have these two plains but leave the forest for the other", I don't remember the details of how the AI handles this currently other than it is not particularly deep.
 
The trade routes issue IMHO should not be putted later because it can be the prime reason for building a city ( classic city on the island to provide 2 coin trade routhes to everyone while on merc ) and it can be the diference between a coastal city and a non coastal one ( that in your model would probably would only be diferentiated by the soft :health: cap ). And if the AI have GLH it can make a huge diference.....
 
Back
Top Bottom