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

Upgrade for Bevy 0.9 #32

Closed
johanhelsing opened this issue Nov 13, 2022 · 7 comments
Closed

Upgrade for Bevy 0.9 #32

johanhelsing opened this issue Nov 13, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@johanhelsing
Copy link
Collaborator

Bump Bevy to 0.9 Cargo.toml and fix porting issues

@johanhelsing johanhelsing added the enhancement New feature or request label Nov 13, 2022
@gschup gschup assigned gschup and unassigned gschup Nov 15, 2022
@gschup
Copy link
Owner

gschup commented Nov 15, 2022

This seems to be non-trivial on first glance:

  • GGRS sessions are added as resources and thus now need to derive bevy's Resource trait through a feature flag in GGRS. Otherwise a wrapper struct is necessary.
  • taking a snapshot of registered resources used a now no longer available API (link). In this PR resource was moved to world storage, but iterating over all resource indices is no longer possible. world.archetypes().resource().unique_components() gave direct access to the underlying SparseSet<ComponentId, ResourceData>; but in the new world.storage.resources, this is now private (link). This change was made since full access enabled unsafe or unsound code. Since we only used the indices, this was not an issue for us. But for now we will have to find another way.

@johanhelsing
Copy link
Collaborator Author

Is it something we could try to bring back in Bevy 0.9.1 with a different name and/or unsafe warnings?

@gschup
Copy link
Owner

gschup commented Nov 16, 2022

I think they conciously removed this and it will not come back:

All APIs accessing the raw data of individual resources (mutable and read-only) have been removed as these APIs allowed for unsound unsafe code. All usages of these APIs should be changed to use World::{get, insert, remove}_resource.

We only used the keys of the sparse set, so maybe there is hope. I do however think that there might be a nicer way to do this.

@Vrixyz
Copy link
Contributor

Vrixyz commented Dec 2, 2022

It should be possible to list all resources again with iter() function as of bevy 0.9.1: https://github.com/bevyengine/bevy/blob/v0.9.1/crates/bevy_ecs/src/storage/resource.rs#L141.
link to bevy PR for context: bevyengine/bevy#6592.

@gschup
Copy link
Owner

gschup commented Dec 9, 2022

Done! Thank you for the great work @Vrixyz @johanhelsing 🎉

@johanhelsing
Copy link
Collaborator Author

Yay!

I guess it's time for a new release then?

bevy_ggrs is currently depending on the git version of ggrs, so I guess that means a release of both is needed, and by extension also matchbox_socket, since the matchbox ggrs feature depends on ggrs?

@gschup
Copy link
Owner

gschup commented Dec 10, 2022

Yes! I will close this issue once a new version is published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants