useless AI in svn version

We can't say that not building settlers would have nothing to do with stalled growth - it certainly can. But in this case we've eliminated that as the problem.

You're right about everything you say... it could have to do with the brokerage system failing in some way or being overly cautious. I'm less suspicious of the brokerage stuff though because it does seem to be working for other areas - but if it's the source of the issue then it's a much bigger problem with deeper implications in many other areas.

I was bored from working on the new Schema-Validation so i gave this another try.

ContractFloatingDefenders has the highest priority(CITY_BUILD_PRIORITY_CEILING) when looking for Units, Settlers requesting a Unit as escort only HIGH_PRIORITY_ESCORT_PRIORITY.

If a Unit is build because of a Settlers request it's possible that the CityDefence get's that Unit and the Settler waits. Also the AI seems to scrap Settlers if they have nothing to do after a while so this could be a huge possible problem.

I do some more testing but i think i simply give settlers CITY_BUILD_PRIORITY_CEILING then looking for a escort.
 
I do some more testing but i think i simply give settlers CITY_BUILD_PRIORITY_CEILING then looking for a escort.

Sounds like a plan. And btw thx for all the hard work you are doing and helping in:goodjob:
 
I find it strange that the AI seems unable to take out barbrain cities which might stop expansion too
 
In my latest game the AI has manged to capture some barbarian cities, but seems to have stopped now. It also seems that civs that form from barbarian cities are better at taking barbarian cities than civs which are there from the start.

I think the biggest problem is the maintainence difference between chiefdom and anarchy. Most AIs are stuck on 3 cities in my game, one has 4, I have 5.
 
I was bored from working on the new Schema-Validation so i gave this another try.

ContractFloatingDefenders has the highest priority(CITY_BUILD_PRIORITY_CEILING) when looking for Units, Settlers requesting a Unit as escort only HIGH_PRIORITY_ESCORT_PRIORITY.

If a Unit is build because of a Settlers request it's possible that the CityDefence get's that Unit and the Settler waits. Also the AI seems to scrap Settlers if they have nothing to do after a while so this could be a huge possible problem.

I do some more testing but i think i simply give settlers CITY_BUILD_PRIORITY_CEILING then looking for a escort.

Ok giving those Settler requests for a escort that high priority has an effect. But i'am not happy with the result because in some cases it leads to even more CityDefenders.

The next thing i try is adding a new UnitAI type for those Settler escorts.
 
Ok giving those Settler requests for a escort that high priority has an effect. But i'am not happy with the result because in some cases it leads to even more CityDefenders.

The next thing i try is adding a new UnitAI type for those Settler escorts.

While that's really not a bad idea, (very good idea actually) why is it a bad thing that they're finally getting more city defenders? This was one of their major weaknesses too that they wouldn't get enough of them wasn't it?

What I've seen in regards to 'too many' city defenders is actually 'too much' law enforcement. They seem to really like law enforcement units as city defenders and to me they make horrible city defenders - while they help in that regard they should be built for their purpose and city defense should be selecting only that which is militarily most effective.

Furthermore, it needs to have multiple city defender types. If they don't stock some axes and spears along with their archers, for example, they're missing out on some strong opportunities to bolster their defense and leaving themselves open to forces heavily specialized in taking down archery units. So far as I've seen it goes for the 'best' in an evaluation process and that 'best' is always the same for whatever tech level they are at, with no consideration for what's already a part of the defensive stack plan.

Still... you're hitting on the concept I've been mulling over for quite some time now, which is to have a lot more AI defines to help the AI build for a LOT more depth of purpose and strategy. (And since you're breaking ground here I will have some questions for you as to how we can get some elements of that up and running once I turn to this project - which I hope will dominate the next development cycle for me.)

Also... very cool that you're change had an impact. Makes me now wonder if there are some mysteries (and possibly other minor bugs) to be worked out regarding the brokerage system in general...
 
I don't mean law enforcement because such units aren't possible in the early ancient era. Did you also count the Units with UNITAI_CITY_DEFENSE the AI put's on plots around the city?

I havent done much gaming myself in the last weeks so i might be wrong about too much CityDefenders. Maybe i just put this change in the svn and wait how it turns out.



EDIT:

Here is a example what i call too much, these are the unit counts of a random player from a recent autoplay session.
[1024.021] Tribe (UNITAI_SETTLE): 1
[1024.021] Gatherer (UNITAI_WORKER): 1
[1024.021] Hunter (UNITAI_ATTACK): 1
[1024.021] Hunter (UNITAI_HUNTER): 1
[1024.021] Stone Maceman (UNITAI_CITY_DEFENSE): 9
[1024.021] Stone Maceman (UNITAI_CITY_COUNTER): 1
[1024.021] Stone Axeman (UNITAI_CITY_DEFENSE): 10
[1024.021] Stone Axeman (UNITAI_CITY_COUNTER): 1
[1024.021] Atlatlist (UNITAI_CITY_DEFENSE): 10
[1024.021] Tribal Guardian (UNITAI_CITY_DEFENSE): 1
[1024.021] Rogue (UNITAI_SPY): 1
 
Thanks to 45°38'N-13°47'E for finding the change causing this issue:goodjob:


@thunderbrd
It is caused by a change you made in CvUnitAI::AI_update and the 'else if' added by myself.

Code:
	//Safely escape the Occasional an inf loop here.

	if (m_iLastUnitUpdated != m_iID)
	{
		m_iLastUnitUpdated = m_iID;
		m_iSameUnitUpdateCount = 0;
	}
	else if (m_iSameUnitUpdateCount > 0 && 
		((m_contractualState == CONTRACTUAL_STATE_AWAITING_ANSWER || m_contractualState == CONTRACTUAL_STATE_AWAITING_WORK) || 
		(m_contractualState == CONTRACTUAL_STATE_NONE && getGroup()->getMissionType(0) == -1)))
	{
		m_iSameUnitUpdateCount = 0;
		getGroup()->pushMission(MISSION_SKIP);
		return false;
	}
	else
	{
		m_iSameUnitUpdateCount++;
		if (m_iSameUnitUpdateCount > 99)
		{
			FAssertMsg(m_iSameUnitUpdateCount <= 99, "A Unit has hit an infinite loop in its AI and triggered a loop escape");
			m_iSameUnitUpdateCount = 0;
			getGroup()->pushMission(MISSION_SKIP);
			return false;
		}
	}

I don't remember why we added this but it has to go.
 
I don't mean law enforcement because such units aren't possible in the early ancient era. Did you also count the Units with UNITAI_CITY_DEFENSE the AI put's on plots around the city?

I havent done much gaming myself in the last weeks so i might be wrong about too much CityDefenders. Maybe i just put this change in the svn and wait how it turns out.



EDIT:

Here is a example what i call too much, these are the unit counts of a random player from a recent autoplay session.
Actually that example looks about right though it's odd that spearmen aren't being built as part of that group.

Yeah, I'm NOT happy with how the AI sends city defense units to hang out outside its cities. If we want local regional defenders that will take terrain defensive roles outside the city then they should be their own AI role, not City Defense! This is currently one of the big weaknesses of the AI I think.

Thanks to 45°38'N-13°47'E for finding the change causing this issue:goodjob:


@thunderbrd
It is caused by a change you made in CvUnitAI::AI_update and the 'else if' added by myself.

Code:
	//Safely escape the Occasional an inf loop here.

	if (m_iLastUnitUpdated != m_iID)
	{
		m_iLastUnitUpdated = m_iID;
		m_iSameUnitUpdateCount = 0;
	}
	else if (m_iSameUnitUpdateCount > 0 && 
		((m_contractualState == CONTRACTUAL_STATE_AWAITING_ANSWER || m_contractualState == CONTRACTUAL_STATE_AWAITING_WORK) || 
		(m_contractualState == CONTRACTUAL_STATE_NONE && getGroup()->getMissionType(0) == -1)))
	{
		m_iSameUnitUpdateCount = 0;
		getGroup()->pushMission(MISSION_SKIP);
		return false;
	}
	else
	{
		m_iSameUnitUpdateCount++;
		if (m_iSameUnitUpdateCount > 99)
		{
			FAssertMsg(m_iSameUnitUpdateCount <= 99, "A Unit has hit an infinite loop in its AI and triggered a loop escape");
			m_iSameUnitUpdateCount = 0;
			getGroup()->pushMission(MISSION_SKIP);
			return false;
		}
	}

I don't remember why we added this but it has to go.

I hope we CAN get rid of it safely. It was a temporary solution, an escape to a huge problem with infinitely looping unit AIs that I found myself incapable of finding the root of the problem at the time. It's entirely possible the original problem was solved since then - or perhaps we'll end up finding it again as a result of getting rid of this and be able to tackle it more properly this time.
 
Actually that example looks about right though it's odd that spearmen aren't being built as part of that group.

Yeah, I'm NOT happy with how the AI sends city defense units to hang out outside its cities. If we want local regional defenders that will take terrain defensive roles outside the city then they should be their own AI role, not City Defense! This is currently one of the big weaknesses of the AI I think.

It was changed to be this way and if they move into the city in case of real danger i don't see a problem. I think we could change it so the AI leaves a bit more units in cities and give settlers a stronger escort to have a stronger defense in new cities.


I hope we CAN get rid of it safely. It was a temporary solution, an escape to a huge problem with infinitely looping unit AIs that I found myself incapable of finding the root of the problem at the time. It's entirely possible the original problem was solved since then - or perhaps we'll end up finding it again as a result of getting rid of this and be able to tackle it more properly this time.

We can get rid of it safely because it breaks the game so not having it can't be any worse. If there is another case of infinitely looping there has to be another way to fix it.
 
It was changed to be this way and if they move into the city in case of real danger i don't see a problem. I think we could change it so the AI leaves a bit more units in cities and give settlers a stronger escort to have a stronger defense in new cities.
The problem stems from the units that should be defending cities not getting the benefit of nearly enough of their potential fortification bonus. They move in as soon as they know they need to and if you're fast enough it's too late, particularly later in the game when you're moving in with Commando units. At that stage they don't even have warning enough to know they need to move into the city before you've stolen it out from under them.




We can get rid of it safely because it breaks the game so not having it can't be any worse. If there is another case of infinitely looping there has to be another way to fix it.
Yeah... I'll admit it was a problem that was over my head so I could do little but put this bandaid on it... I'm baffled by how it creates a problem but I've been finding the brokerage system a bit baffling in the first place.

I really will need a better understanding of it soon...
 
There is definitely some improvement in my current game (in terms of AI expansion)
 
Quick thought. Anarchism gives a a-25% maintenance for all cities plus the -90% for the first two.

Chiefdom only gives -25% for all cities.

In order to encourage growth should the maintennace of -25% be removed from Anarchism. So once you go beyond two cities Chiefdom becomes more and more attractive.....
 
The problem stems from the units that should be defending cities not getting the benefit of nearly enough of their potential fortification bonus. They move in as soon as they know they need to and if you're fast enough it's too late, particularly later in the game when you're moving in with Commando units. At that stage they don't even have warning enough to know they need to move into the city before you've stolen it out from under them.

I change the AI code to leave at least two-thirds of their CityDefense in the city instead of the half. The Commando promotion should have a negative CityAttack i think about -20%.
 
I change the AI code to leave at least two-thirds of their CityDefense in the city instead of the half. The Commando promotion should have a negative CityAttack i think about -20%.

Not only do I vehemently disagree that the commando promo be nerfed (due to it already having extremely stringent requirements to reach) but it also wouldn't help. By this time, air units are able to diminish city defenses and the healths of the units within them so severely that 20% wouldn't make much of a difference (unless there were so numerous defenders all under the shelter of the bunker protection that the city offers, that the amount of damage the air units can deliver is diffused greatly among the defensive stack in the city.)

Additionally, we're doing what we can to nerf naval fleet invasions but they still present the same issue, hitting up to 3 cities per round per fleet they catch city defenders outside the city all the time as well, making those cities fall quite easily too.

I can see a point in having maybe 1/4 of the city defense force outside the city - spreads out bombing raid focus and may help in that regard, and keeps some refreshments capable of coming in after bombardment and collateral hits the city and wears down those stationed there. So this might be better at least somewhat. Just seems they lose a lot of power by losing that fortification bonus.
 
The Commando promo's requirements are too stringent. That might be why it is given for free to every single mounted unit starting in prehistoric... Which in turn makes a mockery of the stringent requirements does it not?...

I say mounted units should not have to wait till Mil Sci or whatever tech to get it, but should not get it for free, and indeed have all the current promo prereqs required of them.
 
Not only do I vehemently disagree that the commando promo be nerfed (due to it already having extremely stringent requirements to reach) but it also wouldn't help. By this time, air units are able to diminish city defenses and the healths of the units within them so severely that 20% wouldn't make much of a difference (unless there were so numerous defenders all under the shelter of the bunker protection that the city offers, that the amount of damage the air units can deliver is diffused greatly among the defensive stack in the city.)

Additionally, we're doing what we can to nerf naval fleet invasions but they still present the same issue, hitting up to 3 cities per round per fleet they catch city defenders outside the city all the time as well, making those cities fall quite easily too.

I can see a point in having maybe 1/4 of the city defense force outside the city - spreads out bombing raid focus and may help in that regard, and keeps some refreshments capable of coming in after bombardment and collateral hits the city and wears down those stationed there. So this might be better at least somewhat. Just seems they lose a lot of power by losing that fortification bonus.

If 20% less CityAttack makes no difference then i quess that a few more city defenders might not even matter also. Cases of huge and fast stacks need alot more defense not just few more units and just having the AI build a huge number of city defenders seems wastefull.
 
Top Bottom