[?][SUG] Rewind button / hotkey

Started by WillLem, March 19, 2023, 09:38:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WillLem

#15
Quote from: Simon on July 10, 2024, 06:54:32 PM
Assuming your observations still apply to your recent versions, I expect the biggest gains from:
  • (biggest gain) Find the conceptual difference between the one-shot n-tick rewind and rewind mode. Without looking at your codebase, I imagine that it's best for rewind mode to be implemented in terms of the (backend of the) one-shot rewind-n-ticks technology.

Since implementing Rewind as a game speed, some of the refactoring has Rewind behave (exactly) like Pause, rather than using Pause separately to prevent physics updates. This already seems to have boosted performance, but there is more to be gained.

The actual rewind mechanism is 1:1 identical to a normal backskip; the exact same method is called (GameWindow line 583 in the linked commit). The repeated keypress is simulated using a TTimer event, which seems a stable enough solution (especially compared to some of the other methods I tried).

I tested the actual repeat keypress again on a level with lots of objects and lots of skill actions; it's actually not that much better than the Rewind mode - there is still some drag now and again when there is a lot of drawing happening.

Quote from: Simon on July 10, 2024, 06:54:32 PM
(also big) Savestate more often.

I'm going to try this, but I need to figure out how to do it first.

namida

Yeah, NL could be making save states far more often. I was worried about the performance impact of doing them regularly when I implemented them. I never specifically tested the "is making more of them alright" angle; only the "does it give good enough results for backstepping".

Compression would make them less performant, which is a concern if they're being taken regularly. On the flipside though, regular save states - unless they're getting overwritten / discarded very frequently too (which may not be a bad idea) - will take up more memory. How well they'll compress is a concern too - it's likely only the physics maps and the visual terrain map that are actually worth compressing. The physics maps at least should compress very well. I don't know how necessary compression really is in NL's (or forks thereof) case, but if you did want to go down that road, it may also be worth looking into whether compression can be handled in a seperate thread.

The other thing I'd raise is that a very good idea is for the game's active state to also be a "saved state". NeoLemmix doesn't use such an approach because rewinding (and in turn, save states) were a later addition there; but in the case of Loap, which was built with this facility in mind from day one, the game's current state that gets updated by the engine each iteration, etc, is also an instance of the SavedState class (or whatever I named it). This helps to ensure that everything that needs to be part of the state, is part of it.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

WillLem

Still getting the occasional bit of sass from the Rewind button.

It's now behaving better than ever since its implementation as a GameSpeed, and I haven't yet tried savestating more often, so I'll definitely give that a go before calling it a day on this.

However...

If I can't get Rewind to behave 100% reliably by the time version 3.0 is due for release, it may have to go. Culling it is not something I want to go through with, because I love having it on the panel and it does work great 99% of the time, but there are still those occasional noticeably large skips (likely where hyperspeed has been interrupted early for some reason - it tends to only happen very near the beginning of the level, which may give some clues as to the cause), and I've had to implement a fairly drastic bugfix for the button highlight (Rewind speed is now checked for every tick, and the button highlight is removed if it isn't active).

I'd have to play an entire pack of levels only ever using Rewind for backstepping purposes, and not have any issues with it, to want to keep it. The rest of the UI is impeccable, and so should this be. There are lots of things to try first, and try them I will, but I thought I'd better put the word out early just in case.

If it does get culled, the button will most likely be replaced with a simple Backstep button similar to the half-button on NL's panel but made full-size: click-and-hold will repeat skips, different mouse buttons will perform different-sized skips, etc. It may even be worthwhile to add an option for the amount of frames this button should skip as well. No need for a hotkey because it's already possible to set time skip hotkeys anyway. Visually, I'd most likely aim to retain as much of the Rewind button's current aesthetic as possible, but it would have to look somewhat different to distinguish it clearly from the Rewind button.

I might as well ask at this stage: does anyone prefer the sound of this as opposed to the current Rewind button?