Pipe dream: ability to do total rewind of some world state #20570
Architector4
started this conversation in
General
Replies: 1 comment
-
Check this out, bevy implements system stepping: Not exactly rollback, but half way there! Also check out all the rollback mutliplayer plugins for bevy. Rollback requires the ability to rewind the world state, and they implement this as a necessity. So if you are curious, you can check out their implementations! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This isn't really a feature request or an "idea" or anything such, because I'm pretty certain that this is impossible with current architecture of Bevy and is probably unlikely to be supported in the future. I just want to put the thought out and maybe discuss it.
One thing I'm dreaming about is for the ability to do total rewind of some world state (some component/resource types, some systems, and some entities) within Bevy.
For components/resources that would involve also snapshotting and rewinding their change detection tick values, as well as added/removed component signals. For systems, that would involve snapshotting and rewinding their
Local
params, including the cursors inEventReader
s. For entities, that would involve snapshotting and rewinding which entities exist, including the exact entity IDs and generations.Obviously, some world state is best not rewinded. It'd be a bad idea to rewind fancy components and resources, like Window components (at least not unintentionally), some random technical components with raw pointers, or systems that interface with the OS and need some of their
Local
s actually untouched. Or caches of various kinds. But still.For example, I want to be able to perform a series actions from an exclusive system over
&mut World
:A
. Systems in that schedule spawn/remove/modify some entities and components and produce various events. An entity with an ID like10v10
is spawned.B
that only has systems that respond to events and change detection. Systems in that schedule respond to change detection from events of systemA
, read the incoming events, do their stuff. Entity10v10
is deleted, and another entity with the same ID but new generation,10v11
is spawned.B
again. It only responds to stuff that was done in step 3.10v10
exists again.B
. Systems in it perform all the same things they did in step 3.This is obviously impossible with current Bevy, as nothing can touch
Local
params except the system that has them itself (and even then there's nothing that can check if they are clonable at all), nothing can undespawn entities with their previously existing components, nothing can rewind entity generation IDs, and nothing can swallow or generate components added/removed signals.I just think that, if Bevy was radically different (and more complex) and supported such chicanery, it'd be very cool. I don't think this is reasonable to request, so I don't, I just wanted to braindump.
Beta Was this translation helpful? Give feedback.
All reactions