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

Better control of what is an undoable interaction #24

Open
ClementSparrow opened this issue Aug 20, 2021 · 2 comments
Open

Better control of what is an undoable interaction #24

ClementSparrow opened this issue Aug 20, 2021 · 2 comments
Labels
feature New feature or request games Concerns the games: exported, gist-loaded, or played in the editor. polish Make the games or editor behave/look better question Further information is requested syntax/language Concerns the language or its syntax

Comments

@ClementSparrow
Copy link
Owner

Related to #23.

PuzzleScript has a "no undo to same state" policy: if after undoing, the level is in the same state than it was before the undo, then the engine keeps on undoing until it reaches a different state.

In addition to avoiding confusion, this policy allows avoiding undos for meaningless inputs like bumping into a wall or kicking a rock. And that's definitely interactions that we don't want to put in the undo stack. We want the players to be able to explore interacting with the world and still be able to backtrack quickly.

The problem is that the "no undo to same state" is probably not the best way to implement that. For instance, if you have elements in the level that use a randomized variant at each frame to make an animation (e.g., smoke, flames, wind in the grass, butterflies...) then the state will be different and bumping into a wall will be pushed to the undo stack (worse: imagine you have levels with such random elements and levels without, then the behavior of undo after bumping into a wall depends on the level).

Another example: if you have an avatar with four possible orientations, and bumping into a wall makes it turn to face the wall, then again you have a different state before and after bumping into the wall.

So, we probably need a better way to control what is an undoable interaction or what is a "same state".

@ClementSparrow ClementSparrow added feature New feature or request question Further information is requested polish Make the games or editor behave/look better games Concerns the games: exported, gist-loaded, or played in the editor. syntax/language Concerns the language or its syntax labels Aug 20, 2021
@m-ender
Copy link
Collaborator

m-ender commented Feb 21, 2022

Dario's fork has a nosave command which simply doesn't add the current turn to the undo stack. That seems like a good baseline functionality to have.

@ClementSparrow
Copy link
Owner Author

I have implemented nosave in commit 63761a3, I forgot it was mentioned in this issue. But it does not fix completely the issue.

I guess that in addition to nosave, we need ways to tell "objects in property XXX should be considered equal for the detection of change" (i.e., if one object in that property is replaced with another object in that property, then it's not a difference). Or "Ignore this object/property in the detection of change" (this will in addition ignore differences when an object in that property is created or destroyed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request games Concerns the games: exported, gist-loaded, or played in the editor. polish Make the games or editor behave/look better question Further information is requested syntax/language Concerns the language or its syntax
Projects
None yet
Development

No branches or pull requests

2 participants