[BUG] "No Pause" talisman sometimes fails when pause was not pressed [FIXED]

Started by WillLem, June 03, 2024, 06:32:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WillLem

Paiy has reported two levels not awarding the "No Pause" talisman (on Discord). I also noticed this happening several times whilst playtesting Lemminas Origins, and did attempt to fix it in commits 00989847d - b76c92531. It seemed fairly watertight after that, but since paiy has confirmed being on the latest version of SLX (2.7.3) and playing without pressing pause or loading a replay, it's clear that more needs to be done.

Currently, the No Pause talisman fails in any of the following conditions:

1) Pause was pressed at any time during playing the level
2) A replay of the level was loaded at any time

Checking for pause is not a problem: if the pause button or hotkey is pressed, a flag is set to true and it remains true until the end of the level, at which point the talisman is failed. If the user restarts the level, the flag is set to false.

What's more likely to be the issue here is checking for a replay having been loaded. Many in-game actions can cause a replay to be inadvertently loaded (backstepping, rewinding, restarting, even changing the release rate) and it's very difficult to keep track of them all for the purposes of this talisman.

Maybe, then, we should only check for a replay being loaded if it's explicitly loaded from a replay file. In all other cases, we check only for button/hotkey presses (backstep, rewind, restart) to determine whether this action should fail the talisman:

Backstep and rewind should, obviously. Restart should only fail it iff the user has "replay after restart" behaviour activated and pause was pressed at any time during play - furthermore, we already allow 55 frames' grace to cancel a replay if the player paused, restarted (with replay after restart activated), and then cancelled immediately - in real terms, the player has until the music starts to cancel.

From a quick look at the code, the "replay was loaded" flag (which fails the talisman) is set to true and false in lots of places, likely due to the number of actions that can trigger a replay load. This is not good, and shows that we need a more watertight solution.

So, I propose two fixes for this:

:lemming: The first is to remove the "replay was loaded" flag and replace it with something which only tracks player input - no automatic in-game processing events should be responsible for failing the talisman.

:lemming: The second is to draw some sort of marker to the panel to explicitly show the status of "no pause" - visual feedback provides the player with assurace that their playthrough will pass the talisman, whilst also making it easier to find the cause of any bugs, should they arise in the future.

WillLem

Fixed in commit 1983a3535.

We now have a single check (CheckReplayLoaded) & flag (fReplayLoaded) which handles any case of a replay being loaded. If the check finds action on any future frame, the flag is set to true and remains true for the rest of gameplay.

The flag can only be set to false by restarting the level in-game, or reloading the same level / loading a new level from menu (it's initialized to false at the start of gameplay). If the player has Auto-replay activated, there are 55 frames' grace (until the music starts!) to cancel out of the replay.

This seems to be working well so far, and also catches MRC since the check is called from the Update procedure - yes, we're checking every update now, but this is better than a flag getting set to true/false all over the place with (sometimes) no chance of being correctly reset, which was previously the case.

Furthermore, CheckReplayLoaded is immediately exited from if there is no Classic Mode or No Pause talisman.




I think this is good enough to fix the issue for now. If I get any other reports of a No Pause talisman being failed despite being played correctly, or if I notice it myself, I'll add a visual indicator; I'd rather not go down that route at present.