-
Notifications
You must be signed in to change notification settings - Fork 44
Description
Is your feature request related to a problem? Please describe.
The current design of Bevy GGRS doesn't snapshot and restore Bevy events, so events that are handled in a frame may not get handled again if the frame is rolled back to.
Describe the solution you'd like
We might need a custom event resource type that is compatible with the rollback and snapshot system.
Describe alternatives you've considered
A quick attempt to snapshot the Events<T>
resource from Bevy didn't turn out so well. Events<T>
isn't Clone
even if T: Clone
, which presents challenges, and the exposed public API doesn't allow us enough access to reasonably snapshot and restore it. Even if we could, we'd have to have a way to reset the read counters on the Local<ManualEventReader<T>>
storage that powers the EventReader<T>
system param.
Essentially bevy's built-in event system probably just isn't suitable for snapshot and restore, and we need some alternative, or we just have to make this as a caveat and say that you have to use components for sending events or something like that.
Additional context
I'm actually a little confused why some events in my game seem to be working fine after rollback and restore. I'm still debugging. I'm still trying to get my game working in the SyncTest mode, and things get a little confusing to debug when the world is rolling back and forth the whole time. :D
There's a small chance that I'm misunderstanding something and events could work fine without changes, but I highly doubt it.