Author Topic: [SUG] Playback Mode (auto-play replays)  (Read 213 times)

0 Members and 1 Guest are viewing this topic.

Offline LJLPM

  • Posts: 404
    • View Profile
[SUG] Playback Mode (auto-play replays)
« on: May 04, 2024, 10:15:45 AM »
Hi,

Recently, I thought about a feature that I would find "useful" : I would be interested in having a "Screensaver Mode".

- when selecting the "Screensaver mode" , SuperLemmix would just play random replays indefinitely, until one quits this mode.
(with the possibility to have 100% no sound while the "Screensaver mode" is active, of course.)

Sounds interesting or not ?

Thanks! :)

PS: for the Screensaver/Replay mode, I would like to load random replays for SuperLemmix among ALL the available replays found on the computer (in any level pack thus, mixing Classic Lemmings levels and fan-made levels)

Offline WillLem

  • Moderator
  • Posts: 3473
  • Unity isn't sameness, it's togetherness
    • View Profile
Re: [SUG] Playback Mode (auto-play random replays)
« Reply #1 on: May 04, 2024, 08:07:28 PM »
This one seems very similar to this idea, which seemed to have a good amount of support from multiple users. Namida also seemed to think that the codebase would support it in all but auto-scrolling the screen according to the user's mouse movements.

As of 2.7, SuperLemmix now has .nxrp file association - i.e. if you right-click a .nxrp file in Windows and associate it with SuperLemmix.exe, then double click the .nxrp, it will open SuperLemmix and auto-load both the level and the replay (albeit to Preview screen rather than opening the level directly - this is so that the user can make sure that the correct level has been loaded). There is also the Mass Replay Checker, which already auto-plays replays, it just doesn't render them.

In theory, we could harness these capabilities to play multiple replay files back-to-back. We'd generate and store a list of replays from a specific directory, and then auto-load each one in turn, always bypassing the Preview/Postview screens (or, perhaps, displaying them for 5 seconds or so between levels).

Not out of the question, and we may even be able to address the issue of screen movement not being saved in the replay - it seems like this would almost be a must for this feature anyway. At the very least, auto-loading replays shouldn't be too difficult even if we can't also record screen movement. We just generate a list, then iterate through the list matching each replay to a level file, load the level, load the replay, move on to the next one. It'd probably be best to skip any cases of "level not found" as well.

With that in mind - as of 2.8, SuperLemmix will have the ability to write a replay's Mass Replay Check result to the filename (I'll see if it's also possible to write the result to the replay file itself), that way we could have the proposed auto-play/"screensaver" feature only play successful replays.

Then, it would be up to the user whether they wanted to load only replays for a specific pack, or for a random selection of levels. The button would open a file browser, and you'd select which folder of replays you wanted to play.

I've added this one to the wish list.
« Last Edit: May 17, 2024, 09:47:27 PM by WillLem »

Offline LJLPM

  • Posts: 404
    • View Profile
Re: [SUG] Playback Mode (auto-play random replays)
« Reply #2 on: May 07, 2024, 03:35:20 PM »
Hi,
Thank you for your detailed reply and for adding my request to the wish list :)

Offline WillLem

  • Moderator
  • Posts: 3473
  • Unity isn't sameness, it's togetherness
    • View Profile
Re: [SUG] Playback Mode (auto-play random replays)
« Reply #3 on: Today at 12:04:37 AM »
Made a surprising amount of progress with this today. We now have a Playback Mode button in the Level Select Menu:



As well as looking pretty, this button opens up a dialog from which a folder of replays can be selected. Once chosen, SLX will then iterate over each replay in the folder, matching it up with a level from within the currently-active pack (note: at this point, it only looks in the currently-active pack for matches - this could be expanded to it searching the entire levels directory, but this may make loading slower). The "currently-active pack", in this case, is the parent pack of whichever level is currently selected in the Level Select treeview.

Each replay is then played back automatically, one after the other (the preview and postview screens are briefly seen in between each level). If a level has multiple replays associated with it, each one will be played back as and when the replay appears in the Playback list.

Playback Mode can be cancelled by simply cancelling the replay as normal (I might give this a dedicated hotkey if people think it's worth it - it's possible that users might cancel the replay by accident, and also users might want to do something within the current level, but then go ahead with playback again for the next level, which is currently possible if we don't cancel Playback Mode along with a normal replay cancel).

Some issues:

1) The preview screen always shows the first level in the list's info, even though the correct level is loaded when playback itself starts
2) The music is always that of the first level in the list - this is likely part of the same problem, but I'm not sure exactly what's going wrong
3) If a replay doesn't have a definite "end" point (so, if the original player pressed [Esc] rather than nuking at the end of Tailor-made For Blockers, for example), the level will continue to play indefinitely - not sure exactly what to do about this at the moment, but ideas will come
4) Not an issue as such, but randomizing the playback currently isn't possible by any other means than manually mixing up the replay files so they're not in logical order. Let's get the other issues sorted first and get the feature nice and tight, then we can look at expanding functionality to randomization of playback, etc.

If you're interested, check out commit 80da87c02 to see implementation so far. If you can see possible improvements or ways to fix the above bugs, input would be most welcome.

Otherwise, just watch this space!
« Last Edit: Today at 12:38:55 AM by WillLem »

Offline WillLem

  • Moderator
  • Posts: 3473
  • Unity isn't sameness, it's togetherness
    • View Profile
Re: [SUG] Playback Mode (auto-play replays)
« Reply #4 on: Today at 02:16:14 AM »
OK, I think I know what the problem is.

In SLX, a level exists as 3 different things:

1) The file itself
2) A TNeoLevelEntry, which stores the basic level information (title, levelID, etc)
3) A TLevel, which stores the more complex information (skillset, talismans, plus whether or not the level was successfully passed, etc)

I need to find a way to create a TNeoLevelEntry from the file. I can do that for the purposes of playing back the replay, but not loading the actual information. It's baffling, but nothing I haven't encountered from this codebase many times before. I'll get around to it.

A Rount Tuit (click to show/hide)
« Last Edit: Today at 12:16:07 PM by WillLem »

Offline WillLem

  • Moderator
  • Posts: 3473
  • Unity isn't sameness, it's togetherness
    • View Profile
Re: [SUG] Playback Mode (auto-play replays)
« Reply #5 on: Today at 12:15:26 PM »
Fixed the incorrect Preview screen & music loading bug. The important thing was to first update the CurrentLevel in GameParams, and get all subsequent levels having correctly loaded that one (or, more specifically, that one's parent group).

What this does mean is that, at least for now, we won't be able to search the entire level file directory if a match isn't found in the currently-active-pack. I plan to update that in the future if at all possible, but for now it's good to have this feature working solidly.

Commit 6f6ed62bf implements this fix.