-
Notifications
You must be signed in to change notification settings - Fork 32
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
Wrap world access in a SystemParam
for granular access
#418
Conversation
This allows replication to run in parallel with other systems that write to non-replicated components. Benchmarks show the same performance, but we run them without `multi_threaded`.
SystemParam
for granular access.SystemParam
for granular access
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #418 +/- ##
==========================================
- Coverage 89.17% 85.12% -4.06%
==========================================
Files 53 54 +1
Lines 2808 2957 +149
==========================================
+ Hits 2504 2517 +13
- Misses 304 440 +136 ☔ View full report in Codecov by Sentry. |
src/server/replicated_world.rs
Outdated
impl<'w> ReplicatedWorld<'w, '_> { | ||
/// Extracts a component as [`Ptr`] and its ticks from a table or sparse set, depending on its storage type. | ||
/// | ||
/// # Safety | ||
/// | ||
/// The component must be present in this archetype, have the specified storage type, and be previously marked for replication. | ||
pub(super) unsafe fn get_component_unchecked( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this also require that the source of the ptr doesn't get reallocated? I don't think we can make that guarantee.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We configured the access by manually implementing SystemParam
to prevent other systems running in parallel from writing to replicated components. And we expose only read access with the associated runtime on Ptr
, so it should be fine.
I will need a similar thing for writing part in the future.
Pushed a small rename to rework the receiving. But I'll make a separate PR for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm ok seems plausible, although I'm no expert on the intricacies of bevy's memory model.
This allows replication to run in parallel with other systems that write to non-replicated components.
Benchmarks show the same performance, but we run them without
multi_threaded
.Supersedes #417.