Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Lost code after refresh

A topic by Artem Flo / aturbidflow / kubikámi created Feb 04, 2020 Views: 149 Replies: 7
Viewing posts 1 to 2
Submitted

Guys, I'm extremely upset. After refreshing the page I've lost all of my code. Everything for the last 7 hours (last time I download code) is lost. Any variants except writing everything again?

Submitted

I'm sorry to hear that. I think it happened to me once, but I didn't lose that much work. You shouldn't normally lose anything after refreshing the page, so I'm not sure what to suggest. Obviously, in future, make sure you save fairly frequently (at least once per hour or after doing a lot of updates) and always save before pressing F5, before closing the browser and before turning the computer off.

Submitted

Yeah, I was doing that. But today I was incredibly inspired and forgot about everthing except coding. And first time ever there was nothing in the code editor after refresh. I've researched and see that game code stores nowhere but localStorage. It's extremely dissapointing knowledge for me.

Host

Hi,

I'm SO SORRY to hear you lost your source code, and your game.

I do assume from your description that you you checked localStorage thoroughly for your game text. Are you sure that you weren't in an incognito window in your code editing window. One problem is that modern browsers conceil if they are in incognito windows so I can't warn any author that their work would be lost in such a scenario. 

I do wonder how it is possible to lose the game in its entirety. All I can think of is that your cleared down the window then closed the window immediately after that (it auto saves on a window close). I'll try to trap such activity in the future, but it would really help if you could tell me which browser you were using.

There is a menu options called "Save File" which will store the game locally, and obviously I recommend using that from time to time so you have a local copy of the file, but obviously the horse has bolted. 

Again, I'm SO SORRY. Absolutely the only two things I can think of is that the text was cleared down before closing the window, or that you were in an incognito window. For the former problem, I'll trap "Save and Execute" (the play button) and window close event, so that it won't overwrite a big file with a blank file.

I do hope this doesn't end your participation, but I fully understand that you must have lost faith.

Chris

Submitted (2 edits)

I hope so, I think I just take a timeout.  About  any questions about incognitor and other - you can trust me, I'm JS Developer and know how to work with browsers. Only thing - I'm typing a little too fast and if there is a keyboard shortcut for "Clear code" than I could press it and didn't notice.  
If you don’t mind, I would like to make an offer of autosave: save the game code in another localChange variable, not by Ctrl + s, but by timer. A kind of backup. From it, it would be possible to restore the last autosave.

P.S. Windows 10 x64 / Chrome 79.0.3945.130

UPD. And yes, I have a mid-development version saved.

UPD2. Oh, i remember one more case when I almost lost my game, but stopped immediately. Ctrl+A -> press any key =) It's very very stupid case, but it can be. I once worked with a very similar one. Script is checking for text changes and if the text size quickly decreased to 10% or less - it threw an error.

Host (1 edit)

I know it's too little, too late, but I have made the following quick changes, and will bolster this in future.

1. Adventuron now stores the previous 10 save revisions (when you press control + s or click the PLAY icon). This should help with disaster recovery.

2. Adventuron now won't save a document if in Keyboard Practise Mode, or if the amount of text in the editor window is less than 64 in length (covers the Control + A, DEL scenario).

3 - If you select "Clear All Text" a backup file will be downloaded from Adventuron to your local file system.

4 - A backup (in localstorage) per game_information / game_name is also stored every time the game is saved, or the tab closed / switched. If the author accidentally clears the editor, then the working storage will be gone, but the last version of the code in localstorage will still be available on a per-game-name basis. This will be the primary form of data rescue in the case of user error, or unforeseen bug.

-----

This is not a long term solution but should help in disaster situations where the code goes missing. 

Submitted

Why it is not "long term"? These are great solutions, I am delighted. Thank you for such attention!

Host

It's not long term because long-term, it requres UI work around a pseudo file-system (on client and possibly server too), and I don't have time to implement right now unfortunatly. All I can do is try to cover the disaster scenarios in such a small time window.