Post Feb 1st 2013 - bugs - Single Player

Status
Not open for further replies.
Fair point. How about if we do what you suggest but ALSO make it so that a successful bribe of a city also bribes a proportion of the units in it (say 30% chance for each unit, perhaps modified by the rev index of the city being bribed?)

OK, I've done the fix for the building tag now. I'm also going to discuss in the Balance thread increasing :gold: costs for spy missions that cost :gold:, as they aren't really up to C2C standards from what I can tell.
 
OK, I've done the fix for the building tag now. I'm also going to discuss in the Balance thread increasing :gold: costs for spy missions that cost :gold:, as they aren't really up to C2C standards from what I can tell.

Ok, though I think it is important to ALSO make sure that some units get bribed along with the city, or else this change makes the mission semi-useless in most situations, unless employed when NOT at war. If it isn't already (it might be) the mission cost should also be influenced by how many units are stained in the city (and ideally its local rev index if REV is on)
 
Ok, though I think it is important to ALSO make sure that some units get bribed along with the city, or else this change makes the mission semi-useless in most situations, unless employed when NOT at war. If it isn't already (it might be) the mission cost should also be influenced by how many units are stained in the city (and ideally its local rev index if REV is on)

I'd do that if I knew what numbers would be appropriate for the revindex, and understood more about spy missions internally.
 
I'd do that if I knew what numbers would be appropriate for the revindex, and understood more about spy missions internally.

Dunno - you'd need to look at examples to get a feel for good numbers I think, but put the code in with conservatives coefficients and we can tweak from there I'd say.
 
Dunno - you'd need to look at examples to get a feel for good numbers I think, but put the code in with conservatives coefficients and we can tweak from there I'd say.

That looks rather hard to do. The way the Bribe City mission works is that at the end it calls the acquireCity method, which will kick out any units in the city. Since then those units are in a different plot I'm not sure how to a) figure out which plot they went to, and b) convert their allegiance. I could destroy the old units and make new ones that are a copy of the destroyed old ones, but that still doesn't solve issue a. What do you think I should do there?
 
Also, I'm getting a bug when I try and invoke the Abandon City manager with Ctrl-A (to get rid of some buildings). Here is the pythonerror log.

Code:
Traceback (most recent call last):
  File "BugEventManager", line 378, in _handleConsumableEvent
  File "BugEventManager", line 466, in onKbdEvent
  File "BugUtil", line 608, in __call__
  File "BugUtil", line 605, in call
  File "AbandonCityEventManager", line 116, in onStartAbandonCity
  File "AbandonCityEventManager", line 175, in onStartAbandonCity
  File "CvEventManager", line 194, in beginEvent
  File "AbandonCityEventManager", line 225, in __eventAbandonCityDestroyBuildingBegin
IndexError: list assignment index out of range
Traceback (most recent call last):
  File "BugEventManager", line 378, in _handleConsumableEvent
  File "BugEventManager", line 466, in onKbdEvent
  File "BugUtil", line 608, in __call__
  File "BugUtil", line 605, in call
  File "AbandonCityEventManager", line 116, in onStartAbandonCity
  File "AbandonCityEventManager", line 175, in onStartAbandonCity
  File "CvEventManager", line 194, in beginEvent
  File "AbandonCityEventManager", line 225, in __eventAbandonCityDestroyBuildingBegin
IndexError: list assignment index out of range
 
Also, I'm getting a bug when I try and invoke the Abandon City manager with Ctrl-A (to get rid of some buildings). Here is the pythonerror log.

Code:
Traceback (most recent call last):
  File "BugEventManager", line 378, in _handleConsumableEvent
  File "BugEventManager", line 466, in onKbdEvent
  File "BugUtil", line 608, in __call__
  File "BugUtil", line 605, in call
  File "AbandonCityEventManager", line 116, in onStartAbandonCity
  File "AbandonCityEventManager", line 175, in onStartAbandonCity
  File "CvEventManager", line 194, in beginEvent
  File "AbandonCityEventManager", line 225, in __eventAbandonCityDestroyBuildingBegin
IndexError: list assignment index out of range
Traceback (most recent call last):
  File "BugEventManager", line 378, in _handleConsumableEvent
  File "BugEventManager", line 466, in onKbdEvent
  File "BugUtil", line 608, in __call__
  File "BugUtil", line 605, in call
  File "AbandonCityEventManager", line 116, in onStartAbandonCity
  File "AbandonCityEventManager", line 175, in onStartAbandonCity
  File "CvEventManager", line 194, in beginEvent
  File "AbandonCityEventManager", line 225, in __eventAbandonCityDestroyBuildingBegin
IndexError: list assignment index out of range

That means that there is something wrong with one of the building definitions somewhere.
Code:
if (iType > 0 and pHeadSelectedCity.getNumRealBuilding(iType) > 0 and not isLimitedWonderClass(gc.getBuildingInfo(iType).getBuildingClassType()) and not gc.getBuildingInfo(iType).getGlobalReligionCommerce() > 0):
	# Only put non-free buildings in the list
	if (not pPlayer.isBuildingFree(iType) and gc.getBuildingInfo(iType).getProductionCost() != -1):
		buildingList[i] = (gc.getBuildingInfo(iType).getDescription(), iType)

The code checks that the building is valid but there must be something strange about the building description. Which is the text or human readable version of the building name.
 
That looks rather hard to do. The way the Bribe City mission works is that at the end it calls the acquireCity method, which will kick out any units in the city. Since then those units are in a different plot I'm not sure how to a) figure out which plot they went to, and b) convert their allegiance. I could destroy the old units and make new ones that are a copy of the destroyed old ones, but that still doesn't solve issue a. What do you think I should do there?

Pass a new int extra param to acquireCity that tells it the probability of a unit being kicked out (default = 100). For values < 100 generate an appropriate random number to see if each unit is booted (might also need a bSync param to indicate whether to use sync or async rand number generator if that info is not already there). Any unit that is not booted, clone it to the new owner and destroy the original (same as gifting units does but without changing the location). For city acquisition via the spy mission pass a probability les than 100% (leave other instances as they are passing 100 by default)
 
That means that there is something wrong with one of the building definitions somewhere.
Code:
if (iType > 0 and pHeadSelectedCity.getNumRealBuilding(iType) > 0 and not isLimitedWonderClass(gc.getBuildingInfo(iType).getBuildingClassType()) and not gc.getBuildingInfo(iType).getGlobalReligionCommerce() > 0):
	# Only put non-free buildings in the list
	if (not pPlayer.isBuildingFree(iType) and gc.getBuildingInfo(iType).getProductionCost() != -1):
		buildingList[i] = (gc.getBuildingInfo(iType).getDescription(), iType)

The code checks that the building is valid but there must be something strange about the building description. Which is the text or human readable version of the building name.

It doesn't say, it gives a generic error with the event handler at a specific point in memory.
 
Ive noticed a annoying bug in the DynamicCivnames mod,it only goes from tribe to city-state to empire and stays there.
 
Workers again?? I dont know if your last change will effect CURRENT games, but it looks like for some reason or another ALOT of improvements are STILL not being dont. In the pic, i have like 5-8 improvements waiting for workers to build, but the workers just sit there doing nothing?? And some just roam around doing nothing??
I tested the red circled worker for 10 extra turns and it just SAT there doing absolutely nothing??

SVN 4742, no viewports.

At first I didn't find too much wrong here, apart from a slight inconsistency , which I will fix. Several of the bonuses you highlight are invisible to the AI (doesn't have the tech). Of the others, all of those up near your fort are on what the AI considers dangerous tiles (due to your presence), so it requires an escort with the worker to go and improve them. It currently has 2 workers in the area. The one to the south is busy (routing to the NE city). The one just south of your fort, on the poultry tile, wants to improve the poultry but is waiting for an escort because of the danger. The inconsistency is that the first danger evaluation it does (to see whether it is currently safe) doesn't take account of all the factors that the later check (on danger in the place we want to work) does. Net result is that the first check passes (it doesn't feel the need to retreat), but the second fails (so it wants an escort before doing any work). This makes no sense since it results in it sitting on the tile it wants to work anyway, just doing nothing while it waits for an escort. I will modify things to make the first danger check use the same code as the second. The net result should be that it retreats to the nearest city, waits for an escort, then moves back with a protective escort and improves the poultry - I'll check that it does indeed happen that way once I've fixed the inconsistency.

Why it hadn't improved the deer resource previously I couldn't say (maybe it only appeared in a recent migration event or something?)

Edit - well, after the inconsistency fix it retreated as expected, but then changed its mind and decided to route to another city instead of improving the bonus (which should be a higher priority). Finally pinned down the cause to be a fairly systemic bug in many worker AI routines as follows:

Once it identifies a target it wants to move to (to improve or whatever), it then performs a safety check to see if it needs an escort. If it does, it requests one and waits, else it goes alone.

HOWEVER, the code that was identifying the potential target BEFORE this step was using pathing flags that cause the path generator to only consider moving through plots where there is no danger, if the group in question has no ability to defend (so including lone worker groups). This meant that it never FOUND the target (because it couldn't generate a danger-free path to it) and so never got round to the escort check! All worker path generation that is followed by a needs-escort check should instead be using a pathing flag to skip this danger-checking during path generation. That is now also fixed (or will be when I push my next changes). After the fix it retreats, waits for an escort then actually goes and improves the stone before the poultry (as that is regarded as more valuable)

There is still one more flaw I noticed in debugging this save, which is that route-to missions are not correctly checking for an escort being needed up front, when the route goes through neutral territory. This is probably causing some loss of workers that shouldn't be happening (to stray animals). I'll look at addressing that another day.

Edit 2 - still tidying up some details - won't hit the SVN until tomorrow now.
 
Edit - well, after the inconsistency fix it retreated as expected, but then changed its mind and decided to route to another city instead of improving the bonus (which should be a higher priority). Finally pinned down the cause to be a fairly systemic bug in many worker AI routines as follows:

Once it identifies a target it wants to move to (to improve or whatever), it then performs a safety check to see if it needs an escort. If it does, it requests one and waits, else it goes alone.

HOWEVER, the code that was identifying the potential target BEFORE this step was using pathing flags that cause the path generator to only consider moving through plots where there is no danger, if the group in question has no ability to defend (so including lone worker groups). This meant that it never FOUND the target (because it couldn't generate a danger-free path to it) and so never got round to the escort check! All worker path generation that is followed by a needs-escort check should instead be using a pathing flag to skip this danger-checking during path generation. That is now also fixed (or will be when I push my next changes). After the fix it retreats, waits for an escort then actually goes and improves the stone before the poultry (as that is regarded as more valuable)

Great work on that fix Koshling. Sounds like it could have a major impact! :banana:

ETA: On the subject of AI evaluating danger, I would just like to mention invisible units. I have had neighbours who just don't build camo or dog units, and my rogues and ambushers (didn't have assassins yet) have an absolute picnic with their workers. In such cases, it makes evaluating the danger for AI workers much much harder (I suppose)...
 
there is a bug message that comes up at the start of a game "Cant find XML for HeroicPromotions". There is a config file called HeroicPromotion. Who ever it belongs to I suggest you change them to the same spelling.
 
there is a bug message that comes up at the start of a game "Cant find XML for HeroicPromotions". There is a config file called HeroicPromotion. Who ever it belongs to I suggest you change them to the same spelling.
Spoiler :

Traceback (most recent call last):
File "BugConfig", line 110, in unknown_endtag
File "BugConfig", line 334, in endChild
File "BugConfig", line 337, in end
File "BugConfig", line 318, in process
File "BugConfig", line 565, in handle
File "BugUtil", line 643, in getFunction
File "BugUtil", line 632, in lookupFunction
ConfigError: Module 'HeroicPromotion' must define function or class 'onUnitPromoted'. .
 
there is a bug message that comes up at the start of a game "Cant find XML for HeroicPromotions". There is a config file called HeroicPromotion. Who ever it belongs to I suggest you change them to the same spelling.

Spoiler :
ConfigError: Module 'HeroicPromotion' must define function or class 'onUnitPromoted'

Hope this works, i removed the above line in Config file?? Nope:sad:

Now i get this:

Traceback (most recent call last):
File "BugEventManager", line 363, in _handleDefaultEvent
File "HeroicPromotion", line 36, in onCombatResult
NameError: global name 'pUnit' is not defined

EDIT: on the above: I removed this, i hope this is what it is talking about, DH????

Spoiler :
Code:
## AI Promotion ##
	pPlayer = gc.getPlayer(pUnit.getOwner())
	if not pPlayer.isHuman():
		if CyGame().getSorenRandNum(5, "Platy Promotion") == 0:
			iPromo = gc.getInfoTypeForString("PROMOTION_HEROIC2")
			pUnit.setHasPromotion(iPromotion, false)
			if pUnit.canAcquirePromotion(iPromo):
				pUnit.setHasPromotion(iPromo, true)
			else:
				pUnit.setHasPromotion(iPromotion, true)
## AI Promotion ##


Also going through some other python i noticed this, is more info needed??

Spoiler :
Code:
giSlaveryCivic = -1
giMercenaryCivic = -1
giBanditCivic = -1
giDomainLand = -1
giUnitAnimal = -1
giUnitCanine = -1
giUnitCaptiveMilitary = -1
giUnitCaptiveCivilian = -1

def init():
	global giSlaveryCivic, giMercenaryCivic, giBanditCivic, giDomainLand, giUnitAnimal, giUnitCanine,  giUnitCaptiveMilitary, giUnitCaptiveCivilian
	
	giSlaveryCivic = gc.getInfoTypeForString('CIVIC_SLAVERY')
	giMercenaryCivic = gc.getInfoTypeForString('CIVIC_MERCENARIES')
	giBanditCivic = gc.getInfoTypeForString('CIVIC_BANDITRY')
	giDomainLand = gc.getInfoTypeForString('DOMAIN_LAND')
	giUnitCaptiveMilitary = gc.getInfoTypeForString('UNITCLASS_CAPTIVE_MILITARY') 
	giUnitCaptiveCivilian = gc.getInfoTypeForString('UNITCLASS_CAPTIVE_CIVILIAN') 
	giUnitAnimal = gc.getInfoTypeForString('UNITCOMBAT_ANIMAL')
	giUnitCanine = gc.getInfoTypeForString('UNITCOMBAT_CANINE')

EDIT EDIT: I have it now! Yeah:rolleyes:
 
I'll take a look at it and see if this one reproduces for me. The option you suggest is possible, but I don't really want to go there, since it wouldn't help the AI (which uses basically the same assessments for attacks generally), so we really need to find and fix the underlying cause rather than hide it.


The barbarian AI update of svn 4757, solve this issue?
 
AI doesn't attack cities without defenders?
I remove all the defenders with a rogue, barbarians are near the city, or another minor civ comes with a hunter, but they just sit there and don't take the city.
 
AI doesn't attack cities without defenders?
I remove all the defenders with a rogue, barbarians are near the city, or another minor civ comes with a hunter, but they just sit there and don't take the city.

With the current SVN this has been fixed, thx. Also when reporting errors and bug, please EVERYONE look at post # 1 FIRST, thx.
 
Status
Not open for further replies.
Back
Top Bottom