sakkaku-dev / nethack-web

NetHack for the web
https://sakkaku-dev.github.io/nethack-web/
4 stars 1 forks source link

Missing save file. #91

Closed d-m-bailey closed 1 year ago

d-m-bailey commented 1 year ago

Trying to restart a saved game brings up the "create a new character prompt". High scores does not show a deceased character so I'm guessing the save file on the server was lost.

Cav Dwa Mal? Law Phyban last on dungeon level 23, I believe.

myin142 commented 1 year ago

Did you just use the "Start Game" button or did you use the backup load?

d-m-bailey commented 1 year ago

I tried the "Start Game", and it asked to create a new character. I cancelled that and checked the backup logs. There was a "Phyban" backup, so I started that, but it was a previous character. I quit that and it's in the highscore file as a quit.

myin142 commented 1 year ago

Did you use the same player name when starting the game? It should usually always create a backup save for each player name. But not long ago I fixed a bug with the saves on Chrome. It might be related to that. I would recommend reloading the browser cache just in case. (Ctrl+F5 or Shift+F5 might work). You should see a log in the console like Running version f36fcb.... But I will keep my eyes open for any problems with the save files.

graves501 commented 1 year ago

@d-m-bailey FYI: The save games are not saved on the server, they are stored in the browser:

image

d-m-bailey commented 1 year ago

@graves501 Thanks! @myin142 Lost another character, Zadek. Same thing. Started with the previous saved character's name (pre-populated in the prompt) and got Shall I pick... Here's the contents of the IndexedDB

timestamp

And the contents of Local Storage

saves

These correspond to the entries on the backup load screen and may not be the most recent data. Zadek's data appears to be pretty close though.

So maybe what happened with Phyban is that I tried to resume, but got the Shall I pick... prompt and started a new character, caveman, with the same name. The backup for the previous character, wizard, still exists, so the caveman backup appears not to be implicitly created. Using Chrome 115.0.5790.102 on macos 13.2.1.

myin142 commented 1 year ago

I tried some fixes, hopefully it helps. But to summarize the expected saving behavior:

that's how it works for me. But maybe there is a change if you get further in the game.

d-m-bailey commented 1 year ago

@myin142 Thanks for the explanation.

For me, Shift-S saves but does not overwrite the previous backup file.

Does this happen if the same character name is reused for different characters? Or is the timestamp on the save file the creation time of the character and not the save time?

myin142 commented 1 year ago

One character name should only have one backup file. It will override existing ones. The timestamp should be the last save time, not the creation time, so it's probably not creating a backup. I just recently changed the logic on which files are saved. (see here)

It basically tries to find the correct save file for the current character name and only creates a backup for it. How are your save files named in IndexedDB and what name did you use? Are there any errors in the logs?

d-m-bailey commented 1 year ago

Here's the saved files at the start screen.

save_file

Here's the console error after game save.

save_error
myin142 commented 1 year ago

I have updated it now to log more information when saving. It seems there is some kind of problem when reading the save file. Could you try it again and post the logs?

Note: the Uncaught RuntimeError: unreachable error is normal when the game exists.

d-m-bailey commented 1 year ago
nosave
d-m-bailey commented 1 year ago

Lost another character when the computer crashed. There was no recent save file.

myin142 commented 1 year ago

Sorry about that. I just recently found the problem and trying to work on a solution.

This problem only happens on Chrome and when the save file reaches a certain size. Then Chrome is unable to load the whole file and throws an error. So in the meantime you could play on Firefox, if you want backup files. It still has not happened to me there.

myin142 commented 1 year ago

Should be fixed now