-
Data storage in the form of file input/output is not available when creating a web version. I don't know what to do if I want to save the game. Please let me know what to do or if there is a plug-in involved! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
So you want the following: let the user download a save file with the current state of the game, then later be able to upload it so that the game can read it and resume from the save state. This is a non-trivial process. Overall, for the save functionality, you would do the following:
I've no time to give you more details here, it's your job to implement things for your game. But hopefully this helps you move forward. For the other way around, I suggest you search for "how to read a file in javascript" or something similar. |
Beta Was this translation helpful? Give feedback.
So you want the following: let the user download a save file with the current state of the game, then later be able to upload it so that the game can read it and resume from the save state.
This is a non-trivial process. Overall, for the save functionality, you would do the following:
struct GameSave
, and make sure you can load/save it from the current state of your bevyWorld
. You might be interested inbevy_save
serde
traits onGameSave
(#[derive(Serialize, Deserialize)]
)js-sys
crate to access the Javascriptwindow
API and create a file and a save promptI've no time to give you more details here, it…