Announcement: Be excellent to each other.


Caravel Forum : DROD Boards : Bugs : Undoing a cutscene and mimics
New Topic New Poll Post Reply
Poster Message
CuriousShyRabbit
Level: Smitemaster
Rank Points: 3170
Registered: 10-14-2006
IP: Logged

File: Bug.JPG (25.3 KB)
Downloaded 369 times.
License: Public Domain
icon Undoing a cutscene and mimics (+2)  
The Rabbit is officially confused.

Here's a picture.


I'm playing Chaosgamer's hold Empire's power: The great stalwart battle, which is currently in HA. The picture is from Speed potion factory 3S6W.

In this room, there is a script that makes the monsters faster than the player.
Label "loop"
     Wait 1 turn(s)
     Cut Scene 1
     Wait 1 turn(s)
     Cut scene 0
     Go to "loop"
The player is supposed to remove some tar blocks in order to open a black door. A couple of mimic potions are provided.

After I place the first mimic, I start having troubles with undo. An example is the picture above. I start on turn 64 by moving Beethro W to kill a tarbaby. Then the scripted cutscene occurs, and we skip ahead to turn 66, where a tarbaby who has moved twice clobbers Beethro. I then press undo, but instead of returning to the situation in the top picture, I end up in the alternate reality of the bottom picture. If I then move Beethro E to kill a tarbaby, get clobbered, and press undo, I'm back in the first picture.

The picture above doesn't show the only problem I have with this room, after placing a mimic. It is also possible to play along safely, press undo, and arrive in an alternate reality where Beethro is under a tar baby, getting clobbered again. And occasionally, pressing R to restart from the previous checkpoint results in a completely black screen, except for Beethro under a tar baby, getting clobbered.

There's lots of beeping too. After placing the mimic, every time I undo a cutscene, DROD.err gets the following line:
Assertion error in line 1264 of .\CurrentGame.cpp: "nCommand == CMD_DOUBLE"
This bug occurs in DROD 3.2.0.83.

[Last edited by CuriousShyRabbit at 09-12-2010 04:37 AM]
09-12-2010 at 04:35 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
TFMurphy
Level: Smitemaster
Rank Points: 3118
Registered: 06-11-2007
IP: Logged
icon Re: Undoing a cutscene and mimics (+5)  
Okay, let's see if I can decipher this.

The cause of all this is what DROD expects from the command list when you pick up a Mimic/Clone/Decoy Potion. On replays, it will immediately expect that once you pick up the potion, the next command will be placing the double.

This doesn't follow in two circumstances: when you're asked a Question, and when a Cutscene is running. In the former, the Question takes priority. In the latter, a Cutscene will prevent you from using normal movement commands other than Wait and clicking on the screen (metacommands are still allowed though), and it will send Waits every so many milliseconds.

Question/Answer shouldn't *immediately* cause problems, because they're already given priority when seen. They do cause an Assertion though, so the relevant lines that check for CMD_DOUBLE should also check for CMD_YES, CMD_NO and CMD_ANSWER. And they also break savegames, since DROD will see a lack of CMD_DOUBLE as meaning that it should convert old demo data, and will thus discard Answer commands and then possibly complain that it's found a CMD_DOUBLE... so we should probably update CCurrentGame::PlayAllCommands to fix that.

Cutscene waits are a thornier problem. For starters, when you're playing ingame, the Cutscene will start running and then prevent you from making *any* movement or placing the double until the first automatic wait is sent. At that point, the game will read it as attempting to place the double exactly where your cursor is (and usually fail since you're there, but it gets a bit stranger if a Player Role None is called on the same turn). Whether this succeeds or fails, it counts as a processed command, and it will then terminate the cutscene because the character scripting doesn't have a chance to keep the cutscene going during this extra turn.

When you come to actually undoing the turn and causing the game to replay the saved commands, then we start hitting more problems. I'm not exactly sure why crashes and gamestate breakage occur though. The first cutscene Wait should cancel the cutscene and fail to place the Double (usually), leaving the game to place the Double as normal (which would be the next command). There may be a problem elsewhere that this difference is highlighting.

===

Either way though, there is a very clear problem: cutscenes are still attempting to run while you are placing the results of a potion. There's a few possibilities available to deal with this, but I'd assume that since the Mimic placement currently takes priority and already cancels a cutscene, then it should continue to take priority and be coded as such, especially since this solves the problem of DROD expecting a CMD_DOUBLE immediately after a potion is drunk. This means that cutscenes should *not* attempt to run during Double Placement. So to start with, we'd want the following extra routine added:

currentgame.h
Click here to view the secret text

This new routine should be used to replace most dwCutScene checks that are intended to stop the player from entering commands or cause the game to send automatic Wait commands for the player. (But it shouldn't replace the checks that shouldn't change whether there's a Mimic being placed or not.) This allows the player to place a Mimic/Clone/Decoy on the first turn of a Cutscene, stops assertions and savegame bugs by causing CMD_WAIT to be added during double placement, and should prevent the gamestate problems and crashes related to this.

Secondly, we probably *don't* want to cancel the cutscene just because a Double was placed. If this is the case, then we need to update the following code:

CCurrentGame::ProcessCommand
Click here to view the secret text

EDIT: Actually, don't think we need a new variable: we can just reuse bContinueCutScene, since it's only ever used to stop a cutscene during ProcessCommand and is only ever set to false near the start of a ProcessCommand. Have edited proposed code to reflect this.

===

I'm not sure that solves *all* the issues, and Question/Answer interactions might have more hidden surprises waiting to be pulled out. But I think this should at least solve the main issue with Double Placement during cutscenes.



[Last edited by TFMurphy at 11-02-2010 02:02 PM]
11-02-2010 at 06:04 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
CuriousShyRabbit
Level: Smitemaster
Rank Points: 3170
Registered: 10-14-2006
IP: Logged
icon Re: Undoing a cutscene and mimics (0)  
Hi TF, thanks for trying to explain this. Looks like you uncovered a new issue with questions that hasn't even come up yet! :)

But did you actually play the room in Chaosgamer's hold?

The problem shown above occurs not just on the one turn of mimic placement, but on every turn following mimic placement. In the screenshot above, the mimic was probably placed around turn 40 or so. Every turn after placing the mimic that I try to undo gives the assertion error. Sometimes you can see how undoing takes you to an "alternate reality" and sometimes you can't. The screenshot above was chosen as a pretty dramatic illustration of the "alternate reality" problem.

I think there's more to find here...
11-02-2010 at 06:40 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
TFMurphy
Level: Smitemaster
Rank Points: 3118
Registered: 06-11-2007
IP: Logged
icon Re: Undoing a cutscene and mimics (+2)  
No, no, that's what I meant. The *cause* is taking the Mimic Potion on a cutscene turn. The effect then happens any time you try to undo, reload saves, etc.
11-02-2010 at 12:53 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
CuriousShyRabbit
Level: Smitemaster
Rank Points: 3170
Registered: 10-14-2006
IP: Logged
icon Re: Undoing a cutscene and mimics (0)  
Oh I see. Thanks! Sorry for the misunderstanding!
11-02-2010 at 05:16 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5058
Registered: 02-04-2003
IP: Logged
icon Re: Undoing a cutscene and mimics (0)  
That does sound like a finicky issue. Your changes sound good, TFMurphy. Even if they might not catch everything, like you indicate, it will still be better than what we have now, and will ostensibly resolve this bug. You may commit the fix at will. How would you like to proceed?

____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.
12-28-2010 at 04:32 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
TFMurphy
Level: Smitemaster
Rank Points: 3118
Registered: 06-11-2007
IP: Logged
icon Re: Undoing a cutscene and mimics (+1)  
Fix posted to SVN.

I had hoped to figure out exactly why crashes was happening even though the initial cause of the confusion was known... I really couldn't figure out why Cutscene Waits in the wrong place was causing demo breakage and crashes (assertions and misplaced double to start with were, of course, always going to happen).

In any case, I've gone through and added in the changes to hopefully fix this issue. Questions, Mimic Placement and Cutscenes all seem to be working together nicely now.

I did make a small change to the demo validation rule, making sure that an extra turn isn't added if a Question is answered during Mimic Placement. This was necessary to prevent demos made in TCB (that have the above situation) to not immediately report themselves as broken, but I'm not sure this won't cause earlier JtRH demos to report as broken instead. They shouldn't do, and the circumstance they check for would break JtRH demos anyways (ANSWER/YES/NO command during Double Placement), but we might want to keep an eye out anyhow.

[Last edited by TFMurphy at 12-29-2010 05:03 PM]
12-29-2010 at 04:58 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Bugs : Undoing a cutscene and mimics
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.