-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Bevy Preferences API #13311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The API here needs to be carefully considered. The proposal here mirrors that of |
I've put up a PR. My approach there is to provide a simple typed value store in a bevy resource, using I'm of the opinion bevy should provide some filesystem backend for this, but make it easy for users to bring their own. We can make the simple cases easy, and the complex cases possible. A simple filesystem backend might be as straightforward as writing to the We can also aim to build a production-ready filesystem backend, but I suspect that will be a significant undertaking. |
I would keep preferences as individual reflect resources marked to be stored/restored as pref:
And a separate backend which handles the actual storing, restoring of preferences to the local user directory. I don't know if it would be better to mark them in code, by registering resources to be stored, or if the resource itself should be marked. As a more long-term solution it would probably a good idea to make a storage api in general, where prefs is a part of, as similar data like save game state, cache, etc. could also be handled this way. |
@cart has a comprehensive comment laying out requirements and design that's essential reading for anyone tackling this: #13312 (comment) |
Detailed requirements doc here: https://hackmd.io/@dreamertalin/rkhljFM7R |
I've written my own lib, which has a somewhat different design: https://github.com/viridia/panoply/tree/main/crates/bevy_mod_preferences
|
What problem does this solve or what need does it fill?
Games and editors need a way to store user preferences: things like video options, keyboard/controller mappings and so on.
What solution would you like?
I proposal we add an API to Bevy for saving and loading of user preferences.
This should support at least the following features:
The solution you propose for the problem presented.
What alternative(s) have you considered?
There are a number of existing Rust crates that provide preference-saving functionality. However, these don't necessarily conform to the requirements for a Bevy-based game. For example, some crates may assume that the preferences are stored in the filesystem, which may not be true in a browser-based game.
The text was updated successfully, but these errors were encountered: