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

Save issues in Snowman 3 #522

Open
pstudio opened this issue Jul 21, 2022 · 0 comments
Open

Save issues in Snowman 3 #522

pstudio opened this issue Jul 21, 2022 · 0 comments
Assignees
Labels
3.X Snowman 3.X.X bug

Comments

@pstudio
Copy link

pstudio commented Jul 21, 2022

Forgive me for combining 3 issues into one, but since they are all related to the saving I'm too lazy to create three separate issues.
This example story can be used to demonstrate all 3 issues.

:: Start
<h1>Page 1</h1>
<button id="save">Save</button>
<button id="load">Load</button>
[[Page 2]]

<script>
    $('#save').click(() => window.Story.storage.createSave());
    $('#load').click(() => window.Story.storage.restoreSave());

    if (typeof window.Story.store.someVar === 'undefined')
        window.Story.store.someVar = 0;
</script>

:: Page 2
<h1>Page 2</h1>
<button id="save">Save</button>
<button id="load">Load</button>
[[Page 1|Start]]

<script>
    $('#save').click(() => window.Story.storage.createSave());
    $('#load').click(() => window.Story.storage.restoreSave());
    
    window.Story.store.someVar += 1;
</script>
  1. Error during restoreSave().
    If you make a save, then go back and forth between Start and 'Page 2', then press load, you will get an Uncaught TypeError . This presumably happens because History.position isn't saved and restored, so it is out of bounds when History.history is restored.
  2. createSave() ignores updated state.
    If you go to 'Page 2' someVar will be updated. This results in a discrepancy between the state in store and latest entry in History.history. If the story is saved and then restored you will lose the latest updates to the store.
    I don't know if this is by design, but it can lead to some frustrating bugs down the line, if people aren't aware of it. An optional argument to instruct createSave() to save the actual current state instead of the state when the passage is entered would be useful.
  3. restoreSave() doesn't take you to the saved passage.
    Another gotcha that might confuse people. When you restoreSave() it doesn't actually take you to the passage where you saved.
    Again this might be by design, but it can confuse people that the state is restored, but nothing is visibly changed since and you are still looking at the same passage. I would say an option to goto the last passage in the restored history is the right move, so we can decide it for ourselves.
  4. getAllSaveNames().
    One last suggestion. I implemented it myself, but I could imagine other would find it useful if there was a method for getting all the save names in case you want the player to have multiple saves and not having to remember the save names themself.
@videlais videlais self-assigned this Jul 21, 2022
@videlais videlais added bug 3.X Snowman 3.X.X labels Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.X Snowman 3.X.X bug
Projects
Status: No status
Development

No branches or pull requests

2 participants