Pandora: First Contact

Pandora: First Contact

View Stats:
Ail Sep 29, 2015 @ 2:50am
How to decide when to expand?
I'm trying to find out the best algorithm to determine it is a good time to expand so I can teach this to the AI.

I think a highly adaptive algoithm taking a lot of parameters into account would be much better than something like "at X population".

The current approach weights lack of habitat against unbuilt buildings, wheras habitat provided by suburbs is ignored and the unbuilt buildings are weighted according to how big the city they are missing in is in comparison to the whole empire. For this, if a city is less than size 8, it is considered as it would be size 8 though.

However, I feel that this leads to somewhat too fast expansion by the AI.
The old approach was basically the same except that habitat provided by subrubrs was not ignored.
Most of the time it worked just fine but in some cases, especially when there was a lack of minerals allowing to city to get it's buildings done, which in turn meant more research and thus more unbuilt buildings, it could lead to massive cities surrounded by nothing but suburbs.
The new mechanism prevents those ugly, unproductive suburb-cities but tends to found so many cities that the AI is forced to pump resources in before they get productive which in turn opens a good window of opportunity to amass military and then simply take these cities from them.

I've had situations where the AI was getting their 7th and 8th city while I had only 3.

I'm thinking that instead of ignoring the suburb-provided habitat I should consider at least a fraction of it. How big it is may depend on the mineral-richness of the city in question.
Is the city mineral-deprived then I should want to expand in order to get minerals from elsewhere. If I have enough minerals I should expand only if really necessary and get more units from the production I otherwise would have to invest in buildings.

Also I'm not so sure about this "unbuilt buildings" thing at all. Mineral-deprivations means more research means more unbuilt buildings means lower drive to expand means mineral deprivation is not going to be resolved.

I'm considering to rewrite the whole algorithm. Maybe a simpler algorithm could be better.
I'd ideally like to somehow consider the base-mineral-income of the city in comparison to its population.

If anyone has ideas about this they are very welcome.
< >
Showing 1-12 of 12 comments
daniel.mantione Sep 29, 2015 @ 3:15am 
I think this is a rather complicated topic, because for a human, many factors matter wether to build a new city. I can think for example of:
  • The availability of bonus resources on the same continent is always a major reason for me to build formers
  • However, the priority of that depends on wether there are any computer players nearby that can grab the land before I do
  • Some bonus resources have higher priority than others. For example a production bonus relatively quickly pays out for the additional investment in buildings, while a morale bonus takes longer
  • Lack of habitat is certainly a reason, but as a human I also take terrain planning into account. If there are good possibilities for expanding through habitats, a new city is much less of a priority. If there is only poor terrain nearby, expanding through a former is a better idea.
  • The availability of good spots to build a city is also a very important consideration. I see the AI often looking for places to build cities, then they build a city on a lost spot on my continent. The AI is not aware that for a human, this feels like a provocation, where they steal "my" land, which can likely result in a war.

Most of these human criteria will be not be so easy to fit in an easy heuristic for the AI. You would need complex algorithms to weigh these criteria against each other. Nevertheless, I think the AI can be improved here by taking more things into account: Just looking at habitat is probably a far too simple approach and doesn't allow the AI to be smart on this subject.

I think that for example an algorithm to judge the value of the surrounding terrain around a city shouldn't be that hard to program, if it is poor, the expansion behaviour of the AI should get a boost and its willingness to build suburbs be penalized. Or maybe just penalize its willingness to build suburbs, its willingness to expand should get automatically higher then due to lack of habitat.
Ail Sep 29, 2015 @ 3:59am 
Originally posted by daniel.mantione:
I see the AI often looking for places to build cities, then they build a city on a lost spot on my continent. The AI is not aware that for a human, this feels like a provocation, where they steal "my" land, which can likely result in a war.
The AI actually prefers cities that are not close to someone else. The presence of non-allied military in an area will dramatically devalue an otherwise good spot.
But since this also includes aliens, this might be too effective in how it changes where they'd like to settle. Like if you clean up your alien-presence this might invite the AI over to you since they rather colonize a bad spot without aliens than a good spot with aliens.

Also since the distance of the closest city to the average of my military plays a huge role in the decision whether to declare war or not, the AI is just as provokeable as a human when it comes to settling a city near their core.

There of course already are evaluation-methods for any given spot. They are currently only used when it comes to deciding where to colonize but not whether to colonize.

My current concern is the whether/when part moreso than the where part.
willgamer47 Sep 29, 2015 @ 9:49am 
I can't directly help you with your current concern.

However, I think that the aggressive AI expansion (playing on easy- "the new normal") is what drives MY expansion. Forget optimizing growth rates and understanding the finer points of global growth (not food) driven expansion. The AI, IMHO correctly, considers that the maximum number of launch sites for nukes and black holes as decisive for the end game battles. So I've seen the AI take even a single hex available area between 2 of mycities on a coast.

tldr: the current ruleset encourages the AI to settle rapidly and everywhere; the human is hard pressed to keep up. I dislike this mechanic!
Ail Sep 29, 2015 @ 10:03am 
Easy is not the new normal. Actually all difficulties got toned down when it comes to AI boni. ^^
Nowadays easy is what had been Very Easy in earlier versions.
Normal actually is the fair difficulty now.

Are we both talking about 1.6.4+? Your mention of Nukes and Blackholes makes it sound like you could be talking about 1.6.3.
The AI in my current version expands quite a lot well before it has access to nukes.

And in my opinion it's not always ideal to expand so much under the current ruleset as new cities drain a lot of the resource-pool that could go into military.

I will now try some other approach.
Zak0r Sep 29, 2015 @ 2:49pm 
One thought: The second city should come earlier (around 7-8 pop) when the capital can't reach any good bonuses. When there are good bonuses the second city should be built when the last bonus was reached (or almost reached).
daniel.mantione Sep 30, 2015 @ 12:34am 
Nukes and blackholes are indeed a reason why it is not that bad that the AI builds some cities: They are a rather effective addition to the millitary power.
Ail Sep 30, 2015 @ 8:29am 
@Zak0r:
That's quite a big discrepancy in our playstyle then. I usually don't get a second city before Mine, Farm, Barracks, Pollution-Processor, Wendo-Apartmens and a bunch of units.
By then my capital oftentimes is at about size 15 or bigger.

@daniel:
I agree that Nukes are a good reason to get additional cities but I'm also mostly talking about earlier phases of the game. In 1.6.4 Nukes come a lot later compareatively so no need to have a sub-ideal economy due to overexpansion before the nukes are even available.

I'll be doing another new experiment today.
willgamer47 Sep 30, 2015 @ 8:54am 
>>>
Are we both talking about 1.6.4+? Your mention of Nukes and Blackholes makes it sound like you could be talking about 1.6.3.
The AI in my current version expands quite a lot well before it has access to nukes.
>>>

Yes, latest version.

Sorry, I didn't explain well. It's pretty much what Daniel said. Before black holes is when the AI is expanding like crazy, but it serves them really well to have many more launch sites than the human if war comes later. In my games I tried to follow the careful expansion advice in the forums only to find I had built only 1/3 of the number of AI cities per player.

The AI doesn't go to war early; I don't go to war early; all parties are basically peaceful during the expansion phase. The result is that the AI has that many more nukes and black holes to use whan was eventually comes.

Seems the AI has it right- avoid war; expand like crazy is a winning strategy!
Zak0r Sep 30, 2015 @ 9:06am 
Originally posted by Ail:
@Zak0r:
That's quite a big discrepancy in our playstyle then. I usually don't get a second city before Mine, Farm, Barracks, Pollution-Processor, Wendo-Apartmens and a bunch of units.
By then my capital oftentimes is at about size 15 or bigger.

If there are good bonuses in range I keep growing until I have them inside my borders too. But if I don't I usually feel it worth to expand and take a nearby bonus/good city spot. This often also saves me the Wendoappartmens (tech and prod) for a while and I can build a tank instead. :D
Last edited by Zak0r; Sep 30, 2015 @ 9:07am
Ail Sep 30, 2015 @ 12:20pm 
I just finished testing a new experimental approach and I have to say I'm pretty content about how it worked out.
It actually was a very simple approach that combined what I had done earlier with several other ideas:

For the calculation it takes current habitat + potential habitat from researched but unbuilt buildings but habitat provided from suburbs is halved in that equation.

The result was a very nice expansion pace. It avoided the suburbia-problem from earlier but did not overexpand either like the current version.

@willgamer: Well, you not going to war early or when the opportunity was ideal was a lucky circumstance for the AI. The only problem with the rapid expansion-pace was that it is too vulnerable while the new cities are all being brought up. When they are not punished for this they will end up in a better position of course.

I'll upload the new approach to civforum in a couple of minutes. It is, what I think, a very good compromise.

Edit:
http://www.civforum.de/showthread.php?96495-Zwischenpatches&p=6903951&viewfull=1#post6903951
Last edited by Ail; Sep 30, 2015 @ 12:52pm
willgamer47 Oct 1, 2015 @ 8:58am 
>>>>
@willgamer: Well, you not going to war early or when the opportunity was ideal was a lucky circumstance for the AI. The only problem with the rapid expansion-pace was that it is too vulnerable while the new cities are all being brought up. When they are not punished for this they will end up in a better position of course.
>>>>

Punished by whom??? I usually generate maps with about 3-4 continents. So on my continent, yes I could punish too early expansion and I have played games that way. Unfortunately, the other 3 or 4 AIs never punish each other, so they continue to expand and I'm the bad guy for the rest of the game.

I've seen AIs go to war with a weak AI, but never with an over expanding AI.
Ail Oct 4, 2015 @ 3:36am 
I've tried doing a one-city-challenge on medium the other day and it worked out to be a lot better than one would initially think.

Had I not also restricted myself to not go to war, I think that by the end of the midgame I was at the peak of my potential and could have gone on a rampage.

Eventually you are overtaken with that but starting the game off as one-city-challenge and finding the right moment to divert from it actually can be a very strong strategy. The main advantage clearly is to not have to invest in all the buildings several time.

My city reached it's max-potential at 104 population. I, however had to stall growth a while at size 88 as by then I didn't have the golden population-improvement yet.
Here's a sceenshot of the fully developed city:
http://www.civforum.de/attachment.php?attachmentid=1316741

As consequence of that I now count suburbs as full value again which lowers expansionism of AI a little bit. (They will not try one-city-challenges!)
< >
Showing 1-12 of 12 comments
Per page: 15 30 50