I am making a game where users create their own platformer levels and I was wondering if it is possible to export files in-browser and read values from files on a player’s computer. This sort of functionality would be amazing, as it would allow level-sharing between creators.
How might I create an “export level” button which, when pressed, exports a .txt file to the user’s downloads folder? Also, is there a way to read data from the same file from any directory on the user’s computer into the game, to be saved as a cookie in-browser? I only need to read the data from the file, not save it as an asset in-game.
Lastly, is there a proper way to turn any form of data (specifically a string) into a text file like the one described above?
I know these are a lot of questions, but any help would be extremely helpful to me! I’ve spent multiple hours looking but haven’t found anything useful yet. If someone can give me a working answer to all 3 questions, they will receive a mention in the credits of my game.
Also, if a mod is reading this, is it possible to have my username changed? I am reachable by DM
Bump - This question is pivotal to my game’s success, if anyone who is reading needs clarification on my question (shouldn’t be necessary imo) and might possibly be able to give an answer, please reach out to me!
On the web, you cannot really read files from the player’s computer. The browser is a self-contained sandbox, it does not have the system context, only the browser context.
Nonetheless, you still will need to figure out how to read such .txt files in Cocos space. For that, I believe the easier way would be to have a server where the users could upload the .json / .txt files and then your game could react to such new uploads using an HTTP or Web Sockets connection