Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NewRoom error in old Downfall (2009) release #2424

Open
tag2015 opened this issue May 10, 2024 · 5 comments
Open

NewRoom error in old Downfall (2009) release #2424

tag2015 opened this issue May 10, 2024 · 5 comments
Assignees
Labels
context: bw-compat supporting deprecated runtime functionality, importing and converting game data type: bug unexpected/erroneous behavior in the existing functionality

Comments

@tag2015
Copy link
Contributor

tag2015 commented May 10, 2024

Describe the bug
When accessing the "waxworks" room, Downfall (freeware version, released in 2009, AGS 2.72) fails with:
NewRoom: Cannot run this command, since there was a NewRoom command already queued to run in "Global script", line 379!

Seems similar to bug #2365

AGS Version
Latest 3.61 / 3.6.0

Game
download

To Reproduce
Steps to reproduce the behavior:

  1. Load save agssave.zip
  2. Click "waxworks" hotspot (top-left street)
@ivan-mogilko
Copy link
Contributor

ivan-mogilko commented May 10, 2024

This is strange, I specifically tried double sequential NewRoom() calls in older AGS (2.72 or earlier), and it appeared to be forbidden there as well. Maybe there's more to this...

@ivan-mogilko ivan-mogilko added type: bug unexpected/erroneous behavior in the existing functionality context: bw-compat supporting deprecated runtime functionality, importing and converting game data labels May 10, 2024
@ivan-mogilko ivan-mogilko self-assigned this May 10, 2024
@ivan-mogilko
Copy link
Contributor

ivan-mogilko commented May 12, 2024

@tag2015, I tested this, and there's something curious. It looks like the error does not happen sometimes if you enter the security room (a small building with a "lever" on its corner) before going into "waxworks".

For a moment I thought that this is a game bug, but this error does not happen with the original executable even if you skip the security room.

Also this workaround is unreliable, sometimes it works and sometimes not... so maybe it's a random factor.
But I was able to make a save that always let to enter "waxworks". This makes me suggest that there's something in the script data (variables) that affects this outcome.

EDIT: when run under debugger, it's clearly seen that in failing case NewRoom is called twice, but in the "right" case it's called once.

@ivan-mogilko
Copy link
Contributor

ivan-mogilko commented May 12, 2024

More details.

Apparently, in this room (this is room 48) there are two exit triggers:

  1. A hotspot with "Waxworks" hint.
  2. A region on ground.

Both of them call NewRoom.
So what happens is that player reaches the hotspot by walking on the region in the process. Region calls NewRoom first, and then Hotspot calls it as a part of "click" interaction (which is run after player reaches the hotspot, apparently).

In the successful case region does not work for some reason, and only hotspot runs NewRoom.

This also hints a potential workaround: do NOT click on "Waxworks" area, but click somewhere around it where the exit name does not appear, and then only region will trigger, letting you through.

I cannot explain a difference between "successful" and "unsuccessful" cases yet, but there's clearly a mistake in the game design involved as well.
Unfortunately, the game is overall buggy. For example, clicking on "New game" sometimes does not start the game, but locks it in the blacked out state (this happens in the original exe too).

@ivan-mogilko
Copy link
Contributor

ivan-mogilko commented May 12, 2024

@tag2015, I am fairly certain that this is a combination of the actual mistake in the game script, and certain difference in the engine behavior, either pathfinding or something related to how interactions handled. Personally I lean towards pathfinding (see notes below).

The mistake in the game is described above: there are 2 exit triggers, one attached to the region, another to hotspot. Region is activated by walking, and hotspot is activated by clicking on it.
When you activate hotspot:

  1. Character tries to walk towards coordinates hardcoded as "walkto" hotspot's property.
  2. If she steps onto the region anytime during this walk, the region activates and calls NewRoom.
  3. This call occurs nested during walking INSIDE hotspot handling.
  4. So, after this NewRoom call chacter stops, execution returns up to the hotspot processing, hotspot runs its own interaction script, and another NewRoom call is made.

What could possibly be a fix to this?
In theory, the engine could test if the room change was requested after character walked towards the hotspot; and if it's so, then don't run hotspot's own interaction. But I do not have a conviction that this would be correct, and concerned that this may change behavior for other existing games.

UPDATE: I tried to recreate a similar situation in 2.72, where hotspot has a "walkto" position on a region, and both trigger NewRoom. And the same error occurs. This means that there's no difference in behavior in this regard.

While testing this room in "Downfall" I managed to exit successfully in certain cases, and the only difference was a different starting position before interacting the hotspot. In other words, if, by pure chance, character arrives to a hotspot's "walkto" position without stepping on a region, then it passes through.

But the better workaround, as noted above, is to not click on "waxworks" hotspot at all, but instead click on any unlabeled spot around it, thus making character to walk onto the exit region skipping hotspot interaction.

I fear that I spend too much time on this... so this is where I conclude my investigation.

@tag2015
Copy link
Contributor Author

tag2015 commented May 12, 2024

Wow, that's some in-depth debugging, thanks!

Unfortunately I don't have better ideas on how to tackle the issue, I'll think about it

By the way the game is indeed quite buggy, e.g. if you click Agnes (in the same room) it'll fail with another script error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context: bw-compat supporting deprecated runtime functionality, importing and converting game data type: bug unexpected/erroneous behavior in the existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants