Requesting help from modders/dev team with idea for AC90 bug

FM_Freyland

Vote with your wallets!
Joined
Nov 18, 2001
Messages
163
Location
Michigan
Hi all,

Having been burned by this bug several times, I have been giving it a lot of thought. To summarize, when a turn ends and the AC is at 90 or more, the Avatar of Wrath event occurs, causing all living units to get the enraged promotion. Unfortunately, the game seems to go into an infinite loop of processing that it cannot seem to break. I am hypothesizing that perhaps what is happening involves overlap between the game sequentially giving the promotion and also trying to check each unit to see if it goes barbarian. A way to confirm this would be to change the enraged promotion so that the game checks for transformation the turn after the promotion is obtained. It is also possible that the glitch is solely related to the game checking all of those units for barbarian transformation, and separating the two events would also help isolate that as a problem.

I have no idea how to open my files for modding, let alone how to make the changes required to test my ideas. If anyone with knowledge could help, I would be grateful to know if I was right or wrong. Of course, if I am totally off base my apologies for wasting anyone's time reading this!

Thanks
Jonathan

Oh, another thought with less logical explanation but still plausible would be if the game gives the enraged promotion to units that should not be allowed to have it (example, demons) and then the game hangs when a few units go barbarian but shouldn't be able to. Again, probably just reaching.....
 
Just a note, the bug doesn't appear to be a problem with the old established mechanic of Enraged + Barbarian. A recent MP game (one of the FFHRP ones) the Avatar showed up and proceeded to wreak havoc with no bugs or crashes at all.
I suspect its related to the units spawning on top of other units bug (the new barb units appear in an invalid plot).
Of note was that MP game had no AI players, so thats more than likely a factor.
I was playing Infernals at the time, and none of my demonic units went Barb OR Enraged. They did, however, manage to acquire a huge amount of XP in a very short time, most likely due to the impending doom of the 'good guys'.
 
Thanks for responding!
 
Just a note, the bug doesn't appear to be a problem with the old established mechanic of Enraged + Barbarian. A recent MP game (one of the FFHRP ones) the Avatar showed up and proceeded to wreak havoc with no bugs or crashes at all.
I suspect its related to the units spawning on top of other units bug (the new barb units appear in an invalid plot).
Of note was that MP game had no AI players, so thats more than likely a factor.
I was playing Infernals at the time, and none of my demonic units went Barb OR Enraged. They did, however, manage to acquire a huge amount of XP in a very short time, most likely due to the impending doom of the 'good guys'.

Probably not. If an unit spawned on top of another unit it with whomit cannot stack, it would cause a CtD, not a WoC.

However, the WoC is almost certainly related to AI beahvior in an infinite loop. Therefore, if you play with no AI players, you probably won't get these Woc's.

Best wishes,

Breunor
 
Ah, missed that bit. You got any ideas about whats actually causing these WoC errors Breunor?
I've only had a couple, and can usually get past them by reloading an autosave. Even on Marathon 1000+ turn games I almost never experience them...
 
I haven't personally had a lot of WoC's, only one myself. I've looked at a lot of other people's games though.

If you have followed the 'bug' thread, before the last set of changes, the WoC's were overwhelmingly dominated by issues with hidden nationality units, often tigers, giants, etc. The issues with hidden, hidden nationality, and similar types of units were probably causing problems when the computer AI was trying to stack them or determine their path to an attack.

Although we appear to haver fewer WoC's now, though, they seem to be more complex. We are getting a decent number of WoC's from mages stacked together. My guess is that the upgraded ability of the AI to cast spells somewher is leading to an infinite loop when examining the potential spell to cast.

With the Avatar of Wrath, I can think of a few potential causes but I may be totally wrong. My suspicion is that it has something to do with the units that get enraged. Here, perhaps there are units that cannot attack that become enraged, causing them to be forced to attack but they can't (similar to the 'taunt' bug). Or with a lot of enraged units, they end up targeting too many places and get in each others' way somehow. Or somehow the code gets messed up if enraged untis are tageting the same enemy, the first one attacks and the second one tries to attack but nothing is there. Maybe creating all of these barbarian type units just increases the chance that a single AI infinite loop bug gets triggered randomly. Unfortunately, without pouring over the code, I don't think we can make a lot of progress fixing this bug. We do know a LOT of players report WoC's after the Avatar of Wrath appears.

Best wishes,

Breunor
 
I don't see how you guys are getting to 1000+ turns. Playing on Normal speed, I without fail hit a WoC around turn 450-475. This is getting very frustrating and I like to play with a lot of AI players on a huge map so I decided to run some tests to see how many AI players and what kind of map I could do before I get a WoC.

I just did my first test, which was to let the AI play... 5 AI on a Tiny map. I got a WoC at turn 461, same time frame I always get WoCs with 30 players on a Huge map. :-/ It seems like lowering the number of AI and map size has no effect on my WoCs, like I was hoping it would.

I even downloaded Wildmana to see if it was more stable, and I have the same issue, although with Wildmana it seems to be around turn 375 that I hit a WoC, so really it's kinda worse. :p
 
I even downloaded Wildmana to see if it was more stable, and I have the same issue, although with Wildmana it seems to be around turn 375 that I hit a WoC, so really it's kinda worse. :p

If you experience bugs no one else does and you do not report them in a bug thread, don't expect them to be fixed :p

As long as I can open a savegame with my working dll I can fix any WoC on average in less than 10 minutes
 
10 minutes huh? :-D

All right, I'll start playing more Wildmana and hang out in the bug thread over there some. >:D

On a side note, how does Wildmana compare with base FFH2 as far as Out of Syncs in multiplayer? I play multiplayer with a couple friends most of the time and since upgrading to patch "m" in base FFH, we get out of syncs annoyingly often now. :-(

Now I just have to convince them to download Wildmana... <_<
 
The problem appears to be this line in CvGame::updateMoves()

if (!(player.AI_hasSummonSuicideUnit()))

I only have a save where the WoC is already ongoing so I can't for sure tell you the exact cause but I believe it to be this scenario:
The AI summon a unit.
It's in SuicideSummon mode, so the summon get this bool set to true.
It calls CvUnitAI::AI_update() for that unit.
CvUnitAI::AI_update() return BEFORE unsetting the SuicideSummon bool.

At this point the unit is no longer moving yet it's still a suicide summon. That's when the problem happens...
if (!(player.AI_hasSummonSuicideUnit()))
The AI has a suicide summon unit, so we do NOT enter this if.
Because we do not enter that if we do not move any units the next turnslice.
Because we do not move any units the next turn slice, we obviously still have a summon suicide unit.
And so we have our infinite loop.

I have verified that by removing the if the infinite loop no longer happens.

I'm not sure why that check is there in the first place, every time we do not enter the if it should cause an infinite loop:
We do not move our units because we have a suicide summon
Because we do not move our units we still have a suicide summon, as that is the only way to set the bool to false!
 
If you experience bugs no one else does and you do not report them in a bug thread, don't expect them to be fixed :p

As long as I can open a savegame with my working dll I can fix any WoC on average in less than 10 minutes

Oh my, I am very jealous - it takes me a LOT longer! It often takes me a few hours!

Best wishes,

Breunor
 
I have verified that by removing the if the infinite loop no longer happens.

I'm not sure why that check is there in the first place, every time we do not enter the if it should cause an infinite loop:
We do not move our units because we have a suicide summon
Because we do not move our units we still have a suicide summon, as that is the only way to set the bool to false!

yes, the call to AI_hasSummonSuicideUnit can be removed, well the whole function can be removed. Turned out it wasn't necessary. The code is an artifact from a very early wildmana version.
 
The problem appears to be this line in CvGame::updateMoves()

if (!(player.AI_hasSummonSuicideUnit()))

I only have a save where the WoC is already ongoing so I can't for sure tell you the exact cause but I believe it to be this scenario:
The AI summon a unit.
It's in SuicideSummon mode, so the summon get this bool set to true.
It calls CvUnitAI::AI_update() for that unit.
CvUnitAI::AI_update() return BEFORE unsetting the SuicideSummon bool.

At this point the unit is no longer moving yet it's still a suicide summon. That's when the problem happens...
if (!(player.AI_hasSummonSuicideUnit()))
The AI has a suicide summon unit, so we do NOT enter this if.
Because we do not enter that if we do not move any units the next turnslice.
Because we do not move any units the next turn slice, we obviously still have a summon suicide unit.
And so we have our infinite loop.

I have verified that by removing the if the infinite loop no longer happens.

I'm not sure why that check is there in the first place, every time we do not enter the if it should cause an infinite loop:
We do not move our units because we have a suicide summon
Because we do not move our units we still have a suicide summon, as that is the only way to set the bool to false!

yes, the call to AI_hasSummonSuicideUnit can be removed, well the whole function can be removed. Turned out it wasn't necessary. The code is an artifact from a very early wildmana version.

Thanks guys, I'll make the changes!
 
Sweet. Also any chance of getting suicide summons to work properly for the AI? Great fun getting invaded by 40 Amurite wizards all with fire 2 and slaughtering the lot of them cause they never cast fireball. And picking off Sons of the Inferno cause the fire elementals just walk past everything.
 
Yay, I helpful! (If even not as originally intended)
 
What does WoC mean? I tried googling it but all that game up were threads of Breunor talking about WoCs and irrelevent stuff.
 
Top Bottom