Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#10218 closed defect (fixed)

SCI: QFG2: Crash when exiting multiple Jackalmen carnage

Reported by: EricOakford Owned by: m-kiewitz
Priority: high Component: Engine: SCI
Version: Keywords: script-bug
Cc: Game: Quest for Glory 2

Description

ScummVM version: 1.10.0git4929-g5af8ed228d
Game: Quest for Glory II DOS 1.105
OS: Win7-64

After killing a horde of Jackalmen, attempting to exit the room crashes ScummVM with this error:

"ERROR: lookupSelector: Attempt to send to non-object or invalid script. Address 0000:0000, method ego::distanceTo (Room 665, script 998, localcall ffffffff)!"

I have attached a save with this bug. Is this related to the memory leak that Corey Cole mentioned before?

Attachments (1)

qfg2.081 (34.7 KB ) - added by EricOakford 6 years ago.
Savegame just after defeating Jackalman horde. Exiting the room crashes the game. (DOS 1.105)

Download all attachments as: .zip

Change History (12)

by EricOakford, 6 years ago

Attachment: qfg2.081 added

Savegame just after defeating Jackalman horde. Exiting the room crashes the game. (DOS 1.105)

comment:1 by dafioram, 6 years ago

Thanks for your submission. Unfortunately, my QFG2 is version 1.102 from GOG, therefore I cannot load your save.

I can't find a patch to 1.105 so someone with 1.105 (like from the Quest For Glory Anthology) will have to look into this.

comment:2 by m-kiewitz, 6 years ago

It seems it is a game bug.
http://www.oocities.org/timessquare/arcade/7435/QFG2/qfg2_FAQ.htm

"At night, after defeating and looting a pack of jackalmen, sometimes the game crashes with a "Oops. You've done something we didn't expect you to do!" error. What did I do?"

"This is a known bug that happens occassionally when encountering jackalmen."
"Make sure you save when you first encounter a pack in the desert, and then engage them in combat."
"Try to leave the screen afterwards, and if the game crashes, simply restore and run awy from the encounter."
"You'll still be able to fight jackalmen most of the time, as the crash only happens intermittently."

I doubt it's some memory leak. It may be a script bug, possibly overwriting some memory and/or creating an inconsistent state.

comment:3 by m-kiewitz, 6 years ago

Did you get any special loot? Maybe lots of money?
I guess it will be a pain to figure out, because we only got the end result (effectively broken save state). I need to figure out how the desert is working script-wise.

comment:4 by m-kiewitz, 6 years ago

I'm adding the Corey + Lori Cole QA part about those enemies on here, because GamingOnLinux seems to make archive.org not work on them. Would be a shame to lose this info. The original info linked from the Wiki is already not working anymore.

"What was the most difficult/annoying/challenging/diabolical bug you remembers ever having to fix or work around."

"Well, we never actually found the memory leak in Quest for Glory 2 combat with the Jackalmen. That slowly ate up memory so the game would crash in an entirely different place, often near the end when it was most frustrating. Memory issues are frequently the hardest to find and debug, partially because debugging them can affect the behavior."

So I guess that specific problem may also happen in ScummVM (as in memory getting leaked within the scripts), but it shouldn't really be a problem. Original SCI had limited amounts of memory available for that. We don't.

In any case it seems this here is another issue with that specific enemy.

comment:5 by m-kiewitz, 6 years ago

Is it difficult for you to recreate this?
I would be really helpful, if you could make a saved game before fighting. Then another save after fighting. I don't know how rare this is.

It seems that part of the game still thinks that a fight is supposed to happen and/or an enemy is still following you, while actually there is no enemy.

comment:6 by m-kiewitz, 6 years ago

Oh I see it now.
The game treats Jackalmen differently and seems to have a variable holding the count of current (alive) Jackalmen.

And that count is -4 for your saved game.

Do you still know how many enemies you did fight? It seems it's an overflow somewhere.

comment:7 by m-kiewitz, 6 years ago

Keywords: script-bug added
Owner: set to m-kiewitz

comment:8 by wjp, 6 years ago

After two long debugging sessions, m_kiewitz and I figured out how to reproduce it.

You (probably) need animation speed set very high and good attack skills, and then attack so quickly that you effectively land two finishing blows on the last jackalman. (There don't have to be multiple jackalmen.)

The second finishing blow will cause jackalMan::endCombat to be called a second time, which will make the number of active jackelmen negative, which will then confuse everything.

comment:9 by m-kiewitz, 6 years ago

Finally fixed with script patch in commit 6f163b9.

If you need your saved game fixed, I can tell you how. It won't get fixed by the script patch, because the damage has already been done.

Last edited 6 years ago by m-kiewitz (previous) (diff)

comment:10 by m-kiewitz, 6 years ago

Resolution: fixed
Status: newclosed

comment:11 by StefanJaworski, 5 years ago

Hi, sorry to bring this up so much later. I accidentally saved my game after fighting a pack of jackalmen and now I have a broken save game (with lots having being done since the last one).

Can you please explain to me which parts of the savegame I need to modify to fix the negative value?

Note: See TracTickets for help on using tickets.