Code Monkey home page Code Monkey logo

bevy-persistent's People

Contributors

eerii avatar liquidhelium avatar luminoth avatar sgodwincs avatar umut-sahin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bevy-persistent's Issues

Implement Asset for Persistent<T>

I use bevy_asset_loader for loading assets when entering a loading state. I wanted to load something using this crate as well and still get the same state management (progress/error/etc.) features provided by bevy_asset_loader.

In order to use it with this crate, Persistent<T> would need to implement Asset and have a custom AssetLoader along with registering them in the plugin. For bevy_asset_loader, it would also require custom DynamicAsset but that doesn't technically require any change in this crate (unless you'd want to support bevy_asset_loader behind a feature flag).

Two additional point:

  • Would have to access it via Res(Mut)<Assets<Persistent<T>>> instead of Res(Mut)<Persistent<T>> (only if loaded via AssetLoader, the existing codepath could keep it as the latter).
  • The AssetLoader::load returns a Future but this crate does synchronous loading. I'm assuming the work could be done on one of Bevy's task pools to avoid blocking. Or this crate could expose an async loading interface (maybe just internally for the AssetLoader).

Wanted to gauge whether this is something you'd want supported by this crate. If so, I'd be willing to send a PR out to do so. Let me know if I've missed anything, thanks!

Automatically fill in missing Fields in persisted file

Hi, I really like this plugin!
If I change my resource that I want to persist, when a persisted file already exists, it fails to read it. so in the recent update i can make it reverse it to the default, which is nice.
But is it maybe possible to add the new fields with the default value and not reset everything?

For example if my players save their custom keybindings and i then update those keybindings and add new ones, all of their settings would be reset, which is quite annoying :)

Manual Error Handling

... can be very useful in certain situations.

We currently log the error and then ignore it. We can do better by explicitly returning a Result with an appropriate error type. Users would be free to ignore the errors using .ok() like before, but they'd have the ability to handle them as they see fit.

Relation to bevy_pkv?

Hey, I think we might be trying to solve the same problem?

Just wondered if you looked at bevy_pkv? And if so, how is persistent different?

Add WASM support

It would be nice if bevy-persistent would also work for WASM. One option (suggested in Reddit) is to use gloo-storage. Another option is to use bevy_pkv as a backend, since it already supports both native and WASM with the same API.

error[E0425]: cannot find value `serialized_resource_str` in this scope

Cargo dependency

bevy-persistent = { version = "*", features = ["ron", "pretty"] }

Compilation Errors

   Compiling bevy-persistent v0.3.0
error[E0425]: cannot find value `serialized_resource_str` in this scope
   --> _<PATH HIDDEN>_\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy-persistent-0.3.0\src\format.rs:174:36
    |
174 |                 ron::from_str::<R>(serialized_resource_str).map_err(|error| {
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `serialized_resource`

error[E0425]: cannot find value `serialized_resource_str` in this scope
   --> _<PATH HIDDEN>_\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy-persistent-0.3.0\src\format.rs:181:36
    |
181 |                 ron::from_str::<R>(serialized_resource_str).map_err(|error| {
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `serialized_resource`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `bevy-persistent` (lib) due to 2 previous errors

Temporary Solution

Add feature "toml". This will trigger the macro at line number 141 and will create serialized_resource_str

I tried to modify the line 141 (add feature = "ron"), but this seems to be more complicated issue.

Unloading/Reloading

... can be very useful to save memory, or bring external modifications to the application without restarting the application.

RON support

Since JSON is supported, it would make sense to also support RON, since in the Bevy ecosystem it is also used in place of JSON (see e.g. DynamicScenes)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.