Skip to content
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

Standardized way to serialize/deserialize hanabi particle effects #270

Open
ethereumdegen opened this issue Feb 8, 2024 · 2 comments
Open
Labels
C - enhancement New feature or request D - complex Complex change

Comments

@ethereumdegen
Copy link

Describe the solution you'd like
There should be a standard way to serialize and deserialize these particle effects so they can exist as files.

Describe why you want that solution. Is this related to a problem?
With VFX as files, they can be more easily shared and loaded into a game or a game editor

Describe alternatives you've considered

Additional context

@ethereumdegen
Copy link
Author

I prototyped this here https://github.com/ethereumdegen/bevy_hanabi_loader

@djeedai
Copy link
Owner

djeedai commented Feb 13, 2024

Yes this is a planned feature, although one pain point from the start has been that modifiers are trait objects, and trait object serialization is pretty hard (not supported by default in serde for example).

There's also a number of things that delayed implementation, because as soon as one version is out, people will want back-compat (otherwise there's no point having a serialized asset if you can't load it after upgrading).

  • Bevy Asset V2 just landed, and was promising breaking changes. Serializing and deserializing of referenced assets like textures referenced by asset path was not easily doable before. Lack of import settings and .meta files also made things harder to handle.
  • To some extent it's still unclear that the current strategy of using typetag is worth continuing; it's completely unrelated to Bevy's reflection and type system. There has been some talks about allowing serializing in Bevy with the TypeRegistry available as context but currently it's not possible.
  • Some GPU resource management like textures and gradients is still very much hard-coded, and will disappear in the future. That would require some back-compat effort to handle.

So the current strategy is that I try to make most types reflected and serializable, without supporting an official asset format. If someone wants to define their own format they should be able to do so (like, just serialize the EffectAsset itself directly to e.g. RON). And if there's any blocker doing so, I'm very much open to bug fixes and suggestions to improve. And maybe with Asset V2 now out, this is the right time to start looking at this again; I just didn't find the time to do so yet, unfortunately.

@djeedai djeedai added C - enhancement New feature or request D - complex Complex change labels Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C - enhancement New feature or request D - complex Complex change
Projects
None yet
Development

No branches or pull requests

2 participants