FF 0.43 Bug Thread

So what precisely do the numbers mean then? Between turns is 130 seconds precisely, and python is eating up 444.445 seconds of CPU time. So how much of the between turn time is python then? It is obviously including some during turn functions in the equation. Unless that 444 is for the entire duration of the game, in which case it is TINY (under 1 second average per turn)

Is the 18778 seconds the time for you to do a single turn, or the time for the game to get up to this point using AutoPlay? 1 hour seems pretty hefty if it is just for the single turn, but really quick if playing manually to get to turn 584.


Maybe run it for a turn where you don't do anything? Just as soon as your turn starts, hit SHIFT+ENTER to see between turns only?

Anyway, very useful looking tool. Will be nice to know precisely what each function costs us so I can figure out which items need to be moved to the DLL and devise shortcut mechanics to avoid entering some of the larger functional loops. Is there a way to figure out precisely what function things like profile:0(<function real_onEvent at 0x17584F30>) would be?

130 is the time of the last turn in seconds and calculated with a time.clock(), it is strange tough that it is 130 precisely the presision is up to the microsecond
444 is the runtime of python for the whole game, so yes its tiny
18778 is the whole game duration in automatic play (ctrl+shift z)

If you look the log it look like this:
Code:
GAME TURN 1 TIME Thu Dec 18 02:23:51 2008 DIFF 79.528908 TOTAL 79.528908
GAME TURN 2 TIME Thu Dec 18 02:23:52 2008 DIFF 1.607620 TOTAL 81.136765
GAME TURN 3 TIME Thu Dec 18 02:23:55 2008 DIFF 2.225441 TOTAL 83.362450
GAME TURN 4 TIME Thu Dec 18 02:23:56 2008 DIFF 1.692116 TOTAL 85.054802
GAME TURN 5 TIME Thu Dec 18 02:28:42 2008 DIFF 286.118286 TOTAL 371.173340
GAME TURN 6 TIME Thu Dec 18 02:28:45 2008 DIFF 2.175842 TOTAL 373.349457
GAME TURN 7 TIME Thu Dec 18 02:28:47 2008 DIFF 2.288361 TOTAL 375.638031
GAME TURN 8 TIME Thu Dec 18 02:28:49 2008 DIFF 2.247742 TOTAL 377.886017
GAME TURN 9 TIME Thu Dec 18 02:28:52 2008 DIFF 2.499054 TOTAL 380.385376
GAME TURN 10 TIME Thu Dec 18 02:28:54 2008 DIFF 2.810822 TOTAL 383.196442
....
GAME TURN 574 TIME Thu Dec 18 07:11:44 2008 DIFF 161.183594 TOTAL 17352.818359
GAME TURN 575 TIME Thu Dec 18 07:14:28 2008 DIFF 163.789063 TOTAL 17516.607422
GAME TURN 576 TIME Thu Dec 18 07:17:06 2008 DIFF 158.265625 TOTAL 17674.873047
GAME TURN 577 TIME Thu Dec 18 07:19:44 2008 DIFF 157.667969 TOTAL 17832.541016
GAME TURN 579 TIME Thu Dec 18 07:24:26 2008 DIFF 145.748047 TOTAL 18115.402344
GAME TURN 580 TIME Thu Dec 18 07:26:38 2008 DIFF 131.570313 TOTAL 18246.974609
GAME TURN 581 TIME Thu Dec 18 07:28:45 2008 DIFF 126.603516 TOTAL 18373.578125
GAME TURN 582 TIME Thu Dec 18 07:30:58 2008 DIFF 132.898438 TOTAL 18506.476563
GAME TURN 583 TIME Thu Dec 18 07:33:19 2008 DIFF 141.937500 TOTAL 18648.414063
GAME TURN 584 TIME Thu Dec 18 07:35:29 2008 DIFF 130.000000 TOTAL 18778.414063

I attach a text file with all turn timing.

The first turn took long time because I didn't press the ctrl+shift z immediately.
The last turn took less time because interrupted by the crash.
I also interrupted it in turn 5 to check something hence the almost 5 min turn...
 

Attachments

Ok, so the time is counting the player's turn, but player is an AI so that is irrelevant really. And each turn just clocks in at the first python call for the turn. Very nifty. But yes, the overall answer is that python really doesn't need any optimization at all according to this test. At least, not until the AI starts using magic a lot more or something.
 
The function profile:0(<function real_onEvent at 0x17584F30>) is the new entry point for event and profile is the profiler itself.

I did some calibration (bias) on the profiler on my machine so it should not count its own running time.

You can look at it in the previouly attached CvEventInterface.py:
Code:
def onEvent(argsList):
	'Called when a game event happens - return 1 if the event was consumed'

	global previousturn
	global previousclock
	global theStats

	theProfiler = Profile()
	theProfiler.bias = 5.0512495076118231e-06
	
	def real_onEvent():
		return getEventManager().handleEvent(argsList)

	try:
		ret = theProfiler.runcall(real_onEvent)
	except AssertionError:
		# Crashs once for onTechAcquired. I don't know why but
		# it doesn't seem to cause problems. Perhaps a profiler bug.
		print "Profiler didn't like the " + argsList[0] + " event"
		return
	if theStats == None:
		theStats = Stats(theProfiler)
	else:
		theStats.add(theProfiler)

	if previousturn < CyGame().getGameTurn():
		old_stdout = sys.stdout
		sys.stdout = StringIO()
		theStats.strip_dirs().sort_stats('time').print_stats(10)
		stats = sys.stdout.getvalue()
		sys.stdout = old_stdout
		print "GAME TURN %d TIME %s DIFF %f TOTAL %f" %(CyGame().getGameTurn(), time.ctime(), time.clock() - previousclock, time.clock())
		print stats
		previousturn = CyGame().getGameTurn()
		previousclock = time.clock()
		
	return ret

All is explained here: http://docs.python.org/library/profile.html
 
Hmm, once I figure out how to upload pictures, I'll post screenshots of some random bugs I've seen

So for the first: very minor, very cosmetic, but burnt forests can apparently grow and spread like normal forests :crazyeye: Although that might have been because I was the Scions, and they were twisting nature like they always do
 
How hard would it be to get the DLL that has the fix for Scion Legates/Doomsayers to get reborn from battle. It sounds like the next patch is a ways off.
 
Pretty much impossible unfortunately. From what I understand the last DLL I uploaded was already well into the development of new files and features. That means I haven't got a clue how far back I would have to revert everything.
 
How hard would it be to get the DLL that has the fix for Scion Legates/Doomsayers to get reborn from battle. It sounds like the next patch is a ways off.

Hmm... assuming the code in the .dll is simply failing to work and not actively blocking unit creation, and if you're willing to experiment, try this:

In CIV4UnitInfos.xml (xml/units) make PythonPostCombatWon for Legates etc:

Code:
		<PythonPostCombatWon>genReborn(pCaster)</PythonPostCombatWon>

Then, in CvSpellInterface (python/entrypoints) add this someplace:

Code:
def genReborn(caster):

	pPlayer = gc.getPlayer(caster.getOwner())
        if CyGame().getSorenRandNum(4, "Check") == 0:
	    newUnit = pPlayer.initUnit(gc.getInfoTypeForString('UNIT_REBORN'), caster.getX(), caster.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)

I'll try it later myself if I get a chance. Or if you wait a bit someone may pounce and correct the python.
 
Going from turn 262 to 263, it never comes out of the "Waiting for Other Civilizations." It seems to have completed the turn for the other civilizations though since I can move around the map with my keyboard, access all the menus, access the my cities via the GP counter, adjust the building ques, etc. It just does not seem to toggle it back to actually being my turn. It seems to be reproducible since I've gotten the same results after a total shot down and reboot.
 

Attachments

If you enabled Simultaneous turns that would allow you to take all of those actions while the AI is stuck in whatever infinite loop it got caught up in.


I don't use simultaneous turns.
The same thing happened with a Scion game I was running recently as well. Over all it's a great modmod, but it's frustrating not being able to complete a game using it.
 
Okay, I have this weird bug going on that I've seen before but don't know how to fix it. I'm playing with the latest patches in FF and FfH along with the new media pack. I'm on a XP system.

The problem is that the Mana taskbar doesn't work, nor can I see all the different races I've met over above the map.

I've rebooted, I've started games in vanilla, FfH, and FF to clear out any settings. What am I missing?

Can other mods other than FfH related mess things up? I just realized I did play a few turns of Planetfall yesterday, but I don't recall this issue happening on any of the games I started yesterday.

With all these patches that break saves, I've started so many games in different mods that it's hard to keep track of what I've done. :crazyeye:
 
If you enabled Simultaneous turns that would allow you to take all of those actions while the AI is stuck in whatever infinite loop it got caught up in.

So another game, exact same problem. This time going from turn 151 to 152. Reproducible on my system, even going back to earlier saves. I do not have access to any other systems to try it out on.

I've provided save files from turns 151, 150, 149, and 144. On turns prior to 151, there is no excessive lag or hangups going from one turn to the next. But every single one of these files I've tried it has locked up at the same point - going from turn 151 to 152. To me that says there is something innate with the file that will cause it to lock up. If it were happening on different turn I would thing maybe it's a resource issue or something. But it's not, and it happens regardless of the choices I make leading up to that turn.

Some one trying the files out on a different system would at least help me eliminate if it is some error associated with my computer or not.

Thanks to anyone willing to provide any sort of help with this issue.
 

Attachments

Very interested in seeing if anyone can confirm the slowdown on these saves. My laptop isn't really a powerhouse so EVERYTHING is slow for me, and I am unlikely to notice too terribly easily if there is a slowdown. Not to mention that I haven't actually played a game into the later turns in ages so don't have a good feel for how long is reasonable :(
 
I'm running Vista on a Dell XPS-720 and I got the same hang-up going from turn 151 to 152. Never did make it to turn 152.
I don't know if this means anything, but I was able to enter into world builder during the 'waiting for other civilizations' but couldn't zoom in and out.
 
Back
Top Bottom