Skip to content
Discussion options

You must be logged in to vote

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:

  1. Define your game state as a struct GameSave, and make sure you can load/save it from the current state of your bevy World. You might be interested in bevy_save
  2. Derive the serde traits on GameSave (#[derive(Serialize, Deserialize)])
  3. Create a blob readable by the web browser
  4. Use js-sys crate to access the Javascript window API and create a file and a save prompt

I've no time to give you more details here, it…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dolto
Comment options

Answer selected by dolto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
O-Web Specific to web (WASM) builds
2 participants