Ask coding questions

← Back to all posts
Saving Data
DisclaimedGoat (12)

So I am making a game, and although it is not needed, I would prefer to save the player's data. The problem isn't that I don't know how to accomplish this, but is it possible using repl?

My guess is that this website is client based on the browser, so even if I do save a file, it won't stay in existence once the player loses connection. So, to get to the point, is it possible to save data and is my guess even correct?

Thanks

Commentshotnewtop
malvoliothegood (770)

To my knowledge repls are run on servers. We just see the results via the browser, so yes if you write data to a file in your repl it should be still there when you login again.

DisclaimedGoat (12)

@malvoliothegood I think I understand what you are saying, and, yes, I agree. However, what I want to do it distribute the URL of the page that is just the terminal. So in my case the URL for this repl is: https://crafting-game.disclaimedgoat.repl.run/

So here is where I see the problem- once this terminal looses connection, and you need to "run again" the program. I think here is the issue, becaue I think that the previous files are copied over.
So I guess a better question would be: Is there a way to distribute a terminal environment (preferably by URL) while still able to save the data? I don't necessarily want people to see my code, but if that's not the case, then so be it lol.

malvoliothegood (770)

@DisclaimedGoat I see what you are getting at. Looks like you need a full stack environment that is always on.

AdCharity (1344)

Well regardless if files save or not, repl blocks the altering of files programatially for security reasons (meaning changes will not persist). If this was made with a real html repl, it would be possible to employ the use of local storage/cookies - but it's not.

DisclaimedGoat (12)

@AdCharity Thanks for replying. I was afraid of this possibility. If you are able, could you suggest a free website that is an IDE for C#, but also has the same file system as repl? C# is my chosen language to become fluent in (at least for now), but I cannot afford the Visual Studio online subscription. I also cannot download files onto my laptop because I am loaning it. If there aren't any alternatives, thanks anyways.

AdCharity (1344)

@DisclaimedGoat another one like repl? I will suggest https://gitpod.io/, although I'm not sure if it actually runs stuff... Repl is my main programming platform cause I have a chromebook :(

DisclaimedGoat (12)

@AdCharity Thanks again. I too have a chrome book lol. I'll look into Gitpod.

AdCharity (1344)

@DisclaimedGoat well gitpod is mainly for people who like github but it does have the same type of file structure of pretty much all editors.