Fall Further - Download and Current Changelog

1) Whenever I try to reload a saved game out of the rnning game, it crashes.
(Not too bad, keeps me from cheating too much ;) )

2) Worse: when the game starts to get complex, especially after turn 400 or so, it crashes nearly every end of turn, making it close to unplayable. The fact that I am still playing it, knitting socks while I wait for it to restart, shows how much I love it, but still... ist there hope? Or which information would sb need from me to get an idea why it's happening?

I've been having the same issue - I've got a reproable case for #1, where I have a save game where you simply hit enter to go to the next turn, then try to reload the save game, bang, CtD. It was driving me nuts so much, it motivated me enough to fire up the debugger & figure it out myself. It seems that the memory heap gets corrupted by some event taking place during the turn. (I suspect #2 is just a variant of #1...)


I'll keep looking at it tonight, I think I have an idea where it's messing up.
 
Patch I (will break save games)
(Rev414)
1. Masters Hall GP production bug fixed
2. Giant spiders may be promoted along five unique lines (two promotions in each)
3. Broodchamber added (created by returning high experience units to the nest, grants free promotions to spider units)
4. Kahdi are allowed to build champions.
5. Spider spawn rate increased.
6. Baby spider upgrade from combat chance increased (50% from 30%)
7. Archos cities with unhappy population have a chance to be called upon to "feed mother" (population control).
8. Pyre Zombies now only inflict retaliatory damage (when killed) upon the unit they fought
9. Pyre Zombies inflict collateral damage
10. Pyre Zombies gain +20% vs Melee and -40% vs Archery
11. Sheut Stone significantly increases retaliatory damage done by Pyre Zombie death explosion (extra damage is Death damage)
12. Mother may order the Archos to conquer specific food resources from their neighbours (work in progress - current reward is placeholder to test the actual quest)
13. Settler AI Improved.
14. Worker AI Improved.
15. Several bug fixes from unofficial patch and BetterAI (fixes, not features so far).
16. Melante (Scions Dark Councilor) gains "Polished Diplomat"
17. Pelemoc (Scions Dark Councilor) abilities reworked.
18. Giant spiders can consume a "meat resource" within their borders to supply a number of baby spiders quickly (AI won't use unless they have a significant surplus of that resource and the resource is outside of city radius).
19. Experience setting in Python fixed for Mobius Witches, Thades, Hyborem and Basium.
20. Shamans can now build all new mana nodes properly
21. Units with duration cannot be added to a flesh golem
22. Autocracy, Tyranny and Dictatorship state names all require at least 2 cities (your initial city remains a "tribe")
23. Ancient Forests reduced to 25% defense bonus
24. Most FoL units gain +25% bonus attack/defense in Ancient Forest.
25. AI for teching significantly improved (will now prioritize commerce techs as empire grows, appropriate religious techs and some civs/leaders follow a general plan for teching)
26. Alcinus will now switch to an aggressive AI when enraged.
27. Barbarian units will now correctly target and attack cities again.
 
Excellent.
 
Found the problem that was creating a heap corruption on my save game.

Busted code is in the BTS source itself, in CvPlayerAI::AI_doEnemyUnitData() :

Old code:
Code:
	for (iI = 0; iI < GC.getNumUnitClassInfos(); iI++)
	{
		if (m_aiUnitClassWeights[iI] > 0)
		{
			UnitTypes eUnit = (UnitTypes)GC.getUnitClassInfo((UnitClassTypes)iI).getDefaultUnitIndex();
			m_aiUnitCombatWeights[GC.getUnitInfo(eUnit).getUnitCombatType()] += m_aiUnitClassWeights[iI];

		}
	}

Notice that there's no checks around what unitCombatType value's being used to insert into the array, and that's the problem - some of the units have a default NO_UNITCOMBAT value, which is -1, so this is an illegal assignment. However, for whatever reason, the code allows this to happen, and I have to assume that it walks off the front of the memory range assigned to the array & corrupts data. When the array is cleaned up later, it dies a horrible death.

Code fix:

Code:
for (iI = 0; iI < GC.getNumUnitClassInfos(); iI++)
{
	if (m_aiUnitClassWeights[iI] > 0)
	{
		UnitTypes eUnit = (UnitTypes)GC.getUnitClassInfo((UnitClassTypes)iI).getDefaultUnitIndex();

		int unitCombatType = GC.getUnitInfo(eUnit).getUnitCombatType();
		FAssert(unitCombatType < GC.getNumUnitCombatInfos());
		FAssert(unitCombatType > NO_UNITCOMBAT);
		if (unitCombatType > NO_UNITCOMBAT && unitCombatType < GC.getNumUnitCombatInfos())
		{
			m_aiUnitCombatWeights[unitCombatType] += m_aiUnitClassWeights[iI];
		}
	}
}
 
Yes, you are on the right track. We're hoping to find tools to assist with isolating Heap issues. Could also be a Stack issue with how much memory we utilize.

EDIT: Crosspost while servers were down. I'll check out what you found. :)
 
Here's my save game that would blow up after ending the turn, then reloading. If you add my mods, you'll see the asserts fire (at least in debug, at any rate).
 

Attachments

GREAT find so far Moot :) With that one fixed up (pretty sure I only placed asserts at the other) I was able to reload a game which was autoplaying up to turn 180. Previously any extended duration of straight play meant NO chance of loading a save. So you may very well have found the proper fix for the entire mess :) (Mild pity it came so quickly AFTER the patch :p)
 
With Moot's find and Jean eventually merging in his new code, I am sure there will be another patch in fairly short order :)

BTW, what program did you use to help isolate the cause Moot? Been trying to find something capable of tracking down the issue and haven't had any good results yet.
 
BTW, what program did you use to help isolate the cause Moot? Been trying to find something capable of tracking down the issue and haven't had any good results yet.

Just Visual Studio.

This one was a . .. .. .. .. . to chase down, but it was mostly (im)patient stepping in the debugger. Basically, every time I saw the heap corruption, the callstack was jacked up at that point, but I noticed that it consistently showed that it was messing with some kind of container, so I put a breakpoint in the disassembly right above where the container operation was happening. The next time I launched, when I hit the breakpoint, I could see the entire callstack, and I was inside the CVPlayer's reset() function. So I put another breakpoint in the reset() function where these CEventMaps get cleared, and found that it would always crash after the fourth time I'd hit the breakpoint. So it was a lot of restarting & stepping until I finally found that the real crash was at the SAFE_DELETE_ARRAY(m_aiUnitCombatWeights) in the base class.

Once I knew what was really blowing up, I did a search on where that var's used, and luckily it's only found in several places, so it didn't take much more to find the code funk.
 
Gotta admit, this is the most exciting thing in a while. The capacity to play Fall Further sans exploding is... incredible to consider.
 
Damn, hoped for a nice tool :) I had narrowed down to CvPlayer as well, but was convinced it was something that I had done, so was getting ready to pluck out all of the code from CvPlayer (would have been frustratingly pointless...)
 
that's some great news :D many many thanx to MootPoint and anyone else who has been trying hard to make FF crash-free ( I'm looking at YOU, FF team! :p )
 
If I understand correctly, Moot's find probably solves the problems with reloading games. GREAT!

What about the issue with Lairs and Unique Features? Has that been solved yet? Or is it maybe related to the above?
I've been playing with Lairs and UFs plus Hyborem disabled and my latest game is perfectly stable so far.
Haven't downloaded patch I because I want to finish that game first - but will it make sense to play with Lairs etc. again next time? I'm really missing those features :(
 
If I understand correctly, Moot's find probably solves the problems with reloading games. GREAT!

What about the issue with Lairs and Unique Features? Has that been solved yet? Or is it maybe related to the above?
I've been playing with Lairs and UFs plus Hyborem disabled and my latest game is perfectly stable so far.
Haven't downloaded patch I because I want to finish that game first - but will it make sense to play with Lairs etc. again next time? I'm really missing those features :(

It is the exact same issue that you were able to avoid (for a while) by disabling Hyborem, Lairs & Unique Features. Doing those just made this issue less severe by removing a lot of Skeletons from the world. But if you had Luchuirp with their golems parading around, or the Balseraph with Loki, or any other unit which didn't have a UnitCombat, but COULD fight, then this issue eventually bit you and caused a crash at some random, unrelated point.


This fix is NOT included in patch I however, so don't "come back" to Fall Further expecting absolute stability with patch I, wait for J ;)
 
Back
Top Bottom