Why does my Harlowe Twine game lose progress history?

Twine Version: 2.7.0, Harlowe 3.3.6

Help! I created a Harlowe Twine game and hosted it online. Unfortunately, when people play over multiple sessions, they find that even when left open the tab auto-refreshes after a few hours and loses all their progress. This happens on desktop browsers, on mobile browsers, across Chrome, Firefox, and Safari. It also happens regardless of if the game is hosted on itch.io or another server. The thing is, I’ve definitely played some wonderful and involved Twine games over multiple days and sessions, and I never had this issue playing other people’s games. I could even accidentally hit the Back button or go to another website, then return, and my progress would still be saved. (Ukiyo’s Bird Cage comes to mind, as does Parabolic’s The House of Cenci.) So why is my game resetting people’s progress? I don’t even know where to begin to look.

EDIT - I should add that the start page, with the rocket ship, begins by resetting progress. But there is absolutely no route in the game that would return anyone to the start page; it’s a one-way click out. The problem is that if they leave the tab alone for a bit and come back to it, the page refreshes and sends them back to the start page, which they should never see a second time. How can I make it so this won’t happen unless they click the RESTART button at the end of the game?

I’m just spitballing here, but it’d probably help if you pointed us to your game.

Alright. So I checked out your game and after making it in a few screens I’m able to refresh the browser and it keeps me at the proper passage. So far so good.

I then close the browser tab and go back to the game and it begins at the first passage again. It’s at this point where I believe you expect the game to automatically keep your progress and show the last passage before the tab was closed. If this is true, Harlowe is working as expected.

Harlowe automatically tries to keep the current progress active in case the browser gets refreshed, but beyond that… it’s up to you.

https://twine2.neocities.org/#macro_save-game

(save-game:) is a single operation that can be used as often or as little as you want to. You can include it on every page; You can put it at the start of each “chapter”; You can put it inside a (link:) hook…

Now, it’s been a while since I used Harlowe and I never made a game large enough to warrant using the save system so take all this with a grain of salt, but the logic is sound.

You may want to take advantage of Harlowe’s header / footer functionality and include automatically saving the game in either of those passages. That way it will save with every passage.

https://twine2.neocities.org/#passagetag_header

Lastly, I don’t believe Harlowe will automatically load the saved game, if it exists. For that, you may want to use a special startup passage.

https://twine2.neocities.org/#passagetag_startup

In this startup passage, you’ll check to see if a saved game exists and then load it immediately, or you may wish to ask the player if they wish to resume or restart. How you achieve this is up to you.

I hope I haven’t assumed anything incorrectly, but this is my gut feeling without seeing any of your code. If what I’ve said makes sense, you can remove the link you’ve provided.

Let us know if you have any other questions.

Edit: As a side note, the Chapbook story format automatically saves and restores.

Thank you so much! I ended up combining your advice with some Javascript found in another thread so that the game would both save progress but also have the option to delete the save if you wanted to play again.

1 Like

For future reference, you can click the name or the icon of a poster and then click :email: Message button to send them a private message with links.

2 Likes

Also this is dependent on browser, and likely cookies that can save browser state between sessions. If a player has security settings to disallow cookies by default or on unknown websites, it won’t remember their progress.

The Sugarcube format has a built-in save system, which I don’t know if is cookie-reliant or somehow built into the engine/format.

The Chapbook format saves progress pretty consistently, and luckily there’s a restart link in the UI by default unless the author takes it out. Unless something goes wrong, the player will always open the game on the same passage they closed on.

1 Like

It is cookie-reliant if you only click on the Save buttons.
BUT: you also have a Export to Disk where you can download your save file and not have to worry about losing your save file if you clean your cookies (though it only save the current open play through - as of version 2.36.1)

2 Likes

Hey, that’s awesome! Glad I could point you in the right direction.

Care to share a snippet of your code solution for future answer seekers?