NEW Handicap's

So threat levels, transportation, and potentially (albeit somewhat unlikely since they don't seem to generally have this problem) some kind of problem with the generation of or use of units to accompany and protect the settlers may be an issue.

Threat levels... I'm wondering if that's a bit more concerning to the AI than it should be, if the threat is being measured appropriately. If a small animal is considered as great a threat as a stack of doom then we could certainly have an issue there. I'm not quite sure how to look into that at the moment. It also appears that perhaps inappropriately assigned threat levels may be messing with worker generation, protection, and function which could be one of the issues underlying this one.

I am sure t6hat is an absolute problem is "threat" If you play a game that has OPEN spaces in it, the AI will hardly expand at all, but if the AI are close together and killing all the animals etc, then the expansion proceeds normally. Infact i had just such a game like that.

Away from this, in the attached what is (WAR) in the civ area bottom right all about??
 
I've never seen the (WAR) thing... are they at war with each other perhaps? Have you found a bug option I'm unaware of? I dunno...

Interesting that you say that if there is MORE conflict it seems to inspire MORE growth... that goes entirely against the theory and presents an opposite hypothesis. hmmm....
 
There were some points where settlers weren't being built properly but yes, apparently that's not the only issue. I'm not 'forcing' them as much as I allowed them to in more situations. Economic factors are getting ruled out by AI logs and that's a factor that holds up the building of settlers potentially as well so without those factors holding up the training of settlers it's hard to think that's the factor holding them back from using them.


Your changes in CvCityAI::AI_bestUnitAI look like forcing to me and why did you include the current Era into the calculation?????????


You could try this instead
Code:
	//if (!tempCriteria.m_bIgnoreGrowth && foodDifference() > 0)
	if (!tempCriteria.m_bIgnoreGrowth && foodDifference(true, true) > 0) // K-Mod
	{
		// BBAI NOTE: This is where small city worker and settler production is blocked
		if (GET_PLAYER(getOwnerINLINE()).getNumCities() <= 2 || isBarbarian())
		{
			/* original bts code
			bGrowMore = ((getPopulation() < 3) && (AI_countGoodTiles(true, false, 100) >= getPopulation())); */
			// K-Mod. We need to allow the starting city to build a worker at size 1.
			bGrowMore = (eUnitAI != UNITAI_WORKER || GET_PLAYER(getOwner()).AI_totalAreaUnitAIs(area(), UNITAI_WORKER) > 0)
				&& getPopulation() < 3 && AI_countGoodTiles(true, false, 100) >= getPopulation();
			// K-Mod end
		}
		else
		{
			bGrowMore = ((getPopulation() < 3) || (AI_countGoodTiles(true, false, 100) >= getPopulation()));
		}

		if (!bGrowMore && (getPopulation() < 6) && (AI_countGoodTiles(true, false, 80) >= getPopulation()))
		{
			if ((getFood() - (getFoodKept() / 2)) >= (growthThreshold() / 2))
			{
				if ((angryPopulation(1) == 0) && (healthRate(false, 1) == 0))
				{
					bGrowMore = true;
				}
			}
		}

	}
 
I am sure t6hat is an absolute problem is "threat" If you play a game that has OPEN spaces in it, the AI will hardly expand at all, but if the AI are close together and killing all the animals etc, then the expansion proceeds normally. Infact i had just such a game like that.

Away from this, in the attached what is (WAR) in the civ area bottom right all about??

This yellow WAR text only appears when alt+shift clicking on the civ. It means "prepare for war". Don't know if it has any function beside a reminder to declare war against them soon(tm).
 
Your changes in CvCityAI::AI_bestUnitAI look like forcing to me and why did you include the current Era into the calculation?????????


You could try this instead
Code:
	//if (!tempCriteria.m_bIgnoreGrowth && foodDifference() > 0)
	if (!tempCriteria.m_bIgnoreGrowth && foodDifference(true, true) > 0) // K-Mod
	{
		// BBAI NOTE: This is where small city worker and settler production is blocked
		if (GET_PLAYER(getOwnerINLINE()).getNumCities() <= 2 || isBarbarian())
		{
			/* original bts code
			bGrowMore = ((getPopulation() < 3) && (AI_countGoodTiles(true, false, 100) >= getPopulation())); */
			// K-Mod. We need to allow the starting city to build a worker at size 1.
			bGrowMore = (eUnitAI != UNITAI_WORKER || GET_PLAYER(getOwner()).AI_totalAreaUnitAIs(area(), UNITAI_WORKER) > 0)
				&& getPopulation() < 3 && AI_countGoodTiles(true, false, 100) >= getPopulation();
			// K-Mod end
		}
		else
		{
			bGrowMore = ((getPopulation() < 3) || (AI_countGoodTiles(true, false, 100) >= getPopulation()));
		}

		if (!bGrowMore && (getPopulation() < 6) && (AI_countGoodTiles(true, false, 80) >= getPopulation()))
		{
			if ((getFood() - (getFoodKept() / 2)) >= (growthThreshold() / 2))
			{
				if ((angryPopulation(1) == 0) && (healthRate(false, 1) == 0))
				{
					bGrowMore = true;
				}
			}
		}

	}
My changes look like forcing because this isn't the only place where there are controls on whether to build a settler or not. This is one filter where settlers are either denied or enabled. If bGrowMore comes out at false here then settlers will be built IF the economy is healthy and if there are not too many existing settlers already (and I think there's a check to make sure there's an identifiable best spot to settle as well.) Those other checks take place in CvCityAI and precede this one.

The general logic involved in the above says cities will build settlers(actually... better put here in C2C, will ORDER a settler to be built - not necessarily in THIS city) if (all of the above checks out and) either the city is large enough and if the city has as many or more improved plots in its region than it does population.

Problem with this was that once a city grows past a point, or if rogues and such have devastated the land around the city it's invalid to order up a settler. It would also impede cities that were well developed (lands improved) until population exceeded the ability to further develop its lands.

The era was really just a proxy used to establish how built up a city should really be before it indicates to the nation that a settler is really needed. This makes the civ focus on growing its cities up a bit before they consider the civ ready to expand, but not by too much population.

Note: this is basically still the root of the k-mod code you posted as a suggestion so would end up in the same trouble.
Code:
			bGrowMore = (eUnitAI != UNITAI_WORKER || GET_PLAYER(getOwner()).AI_totalAreaUnitAIs(area(), UNITAI_WORKER) > 0)
				&& getPopulation() < 3 && AI_countGoodTiles(true, false, 100) >= getPopulation();

Interesting though... his notes seem to indicate that perhaps all this was originally programming to control the building of workers when in my research and yours confirming it looks more like control for settlers. Worker generation may be a little (seriously) out of whack somehow as well particularly if they're using the same logic which I did not suspect when originally working with this. Looks like it may be that a positive result is necessary for building workers huh?

We may really want to differentiate how this works for workers and settlers!

Also... taking a second look at this code it does show that I'm asking early cities to perhaps grow too much as a prereq. Someone said elsewhere that the civs were taking off after a point but they were sluggish in the beginning and I think turning the 4s into 3s and making a min 1 rather than a 1+ in these equations would free them up more appropriately in the early stages:
Code:
if (isCapital())
		{
			bGrowMore = (getPopulation() < (4 * (1+(int)GET_PLAYER(getOwnerINLINE()).getCurrentEra())));
		}
		else
		{
			bGrowMore = ((getPopulation() < (4 * (1+(int)GET_PLAYER(getOwnerINLINE()).getCurrentEra()))) && (AI_countGoodTiles(true, false, 100) >= getPopulation()));
		}
So I'm really suggesting we change it to:
Code:
if (isCapital())
		{
			bGrowMore = (getPopulation() < (3 * (std::max(1,(int)GET_PLAYER(getOwnerINLINE()).getCurrentEra()))));
		}
		else
		{
			bGrowMore = ((getPopulation() < (3 * (std::max(1,(int)GET_PLAYER(getOwnerINLINE()).getCurrentEra())))) && (AI_countGoodTiles(true, false, 100) >= getPopulation()));
		}
It makes sense to me to have a minimum population to build settlers.

But where this code may be interacting with worker production is another issue entirely and may explain why one of the civs in the screenshots recently was having a tough time building workers.
 
This affects workers also see the BBAI NOTE and i don't think the era should be used in that calculation.


Here is the complete K-Mod code merged into ours i missed a few lines at the end.
Code:
	if (!tempCriteria.m_bIgnoreGrowth && foodDifference(true, true) > 0)
	{
		// BBAI NOTE: This is where small city worker and settler production is blocked
		// TB Interpret Note: bGrowMore must be FALSE for cities to queue settlers!
		// This was basically saying that if the city has more population than improved tiles then it won't build settlers!
		if (GET_PLAYER(getOwnerINLINE()).getNumCities() <= 2 || isBarbarian())
		{
			/* original bts code
			bGrowMore = ((getPopulation() < 3) && (AI_countGoodTiles(true, false, 100) >= getPopulation())); */
			// K-Mod. We need to allow the starting city to build a worker at size 1.
			bGrowMore = (eUnitAI != UNITAI_WORKER || GET_PLAYER(getOwner()).AI_totalAreaUnitAIs(area(), UNITAI_WORKER) > 0)
				&& getPopulation() < 3 && AI_countGoodTiles(true, false, 100) >= getPopulation();
			// K-Mod end
		}
		else
		{
			bGrowMore = ((getPopulation() < 3) || (AI_countGoodTiles(true, false, 100) >= getPopulation()));
		}

		if (!bGrowMore && (getPopulation() < 6) && (AI_countGoodTiles(true, false, 80) >= getPopulation()))
		{
			if ((getFood() - (getFoodKept() / 2)) >= (growthThreshold() / 2))
			{
				if ((angryPopulation(1) == 0) && (healthRate(false, 1) == 0))
				{
					bGrowMore = true;
				}
			}
		}
		//K-Mod
		else if (bGrowMore)
		{
			if (angryPopulation(1) > 0)
				bGrowMore = false;
		}
		// K-Mod end
	}

I suggest to try this in a few Autoplays to see if it makes a difference. Since improved Tiles are used in the calculátion, not or late building of improvements could be a issue. If this change allows earlier workers it could have an possitive effect. I can't do this at the moment because of my current work to improve turn times.
 
I just tried the K-Mod change and settlers get built but it seems alot of them where killed. Defending them could be a problem for the AI but i need to test this again to be sure.
 
Yeah try it out for a bit. But if you look carefully you can see there's some problems with the logic still. If the workers are doing really well and improving 'too much' of the land it will keep settlers from being built.

Apparently bGrowMore must be false for settlers to build and must be true for workers to build and considering that I usually build both settlers and workers out of the same city and right around the same time I have a problem with this logic at the core. I'm thinking it sets unreasonable limitations on both that should be rethought out. Again, the reason for using era was to base the city size prereq for the city feeling right to build a settler to be based on what should be a minimum city size for the era - the later the game gets the more the city should be built up before setting a settler to build as the more valuable the population and its uses are above new cities.
 
Are you sure about bGrowMore i think it only set's if units produced with food should be built or not.
 
Are you sure about bGrowMore i think it only set's if units produced with food should be built or not.

I didn't try reading the whole picture (well I did but it got a little confusing) but had mostly gone on results from changes and watching how those changes adjusted the AI's actions on test games. If that's what its all about ... ugh... that would impact all those units that are being built with food on early civics too then right?

All I can really say is that bGrowMore needed to end up false for the city to order the building of a settler is how it appeared to behave.
 
Exactly and the real choice what to build is made in CvCityAI::AI_chooseProduction().
 
But there were many cases where civs that should be growing weren't because all their cities were coming up with bGrowMore as true. All decision points in AI_chooseProduction() were leading to settlers but the settlers were not being built which led to adjusting this section here to free them up.

(I just looked at the code again and yeah, reading maps... not my strength.)
 
Ok, so after some consideration in light of the discussion so far, the line I think was giving trouble was:
Code:
		else
		{
			bGrowMore = ((getPopulation() < 3) || (AI_countGoodTiles(true, false, 100) >= getPopulation()));
		}
in particular:
(AI_countGoodTiles(true, false, 100) >= getPopulation()));

This is meaningful for workers. Why should we need more workers if our land is already developed beyond the amount of population for that city... it's a good indication we've got enough already. At least there.

But for settlers this is entirely wrong and can bind up civs that have gotten at all ahead of their own game. I'd at least suggest to make this particular line nullified if we're looking at a settler build. However, it would make even less sense for military units if all units are built with food under the civics you're on. So perhaps making this portion of the OR statement ONLY apply to workers would be wise.

Everything else under close consideration actually does make a lot of sense. I'd almost be tempted to also include a line that asks if the city is within a few turns of a pop growth and if it is make bGrowMore true after these checks. This is one of the things I do as a player that may give an edge over the AI.


EDIT: Only problem with that last thought though is how it would interact with the brokerage structure... we're not just looking at the determination being made here affecting only the city being evaluated and in many ways it should be a check made on the city that's been given the call to train the unit, not the one saying one should be trained. That would take a much more significant restructuring.
 
This is meaningful for workers. Why should we need more workers if our land is already developed beyond the amount of population for that city... it's a good indication we've got enough already. At least there.

It's more about letting the City Grow before using food to build units. The choice what to build is made later so restructuring could be alot work and cause other problems. Even if you change it to be false if a city is close to grow it won't help much it because it would only enable them to build them a few turns earlier. If they even decide to build a Settler and after the Settler is built they have to decide to found a City but if they don't that change has no impact.

There are alot other things to consider before changing that around.
It's about food and city growth so for some reason the AI players don't get enough food. Maybe they should do more hunting and if their hunters get killed it could hurt them alot. The same goes for impovements and withdrawing animals could reduce the food income and so on.............
 
Ok now i have a completely different theory Techs are to cheap and this hurts the AI alot.

I changed iResearchPercent from 750 to 1250 for the Snail Gamespeed.

After 500 turns one AI plaver has 3 Cities a few others 2 and the rest still 1 and they start building Tribes as soon as they can. Before after 500 turns all of them had only 1 city.
 
Ok now i have a completely different theory Techs are to cheap and this hurts the AI alot.

I changed iResearchPercent from 750 to 1250 for the Snail Gamespeed.

After 500 turns one AI plaver has 3 Cities a few others 2 and the rest still 1 and they start building Tribes as soon as they can. Before after 500 turns all of them had only 1 city.

Besides that... nothing is worse that playing with the techs coming so much faster than buildings. Ugh! I can see how that would play a role for them too.
 
Ok now i have a completely different theory Techs are to cheap and this hurts the AI alot.

I changed iResearchPercent from 750 to 1250 for the Snail Gamespeed.

After 500 turns one AI plaver has 3 Cities a few others 2 and the rest still 1 and they start building Tribes as soon as they can. Before after 500 turns all of them had only 1 city.

Besides that... nothing is worse that playing with the techs coming so much faster than buildings. Ugh! I can see how that would play a role for them too.

This is what techs do makes come fast or slow, BUT this is not what was changed. it was something in the dll that ALMOST does the same thing "someplace" in there.
 
This is what techs do makes come fast or slow, BUT this is not what was changed. it was something in the dll that ALMOST does the same thing "someplace" in there.

I have to check the Tech Diffusion code again. I merged changes from AND maybe i made an error.
 
Back
Top Bottom