Home » MODDING HQ 1.13 » v1.13 Bug Reports » CHANCE_SAY_ANNOYING_PHRASE <100 randomly causes a crash (Was "Drassen Big Counterattack crash")
icon9.gif  CHANCE_SAY_ANNOYING_PHRASE <100 randomly causes a crash[message #361303] Tue, 15 September 2020 19:57 Go to next message
Kurt

 
Messages:335
Registered:March 2004
Drassen's big counterattack (when you have taken all Drassen) is my favorite moment in the game.
So, here I am with my test team (about 15 mercs), and watch enemies slowly gather around the Drassen mine sector. The other Drassen sectors are full of militia, but not this sector, this one is full of my best mercs, on rooftops, armed to the teeth...
At some point the enemies attack, I'm asked if I want reinforcements (no, I don't) - and then JA2 8796 crashes in every possible way... suprised
It either goes simply away, back to the desktop, or some corpse of it remains till Windows offers to kill it.

I did have a couple more articulate crashes though (tried this a dozen times, to see if this was a fatality or if I could enjoy my massacre).
They usually said one of those two (randomly):

Runtime Error
vobject.ccp
line 922
BltVideoObjectToBuffer
No Source object

Runtime Error
LuaInitNPCs.cpp
line 13250
LuaHandleAdditionalDialogue
Cannot open scripts\Overhead.lua
(For what it's worth, Scripts\Overhead.lua exists, and is readable by me. I didn't change it, I don't speak Lua.)

I previously had experienced other counterattacks (smaller though) which didn't crash the game. (Though I did have several crashes too, way more than I was used to have with 3356.)

Anyway - As far as I can see in the strategic screen, the initial invasion wave of the Drassen counterattack is about 20 enemies (reinforcements possible). My MAX_NUMBER_ENEMIES_IN_TACTICAL = 40, so I guess it can't be too many enemies. There are about 15 mercs there, IMPs, AIMs, MERCs.

The game crashes always at the end of the strategic/tactical screen transition: One of my mercs has the time to say his/her "enemy in sector" line, and then it's dead. So I tried to outsmart the problem, and instead of accelerating time in the strategic screen as usually, I remained downstairs, in the tactical screen, and just waited in real time (I had noted when the attack starts).
Unfortunately when the enemies arrived, the @#§& stupid game decided to go back up to the strategic screen - only just so I could go back down to the tactical one! Bang head
As a result I got a crash, one with the "Lua" error above.


I'm stuck. That was my shortest JA2 playthrough in 20 years... crying


---- Edited to add:

I found what causes this crash.
See my post further down (the post with red letters, easy to spot!).

Also, changed thread title to be more specific. Old title was "Drassen Big Counterattack crash".
.

[Updated on: Sun, 04 October 2020 15:52]

Re: Drassen Big Counterattack crash[message #361304 is a reply to message #361303] Wed, 16 September 2020 00:17 Go to previous messageGo to next message
SinMachina

 
Messages:48
Registered:August 2020
Since it is mentioning AdditionalDialogue ; could you possibly tell us who you have in that sector? It might be something to do with having too many dialogues trying to happen at once [due to particularly chatty people].
Re: Drassen Big Counterattack crash[message #361309 is a reply to message #361304] Wed, 16 September 2020 14:47 Go to previous messageGo to next message
Kurt

 
Messages:335
Registered:March 2004
SinMachina wrote on Tue, 15 September 2020 23:17
who you have in that sector?
- 8 IMPs (yes I went overboard, but it's the only way to easily test the new traits, by creating a bunch uber-specialists)
- Magic
- Scope
- Rudolph
- Boss
- Beth
- Leon
- Grunty
- Ira


It happens indeed always after/during the mercs' "Enemies in the sector!" speech, but why would this part be broken all of a sudden?

And anyway, that's just one type of recurring error message. Even assuming the total crashes without error message are all only due to the two I caught, they are (at least to me) very different. There might IMHO be something else tipping the game over, and those apparently very different error messages might rather be the results than the causes. Obviously I don't know what is supposed to happen at that specific moment under the hood, so it's just wild guesses.
Re: Drassen Big Counterattack crash[message #361311 is a reply to message #361309] Wed, 16 September 2020 17:43 Go to previous messageGo to next message
edmortimer

 
Messages:1352
Registered:January 2015
Location: Home Free
This may not have anything to do with it but . . . MAX_NUMBER_ENEMIES_IN_TACTICAL = 40 . . . change it back to the default of 32. Why? Because only 32 enemies are detailed in each sector unless you go in an add another 8. I always assumed the game would spawn how many ever it needed but a nagging thought kept creeping up in my mind . . . the Map Editor manual strongly states there must be 32 enemies in each map sector, but it was written when 32 was the max number that could be in a sector.






Re: Drassen Big Counterattack crash[message #361317 is a reply to message #361311] Thu, 17 September 2020 14:13 Go to previous messageGo to next message
Kurt

 
Messages:335
Registered:March 2004
edmortimer wrote on Wed, 16 September 2020 16:43
I always assumed the game would spawn how many ever it needed but a nagging thought kept creeping up in my mind . . . the Map Editor manual strongly states there must be 32 enemies in each map sector, but it was written when 32 was the max number that could be in a sector.
That's true, but I'm pretty sure that's not the problem (unless they changed recently something in that part of the code): The option of having more than 32 enemies is a decade old, it already was in 3356, and I've played dozens of times in 3356 with the exact same setting of 40 without a problem.
I'd be tempted to interpret that as the difference between "32 enemies can already be in a sector" and "40 enemies can enter a sector", as the second (AFAIK) doesn't require map placement.


Anyway, to get back to my issue, I think SinMachina's suggestion might have merit: I noticed that 8796 has some strange hiccups concerning merc comments. Once, after picking up a good weapon, Boss couldn't stop throwing in exclamations for quite some time (with him you don't always know what they're about...). In olden days he would just had said his "good weapon" line and be done with it, so something is going on there.


I'll give it a second try this weekend, new game with the same team, doing things in about the same order, just to see if 8796 is indeed very fragile or if I just had exceptional bad luck (happens more often than one would think).

[Updated on: Thu, 17 September 2020 14:13]

Re: Drassen Big Counterattack crash[message #361326 is a reply to message #361317] Fri, 18 September 2020 01:58 Go to previous messageGo to next message
SinMachina

 
Messages:48
Registered:August 2020
So I had a similar issue actually. I hired a bunch of snitch mercs and threw in some love / hate relationship mercs, and ran the game for about a week without doing anything. When the snitch 'this person is going to leave' started up, the game started to overlap audio lines and display de-synced text boxes until I got a hard stopwatch lock. It took about 5 minutes of lines before the game got stuck, so extra dialog might be it? I didn't get a crash so I didn't get any error messages unfortunately.
Re: Drassen Big Counterattack crash[message #361333 is a reply to message #361326] Fri, 18 September 2020 16:43 Go to previous messageGo to next message
Kurt

 
Messages:335
Registered:March 2004
SinMachina wrote on Fri, 18 September 2020 00:58
It took about 5 minutes of lines before the game got stuck, so extra dialog might be it?
Well, in my case the game didn't just get stuck, each and every time it crashed, more or less violently, sometimes so hard the internal error handling wasn't able to kick in. This might indicate those are different errors.

Has the dialog serving code has been changed since 3356 anyway? I didn't hear about any change or new feature requiring somebody rewrite that part (but then I'm still exploring stuff), and if that part didn't change, why would it start falling over all of a sudden?


Only somebody familiar with the code can say when "vobject.ccp" line 922 and "LuaInitNPCs.cpp" line 13250 are called, and what the program was trying to do (and failed) at that point. I'm unfortunately no developer.
Re: Drassen Big Counterattack crash[message #361346 is a reply to message #361333] Sun, 20 September 2020 16:24 Go to previous messageGo to next message
Kurt

 
Messages:335
Registered:March 2004
OK, this time I managed to get past the Big Drassen Counterattack without crashes. big grin
Same team, same placement on the map, but IMHO there were a little less enemies this time (still so many they had to come in 4-5 "reinforcements" waves).

One thing I noticed is that, indeed, something has changed in the "merc speech" code since 3356: Now it seems each and every merc able to see an enemy enter the map has to give his "Enemy alert!" line, and after that his "Too many enemies!" one...
Which means that you have 20 mercs on rooftops, you'll sit through 40 exclamations - Each turn, as enemy reninforcements enter the map...

Till 3356 only one NPC merc said something, only IMPs were chatty (I guess their speech wasn't controlled since the game isn't expecting more than one IMP).

(BTW, my CHANCE_SAY_ANNOYING_PHRASE = 40 - If that setting has anything to do with that ("annoying phrase" is a rather vague description).)


IMHO there should be a hard limit on how many mercs can comment on a banal event like an enemy sighting. Yes, enemies are here, we're in a war, so you'd expect to see some. Deal with it. They're supposed to be a bunch of hardened mercenaries, not an old ladies' book club.
On the other hand I could understand all mercs saying something the first time they see a bloodcat or a crepitus, since those are totally unexpected and uncommon creatures.


Or is there perchance already a way to tell the game to limit the enemy sighting exclamations to the strict minimum?
Re: Drassen Big Counterattack crash[message #361380 is a reply to message #361346] Sat, 26 September 2020 14:57 Go to previous messageGo to next message
Kurt

 
Messages:335
Registered:March 2004
All right, I found what causes this bug.
It kept bugging me, I kept experimenting, and eventually I noticed it is tied to the CHANCE_SAY_ANNOYING_PHRASE = 40 setting I have in the options.ini.


So, for bigger battles (in this case the big Drassen counterattack),

CHANCE_SAY_ANNOYING_PHRASE = 0 yields an immediate and violent crash, with interesting sound effects...
CHANCE_SAY_ANNOYING_PHRASE = <100 randomly causes a crash (depending on enemy numbers I guess?).
CHANCE_SAY_ANNOYING_PHRASE = 100 means no crash, just having to wait through the chatter.

So the problem is clearly in the "annoying chatter avoidance" code.

(Thanks to SinMachina for putting me in the right track. thumbs up)

[Updated on: Sat, 26 September 2020 15:02]

Re: Drassen Big Counterattack crash[message #361381 is a reply to message #361380] Sat, 26 September 2020 15:19 Go to previous messageGo to next message
sevenfm

 
Messages:2317
Registered:December 2012
Location: Russian Federation
Last related commit is r8658:
Quote:
If a gun has a magazine size < 5, the 'out of ammo' soundfile is only displayed with a chance of CHANCE_SAY_ANNOYING_PHRASE (JA2_Options.ini). This should make using guns with tiny magazine sizes less annoying.
 if ( pSoldier->flags.fSayAmmoQuotePending && ( Chance( gGameExternalOptions.iChanceSayAnnoyingPhrase ) || GetMagSize( &pSoldier->inv[pSoldier->ubAttackingHand] ) > 4 ) )
{
    pSoldier->flags.fSayAmmoQuotePending = FALSE;
    TacticalCharacterDialogue( pSoldier, QUOTE_OUT_OF_AMMO );
}
You can try r8644 from my google drive and see if it crashes.

Maybe the code should be changed to something like
 if ( pSoldier->flags.fSayAmmoQuotePending )
{
    pSoldier->flags.fSayAmmoQuotePending = FALSE;
    if (Chance(gGameExternalOptions.iChanceSayAnnoyingPhrase ) || pSoldier->inv[pSoldier->ubAttackingHand].exists() && GetMagSize( &pSoldier->inv[pSoldier->ubAttackingHand] ) > 4)
    {
        TacticalCharacterDialogue( pSoldier, QUOTE_OUT_OF_AMMO );
    }
}
so that the fSayAmmoQuotePending flag gets cleared anyway.

[Updated on: Sat, 26 September 2020 15:36]




7609+AI (r1705) | Unofficial modpack | Win8+ fix | Experimental project | Youtube | Trunk (r8908) | 1.13 Starter Docs

Кто в Москве не бывал, красоты не видал.


Re: Drassen Big Counterattack crash[message #361383 is a reply to message #361381] Sat, 26 September 2020 15:54 Go to previous message
Kurt

 
Messages:335
Registered:March 2004
sevenfm wrote on Sat, 26 September 2020 14:19
"If a gun has a magazine size < 5, the 'out of ammo' soundfile is only displayed"
I don't think that's the cause in my case: The smallest magazine size my mercs have is 5 (nobody has a shotgun).

The crash seems to be triggered by/during the flood of "Enemies in the sector!" and "OMG I see a lot of enemies!" type exclamations of my 20 mercs. It happens the instant the enemies appear, right after (or during) the first "Enemies!" comment.
Previous Topic: Bug with arriving newly hired mercs
Next Topic: "Ammoflag 4" negates "usPiercePersonChanceModifier"
Goto Forum:
  


Current Time: Sun Oct 25 02:15:56 EEST 2020

Total time taken to generate the page: 0.01429 seconds