Post Feb 1st 2013 - bugs - Single Player

Status
Not open for further replies.
@Hydro

I did what you sugested and it works but such bug spoil gameplay.

If some building (werehouse) replace other building (storage pit) it is very logical
that this new one should act as old one in other buildings requirements.

I suggest that building requirements code need some tweaks to include buildings upgrade chain.

Although other buildings do indeed support it, I tend to agree hat if A is an upgrade over B then A should really support at last what B does. However, this creates a lot of work for the XML modders. I **could** fairly easily change the DLL to make this automatic (and have it auto-reflect in the pedia entries), if the XML modders want it to work that way...
 
@Koshling or AIAndy:
I apparently have found this line to have a problem as it seems to be failing to qualify any cities at all for trade routes:
Spoiler :
Code:
		for (int iI = 0; iI < iNumTradeRoutes; ++iI)
		{
			CvCity* pTradeCity = getTradeCity(iI);
			if (pTradeCity && pTradeCity->getOwnerINLINE() >= 0 && (NO_PLAYER == eWithPlayer || pTradeCity->getOwnerINLINE() == eWithPlayer))
			{
				int iTradeYield;

				if (bBase)
				{
					iTradeYield = getBaseTradeProfit(pTradeCity);
				}
				else
				{
// BUG - Fractional Trade Routes - start
#ifdef _MOD_FRACTRADE
					int iTradeProfit = calculateTradeProfitTimes100(pTradeCity);
#else
					int iTradeProfit = calculateTradeProfit(pTradeCity);
#endif
// BUG - Fractional Trade Routes - end
					iTradeYield = calculateTradeYield(YIELD_COMMERCE, iTradeProfit);
				}

				if (pTradeCity->getOwnerINLINE() == ePlayer)
				{
					iCityDomesticYield += iTradeYield;
					iCityDomesticRoutes++;
				}
				else
				{
					iCityForeignYield += iTradeYield;
					iCityForeignRoutes++;
				}
			}
		}

// BUG - Fractional Trade Routes - start
#ifdef _MOD_FRACTRADE
		if (bRound)
		{
			iDomesticYield += iCityDomesticYield / 100;
			iDomesticRoutes += iCityDomesticRoutes / 100;
			iForeignYield += iCityForeignYield / 100;
			iForeignRoutes += iCityForeignRoutes / 100;
		}
		else
#endif
// BUG - Fractional Trade Routes - end
		{
			iDomesticYield += iCityDomesticYield;
			iDomesticRoutes += iCityDomesticRoutes;
			iForeignYield += iCityForeignYield;
			iForeignRoutes += iCityForeignRoutes;
		}
	}
}

In particular, this line itself is the one that never seems to be qualifying a trade route:
Code:
if (pTradeCity && pTradeCity->getOwnerINLINE() >= 0 && (NO_PLAYER == eWithPlayer || pTradeCity->getOwnerINLINE() == eWithPlayer))
in CvCity line 14176.

I'm not quite sure what's wrong here but on first glance, simply using pTradeCity as a condition doesn't seem right does it? Should that be pTradeCity != NO_CITY ? Is this how another programming language allows this kind of check to be made?

I could also be completely off base with my debugging diagnosis here too...

BTW, I'm updating what I have to fix SO's crash which would be affecting anyone with that SVN rev. It's just a stickytape fix though as I suspect the underlying problem may indicate a potential for more (a -1 reference returned in the AI code... check out the revision changes Koshling to see what else may need to be done there. There's a lot going on there I don't know what its all referring to but I was able to create a bypass to the crash at least.)

Using a value in a conditional without explicit comparison operator is the same as 'value != 0'. For pTradeCity (which is a CvCity*) this is equivalent to 'pTradeCity != NULL' and is absolutely correct. When you say that line is causing the problem are you making that statement from having watched the debugger step through it and fail to take the branch on that condition? If not then could you clarify the evidence please - it looks absolutely fine to me.
 
Using a value in a conditional without explicit comparison operator is the same as 'value != 0'. For pTradeCity (which is a CvCity*) this is equivalent to 'pTradeCity != NULL' and is absolutely correct. When you say that line is causing the problem are you making that statement from having watched the debugger step through it and fail to take the branch on that condition? If not then could you clarify the evidence please - it looks absolutely fine to me.

Exactly. I'm finding in the save I'm trying to evaluate that absolutely no cities are being listed as being on a fairly advanced city's trade route. I could not see any cause for this in the game itself and when running through and stepping through the trade establishing portion of the code, this one line appeared to never hit a qualifying condition.

Since I was unsure about what 'Using a value in a conditional without explicit comparison operator' actually meant in the code (though suspected it might mean exactly as you explain but that this might be something that would work for C# but not C++) then I had a suspicion it might've been a culprit but, since I didn't know I figured I'd ask.

However, consider that if it means exactly != 0 then it would be wrong as NO_CITY would mean -1. But if it looks to what is established as the default NULL value in the enums then I can see how it'd come back as -1. (I'm NOT meaning to challenge you or trying to call you out...just trying to learn and fix the program in the process and explaining my thinking to reach the conclusions I have so far. I realize something is wrong with my evaluation somewhere and I'm trying to figure out what!)

Can you see any other reason that perfectly qualified cities would not be able to pull up any trade routes here at all?
 
Although other buildings do indeed support it, I tend to agree hat if A is an upgrade over B then A should really support at last what B does. However, this creates a lot of work for the XML modders. I **could** fairly easily change the DLL to make this automatic (and have it auto-reflect in the pedia entries), if the XML modders want it to work that way...

This is what Kael and I talked about in small detail back in 2007. He suggested at first to leave as much in the XML and Python as possible. That way it is easier for regular modders to change things around and make things better.
The only reason to put things into the dll is for performance, or if things are NOT working correctly and just cant be fixed in other terms, THEN put it into the dll, i hope this makes some sense.
 
@Hydro

I did what you sugested and it works but such bug spoil gameplay.

If some building (werehouse) replace other building (storage pit) it is very logical
that this new one should act as old one in other buildings requirements.

I suggest that building requirements code need some tweaks to include buildings upgrade chain.

Although other buildings do indeed support it, I tend to agree hat if A is an upgrade over B then A should really support at last what B does. However, this creates a lot of work for the XML modders. I **could** fairly easily change the DLL to make this automatic (and have it auto-reflect in the pedia entries), if the XML modders want it to work that way...

When I mentioned the same thing about storage pits and granary I got the same reply. Basically there is no early version of the barter hut/trading post so stuff was put on the storage pit. What is really needed is a commerce meeting place that comes very early and can be used in place of the storage pit. Can't be the fire pit since that goes obsolete far to early.
 
Are units not getting any gold etc from plundering resources anymore, i just pillaged a pumpkin patch and i got nothing for doing so??

DH

is there something special here on the Pumpkins, because i just looked and the rest do give me gold for destroying their resources??
 
The trappers/trackers/explorers etc are all back to the way they used to be?? They hardly ever go outside the realm of your area, and if so lately, not that far?? At least before they roamed around everywhere, not so much anymore for some reason???

This turned out to be fairly interesting. There were two issues.

  1. You have a great general stacked with a hunter. The AI doesn't normally stack like this and if it did then the GG AI would be in charge. The net effect of this is that the lead unit is the GG, which cannot attack. The hunt routine was using a canAttack() check on the unit running the AI, rather than on the stack as a whole, so when it found something to attack it decided it couldn't because it was a great general. I've fixed the code to check the group not the unit. This could only happen to the human player using the automation.
  2. The explore AI (which the hunt AI uses when it cannot find an immediate hunt target) assigns a value to going to plots that are NEXT TO enemy units whose attack should be survivable. This is to encourage hunters and scouts to park themselves next to enemies to tempt them to attack, since that generally gives better odds than a direct attack (sometimes even if you can attack, which things like scouts cannot). This code was not considering the fact that animals cannot cross borders, so it was parking itself next to an animal but inside its own territory expecting to be attacked (which of course never happens). I will add the animal&border crossing check.

I've also made some other adjustments:
  • The 'stand on a tile next to an enemy so he attacks us' technique was only being applied if there was a SINGLE adjacent enemy. I have enabled it for multiples provided the overall probability of survival is suitable
  • When looking for enemies to attack directly in the hunting AI it also checked how many other enemies were around the target plot, so as not to leave itself exposed after the attack. This check was rather crude and based only on the number of units (net effect that a single hunter wouldn't attack an animal that had more than one other animal next to it, but it wouldn't care if the adjacent animals was a duck or a mammoth). I have also adjusted this check to evaluate actual survival probabilities appropriately instead of looking at unit counts.

Should be pushed to SVN later today.
 
This turned out to be fairly interesting. There were two issues.

Should be pushed to SVN later today.

Wholly Molly no wonder the AI/single player (automated) was so darn confused.:crazyeye: I really hope it works way better now, thx for the again great explanation of terms and info.
 
I **could** fairly easily change the DLL to make this automatic (and have it auto-reflect in the pedia entries), if the XML modders want it to work that way...

I suppose that SO say yes for that change. Please do that it will make live more easier and put some logic to the upgrade chains.
 
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.
 
In my current game on the GEM no-preset map when conquering a city I'm not being asked if I want to raze or install a new governor, I just get the city (This may be a game setting I have missed, I'm not entirely sure).
With rev 4742 I can't open the dialog to sell buildings or abandon cities with the following from pythonerror.log

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
 
@Hydro

I did what you sugested and it works but such bug spoil gameplay.

If some building (werehouse) replace other building (storage pit) it is very logical
that this new one should act as old one in other buildings requirements.

I suggest that building requirements code need some tweaks to include buildings upgrade chain.

Should not matter now. I made a chnage that allows the Barter Post, Trading Post and Shopping Center auto-build. So the Barter Post should auto build before you reach the tech that enables the Warehouse.
 
yes, the turn after the save the rogue attacks, what configuration of auto hunt you use?

The same problem with ambushers, can you see Koshling?

In egypt again. I suggest the creation of a option in bug options where the auto hunt dont enter the borders of another civs, its possible?

Below, the save of turn.
 

Attachments

In my current game on the GEM no-preset map when conquering a city I'm not being asked if I want to raze or install a new governor, I just get the city (This may be a game setting I have missed, I'm not entirely sure).
Yeah, there's a game start setting to not have that option to raze a city, which is actually recommended for a GEM game (and may be set as default there? idk).


I wonder though, how is performance for you on the GEM game? It's pretty abysmal for me...
 
I wonder though, how is performance for you on the GEM game? It's pretty abysmal for me...

I personally wont play a GEM map, because of the turn times, and i have a Double Graphics Card and really a darn good PC to boot. But the lag times it still way to much for me, and thats on Marathon.:(

If in the PreH Era it takes over 15 seconds, i wont play.
 
Yeah, there's a game start setting to not have that option to raze a city, which is actually recommended for a GEM game (and may be set as default there? idk).


I wonder though, how is performance for you on the GEM game? It's pretty abysmal for me...

If you have an illustrative end turn that is slow post the save and I'll at least run a profile on it to see if here are obvious bottlenecks to look at.
 
Status
Not open for further replies.
Back
Top Bottom