Giter Site home page Giter Site logo

Upgrade for Bevy 0.9 about bevy_ggrs HOT 7 CLOSED

johanhelsing avatar johanhelsing commented on August 17, 2024
Upgrade for Bevy 0.9

from bevy_ggrs.

Comments (7)

gschup avatar gschup commented on August 17, 2024 3

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

from bevy_ggrs.

johanhelsing avatar johanhelsing commented on August 17, 2024 2

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?

from bevy_ggrs.

Vrixyz avatar Vrixyz commented on August 17, 2024 1

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.

from bevy_ggrs.

gschup avatar gschup commented on August 17, 2024 1

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

from bevy_ggrs.

gschup avatar gschup commented on August 17, 2024

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.

from bevy_ggrs.

johanhelsing avatar johanhelsing commented on August 17, 2024

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

from bevy_ggrs.

gschup avatar gschup commented on August 17, 2024

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.

from bevy_ggrs.

Related Issues (20)

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.