davidlallen
Deity
Ah, thank you! Good detective work.
If you could write a short description in the "For Modders and Mergers" thread, that would be helpful I think.
Done. Thanks for your help.
Ah, thank you! Good detective work.
If you could write a short description in the "For Modders and Mergers" thread, that would be helpful I think.
Just got a save uploaded with a critical bug from LoR (not the test build this time, it's the 0.8.2 release). Fatal hang, here is the failed assert:
This assert will keep popping up as long as I say ignore once, and then if I choose always ignore, fatal hang.
Going to work with this a bit, see if I can isolate it. It's doubful that I can convert this to a pure RevDCM save, since it's AI related, but I'll see what I can do.
Edit:
When cycling through the civs in an effort to narrow down the cause of the fatal bug to the civilization it occurs in, and hopefully locate the offending unit(s), I ran into this failed assert, I've never seen before:
Just hit "ignore" and it went away. But figured I'd note it. Also this assert was not thrown when I hit enter to simply end the turn to reproduce the fatal hang reported above. Seems odd this would trip when cycling through the civs one by one, but not when the game was running through an entire turn. (also how is it possible to return -1 when trying to retrieve the number of units?)
Now, the reason you only saw this starting with BBAI 0.7 is that in Feb I introduced some logic which causes a stack led by a UNITAI_ATTACK unit but containing a UNITAI_ATTACK_CITY unit to split apart ... this situation is never supposed to happen, the logic in AI_attackCityMove is much better for offense stack operations. So, the new 3 unit UNITAI_ATTACK stack splits into three separate stacks. Each unit then runs its own update, the two UNITAI_ATTACK units group first and then they try to merge with the UNITAI_ATTACK_CITY unit again ... rinse and repeat.
There are a couple of things I will do to fix this issue so it doesn't crop up again:
- In Revolution.py, checking whether a unit has value to the AI with a particular UNITAI in addition to the XML check.
- In CvUnitAI.cpp, changing the logic for splitting groups a bit so it can't lead to infinite hangs (group->split->group->split-> ... is one source of infinite hangs).
//FAssert(pLoopUnit != this);
if( pLoopUnit != this )
{
iCount++;
}
Great find, jdog. I have one question: The CTD that I reported earlier in this thread had a similar situation (i.e., a group of one UNITAI_ATTACK_CITY catapult merging with a group of one UNITAI_ATTACK Keshik (horse archer). This caused a CTD, but according to your explanation I should have seen an infinite hang, not a CTD. Unless it's because I am on Vista 64. I've read that Vista is more sensitive to minor programming errors (such as infinite loops). What system are you experiencing this on? I seem to recall that phungus is on XP...
@phungus:
...
The cleaner approach would be to try compiling a new DLL. The offending lines are around 9866 in CvUnitAI, change them to read:
This is what I've got in the next release of BBAI. If you go this route, please let me know whether it solves the problem (it should ...).Code://FAssert(pLoopUnit != this); if( pLoopUnit != this ) { iCount++; }
Negative. All this does is not trip the assert. The fatal hang still occurs.
Edit: I've tried WB saving the game, but the assert no longer trips (big surprise). If it had I could have exported it to the 0.9.2x test build for you to take a look at. If you do decide to download and install LoR 0.8.2 (the "official" install) to debug this, the CvDefines.h needs to be changed to 50 civs... It still has the 34 civ listing there, all the rest of the source is good to go. You may be able to use the standard RevDCM 1.02 gamecore though, the only modification to it was adding in the barbarian World challenge option, which might not have anything that would effect save games. And once again the save is here:
http://rapidshare.com/files/240677764/BeforeBlock.CivBeyondSwordSave
And again sorry about bugging you to debug stuff from a different mod from pure RevDCM, but these are the critical bug reports I get, and I don't see any showing up for RevDCM pure. I also think it's a pretty safe assumption this is caused by RevDCM, BetterAI, or default BtS code, and not something specific to LoR.
{
setBattleFeaturePrev(getFeatureType());
setBattleFeatureVariety(getFeatureVariety());
ivalue = getFeatureType() + GC.getNUM_GAME_FEATURES();
ivalue2 = GC.getGameINLINE().getSorenRandNum(GC.getNUM_BATTLE_FEATURES(), "Feature type");
setFeatureType((FeatureTypes)ivalue, ivalue2);
}
<!-- Global Defines -->
<Civ4Defines xmlns="x-schema:CIV4GlobalDefinesSchema.xml">
<Define>
<!-- Set to zero to disable battlefield features -->
<!-- Battlefield features affect the order of items in the xml/terrain/civ4featureinfos.xml file. If you have X number of real features, they must go first in the file (before any battlefield features), and make sure NUM_GAME_FEATURES below is set to X. If you have Y number of battlefield features, make sure NUM_BATTLE_FEATURES is set to Y. Note the default file does this incorrectly since there are 6 real features and 7 battlefield. Also note that if the number of features in the file is less than X + Y, the game may crash anytime a battle completes, as a nonexistent feature is referenced. -->
<DefineName>DCM_BATTLE_EFFECTS</DefineName>
<iDefineIntVal>1</iDefineIntVal>
</Define>