Single Player bugs and crashes v36 plus (SVN) - After the 24th of October 2015

Status
Not open for further replies.

Toffer90

C2C Modder
Joined
Oct 16, 2011
Messages
7,918
Location
Norway
Ok the AI is doing better after 180 turns, they can hold there gold mostly and they can keep up with the player better on eternity and deity, good job. I will see in the next 200 turns when they start hunting more if they all build more myths. Shaka is doing good now, also he already build a myth! But i see one problem, the AI cant use the red shield button as it looks like, so the AI is not unsing the tribal guardian to reduce the crime. Better make the tribal guardian directly to give that crime reducing bonus without the need to order him to do so, so the AI will get this bonus and keep crime lvl down. Look screenshots...

AI do use crime fighting with the guardian if crime is high enough to warrant the loss of the fortification combat bonus.
 

Pit2015

Emperor
Joined
Jun 28, 2015
Messages
1,557
Location
Germany
Then it is good, i will look again in 200 turns. ;)
 

calvitix

C2C translation Team
Joined
Mar 23, 2010
Messages
199
Location
France
Hi,

I have an Infinite Loop on my last game. (Save is attached).

After a few investigations, I managed to work around by switching the civ (Using ALT+Z). In debug mode, I get an assert fail on a Group size ,
and discover that there are too many units loaded in a Galleon. see pic.




Unloading them solve the problem, but it appends again ~20 turns later.
 

Attachments

  • Merlin 2117 Loop ap. J.C-Etÿ.CivBeyondSwordSave.7z
    1 MB · Views: 33

Thunderbrd

C2C War Dog
Joined
Jan 2, 2010
Messages
29,197
Location
Las Vegas
Hi,

I have an Infinite Loop on my last game. (Save is attached).

After a few investigations, I managed to work around by switching the civ (Using ALT+Z). In debug mode, I get an assert fail on a Group size ,
and discover that there are too many units loaded in a Galleon. see pic.




Unloading them solve the problem, but it appends again ~20 turns later.

I'll look into this soon.
 

Toffer90

C2C Modder
Joined
Oct 16, 2011
Messages
7,918
Location
Norway
Looks like Krakatoa disrupted the sea placement process here.
Spoiler :
 

Attachments

  • Krakatoa_Sea_Bug.jpg
    Krakatoa_Sea_Bug.jpg
    170.6 KB · Views: 128
Joined
Jul 5, 2004
Messages
23,556
Location
Canberra, Australia
Not Krakatoa doing that. I have found it happening in that shape without Krakatoa being there. I am trying to figure out why. It may be related to the "edge of the world".
 
Joined
Jul 5, 2004
Messages
23,556
Location
Canberra, Australia
Random maps place Coast and Ocean terrains only, so when the map is finished generation I run some code to change it to Polar and Tropical where needed. Before I do that I now run the following code to place Sea on any Ocean plots which are next to Coast plots.
Code:
	terrainCoast = gc.getInfoTypeForString("TERRAIN_COAST")
	terrainSea = gc.getInfoTypeForString("TERRAIN_SEA")
	terrainOcean = gc.getInfoTypeForString("TERRAIN_OCEAN")

	for i in range(mmap.numPlots()):
		iPlot = mmap.plotByIndex(i)

		# Get plot terrain, feature and bonus
		iTerrain = iPlot.getTerrainType()
		iFeature = iPlot.getFeatureType()
		iResource = iPlot.getBonusType(-1)
		
		if iPlot.isWater():
			## Figure out if it is Sea ie if it is ocean next to coast
			if iTerrain == terrainOcean:
				StartX=iPlot.getX()-1
				EndX=iPlot.getX()+2
				StartY=iPlot.getY()-1
				EndY=iPlot.getY()+2
				bTrue = False
				for j in range(StartX, EndX):
					for k in range(StartY,EndY):
						lPlot = CyMap().plot(j,k)
						if lPlot.isNone():continue
						if lPlot.getTerrainType() == terrainCoast:
							bTrue = True
							break
				if (bTrue == True):
					iPlot.setTerrainType(terrainSea,False,False)
					iTerrain = terrainSea

Can you see anything wrong with that?
 

Toffer90

C2C Modder
Joined
Oct 16, 2011
Messages
7,918
Location
Norway
Random maps place Coast and Ocean terrains only, so when the map is finished generation I run some code to change it to Polar and Tropical where needed. Before I do that I now run the following code to place Sea on any Ocean plots which are next to Coast plots.
Spoiler :
Code:
	terrainCoast = gc.getInfoTypeForString("TERRAIN_COAST")
	terrainSea = gc.getInfoTypeForString("TERRAIN_SEA")
	terrainOcean = gc.getInfoTypeForString("TERRAIN_OCEAN")

	for i in range(mmap.numPlots()):
		iPlot = mmap.plotByIndex(i)

		# Get plot terrain, feature and bonus
		iTerrain = iPlot.getTerrainType()
		iFeature = iPlot.getFeatureType()
		iResource = iPlot.getBonusType(-1)
		
		if iPlot.isWater():
			## Figure out if it is Sea ie if it is ocean next to coast
			if iTerrain == terrainOcean:
				StartX=iPlot.getX()-1
				EndX=iPlot.getX()+2
				StartY=iPlot.getY()-1
				EndY=iPlot.getY()+2
				bTrue = False
				for j in range(StartX, EndX):
					for k in range(StartY,EndY):
						lPlot = CyMap().plot(j,k)
						if lPlot.isNone():continue
						if lPlot.getTerrainType() == terrainCoast:
							bTrue = True
							break
				if (bTrue == True):
					iPlot.setTerrainType(terrainSea,False,False)
					iTerrain = terrainSea

Can you see anything wrong with that?
Unless iPlot change its value when you do this: StartX=iPlot.getX()-1
Then this would be a correction:↓
Code:
				StartX=iPlot.getX()-1
				EndX=iPlot.getX()+1
				StartY=iPlot.getY()-1
				EndY=iPlot.getY()+1
I think you were checking to see if any of the plots in a 4x4 plot square were coast (meaning there are 4 plots in the center of the square) when you should only look at the 3x3 plot square that is around the center plot. ^^

xxxx → xxx
x00x → x0x
x00x → xxx
xxxx →
Colored O is the iPlot in question; x is the plots that is checked if they are coast.

I have no experience with python so I couldn't say if there were any syntax errors, but I'm quite sure about that one logic error.
 
Joined
Jul 5, 2004
Messages
23,556
Location
Canberra, Australia
In Fortran and other languages it is (For i = 1 to 2) means one and two get done. In python, apparently it means 1 gets done then the loop stops because you are at the end ie 2. this means the end needs to be 3 to get one and two done. However I have seen this done another way also and it also goes from -1 to +2 to test -1 and +1. I did try -1 to +1 but it only did the top left three.

ie I coded your suggestion and I got
xx
xO

edit I'll try the other form of the code, but the above was what came with the original deep ocean mod which does what we want except it turns the rest of the ocean into deep ocean
 

Toffer90

C2C Modder
Joined
Oct 16, 2011
Messages
7,918
Location
Norway
After looking around a couple of giant maps I see that this only happens in polar and tropical areas, so something might be going wrong when the climate is changed. How is that last part done in code?

There is no way that climate starts being added before all sea have been placed?
 
Joined
Jul 5, 2004
Messages
23,556
Location
Canberra, Australia
After looking around a couple of giant maps I see that this only happens in polar and tropical areas, so something might be going wrong when the climate is changed. How is that last part done in code?

There is no way that climate starts being added before all sea have been placed?

That is probably it as I change the plot to Sea then do the climate stuff then some resource stuff before going to the next plot!
 

Thunderbrd

C2C War Dog
Joined
Jan 2, 2010
Messages
29,197
Location
Las Vegas
Hi,

I have an Infinite Loop on my last game. (Save is attached).

After a few investigations, I managed to work around by switching the civ (Using ALT+Z). In debug mode, I get an assert fail on a Group size ,
and discover that there are too many units loaded in a Galleon. see pic.




Unloading them solve the problem, but it appends again ~20 turns later.

I'm going to update the SVN with what I think is a fix. As soon as you enter this save with the debug dll you get immediately into the AI suffering from what would be an infinite loop (except that such loops are short circuited after a time or should be.) The loop was in some 'bad' logic in programming in the 'Pickup Stranded Unit' code. Which is also a known problem spot for delays so this may well be the fix for a lot of those delays as well, which presumably are caused by these loops needing to process to the point that they shortcircuit.

I'm not 10000% certain that I've fixed the problem you are pointing at exactly except that after resolving this it does get to the beginning of the turn and the player is able to begin selecting builds in his cities. If this means the issue is resolved, which I'm hoping it does, then problem solved. Voilla!

I also do hope that the pickup is going to work from the other side of the stranded equation as the transporting unit is simply sent to the right place to do the pickup and told to stay there so the stranded unit can jump on board. It would take a lot more analysis to ensure that the unit actually then does so.

I deeply feel like rewriting a lot of this coding from a whole different perspective of process but I'm just patching this stuff right now as best I can. AI is complex though and it could be a larger issue is what I'm trying to say. There were NUMEROUS problems in that bit of code, including inappropriate handling of Size Matters loading issues - which I hope I've resolved well here but it leads me to worry about some other areas I may have missed and a few insights obtained here make me worry about other portions that I didn't miss but may have not quite setup correctly. Again... it's going to take a large audit and I'll be getting to some further AI work at the end of the cycle here.
 

dummy1929

Chieftain
Joined
Nov 9, 2015
Messages
62
Memory allocation failure:

I know this is an old problem, but I am experiencing MAFs every other turn or so with my current game, always at unpredictable moments. The last one occurred when I wanted to save the turn - maf as soon as the save dialogue came up.
I am playing a giant world, 12 civs, normal speed. I am on the latest SVN; I am running the game on Windows 7-64, i5 4690K (normal speed), 16G RAM, Nvidia GTX950 2G.
 

Attachments

  • MyPlayer AD-1393.CivBeyondSwordSave
    56 bytes · Views: 58
  • AutoSave_AD-1393.zip
    4.5 MB · Views: 40
  • MyPlayer AD-1390.zip
    4.5 MB · Views: 44

dummy1929

Chieftain
Joined
Nov 9, 2015
Messages
62
General observations about my current game (giant map, 12 civs, normal speed, no revolutions, no barbarian civs)

(my apologies for bringing up these much-discussed issues...)

AI strategy and combat behavior

-AI produces stacks of siege weapons and healers and not much else (200+ battering rams, 40+ healers). Favored combat unit is skirmisher (I've seen stacks of 300+) Few archers, swordsmen, pikemen.
-AI breaks off sieges for no apparent reason, when it is close to winning.
-AI does not seem to understand terrain damage (one of my favorite features), especially not when besieging.
-AI also does not understand surround and destroy (another favorite) - never breaks out even if surrounded only by weak units, never attempts to surround.
-AI seems to break off action if units take damage, does not persist or push an attack.
-I have seen 2 sieges where the AI removed a massive garrison from a city I was besieging -
-AI doesn't seem to consider sacrificing units to achieve a goal.

Gold

Too much gold. (long discussion, I know) - 16 cities in renaissance, 100% science, 100k gold and 7000k gold/turn; this with a 600+ army and mercenaries turned on. I noticed that most of the income is listed (on the F2 screen) as coming from "resources" - do the map resources bring in extra cash, or is this commerce? If commerce, should this not be converted to science (at 100%)?
I remember that money was much more scarce before v34 or so - I was always running deficits, had to consider switching to different civics, raising the tax rate (with disastrous consequences for happiness...) and having cities produce cash just to break even, all of which was fun. Every new cash building felt like a relief. (I understand that playing on slower speeds changes the picture, as the buildings have a cumulative effect on income. On normal speed, I am able to build almost every building in 1 turn.)
I imagine money in the middle ages should be scarce, and troops expensive (which makes vassalage a viable option).
I also wonder what the AI does with its gold - it never seems to be able to run such large surpluses. Does it spend it all on buildings? This would be a very bad use of money, especially on normal speed.

Using Great People for technologies

The AI is either much slower in getting technologies from GPs, or uses them for other purposes. AI also does not seem to maximize for GPs, through strategically selecting wonders and buildings.

Knowing nothing about how the AI works under the hood, I wonder if some simple rules could tweak AI behavior for the better: Well-composed stacks (reasonable ratios for siege/non-siege, healers). Teach AI surround-and-destroy. Teach AI about terrain damage (uses strategic bases or units with special promotions to cross terrain.) Teach AI to accept losses if the strategic odds are in its favor.

Sorry if I am bringing up things that have been discussed to death - wish I could help. Thanks for making and improving a great game!
 

JosEPh_II

TBS WarLord
Joined
Jun 20, 2007
Messages
16,529
Location
Western IL. cornfields
Memory allocation failure:

I know this is an old problem, but I am experiencing MAFs every other turn or so with my current game, always at unpredictable moments. The last one occurred when I wanted to save the turn - maf as soon as the save dialogue came up.
I am playing a giant world, 12 civs, normal speed. I am on the latest SVN; I am running the game on Windows 7-64, i5 4690K (normal speed), 16G RAM, Nvidia GTX950 2G.

Please zip and add MiniDump.dmp file for this last CTD/MAF. You will find it in the Main BtS directory. If miniDump is greater than 0 KB it will help. If 0 kb then just say it was a 0 KB because that points to a different problem.

What Difficulty level is your game? And the more Game set up details you can give also helps.

Thanks.

JosEPh
 

strategyonly

C2C Supreme Commander
Joined
Mar 13, 2006
Messages
20,884
Location
MN
I am not understanding this move by the AI what so ever??

Only city left, and you move all your troops OUT of the city of an invading army?? Why aren't they fighting to the very LAST unit??

I think this is the turn before my army invades??
 

Toffer90

C2C Modder
Joined
Oct 16, 2011
Messages
7,918
Location
Norway
I am not understanding this move by the AI what so ever??

Only city left, and you move all your troops OUT of the city of an invading army?? Why aren't they fighting to the very LAST unit??

I think this is the turn before my army invades??
This happens to me in about every city I'm trying to take (AI: here, you can have it, it's on the house.). I haven't seen them not do that since at least v35. AI has been quite crippled for some time now.
Even barbs do this.
 

Thunderbrd

C2C War Dog
Joined
Jan 2, 2010
Messages
29,197
Location
Las Vegas
I am not understanding this move by the AI what so ever??

Only city left, and you move all your troops OUT of the city of an invading army?? Why aren't they fighting to the very LAST unit??

I think this is the turn before my army invades??

The concept of moving all the attack AI units out is sound (they are theoretically preparing to attack once you take the city), but not when it's the last city. This is a known flaw. The code causing this is something I'll be looking to work on fairly soon but it can't be addressed with an 'emergency fix' approach. Needs a lot of deep efforts there to resolve numerous things, including this.
 
Status
Not open for further replies.
Top Bottom