-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Refactor: Make observers control the lifecycle of capture and playback #39
Conversation
Whoops! Somehow hit a button on my keyboard that submitted this much before I intended to. Will update the body shortly. |
don't know why my setup hates this repo so much. apologies for the noise. seems like it's all set now 👍 |
So, I like the event-based toggling, but I don't understand why we're using observers here? They're intended to be used for targeting a specific entity, but in this case it appears to just be targeted globally. A simple EventReader/EventWriter will be simpler and clearer. |
hey @alice-i-cecile, that's completely fine -- in that case I would suggest closing this and preferring #36 -- that PR works just fine for an event-based approach. after the conversation in #36, I wanted to post what work I had on-going in case it was useful for anyone. the reasons I thought to try this observer-based approach were:
all that said, like I said, this was mostly the product of a rabbit-hole, I just thought it worth sharing for your (and hopefully @JeanMertz's) consideration |
I actually had the same idea of allowing multiple recordings at the same time (e.g. targeting different windows or input devices, or only recording interactions with specific entities), at which point recording or playback could become entity based instead of globally. I haven’t worked with observers before, but their “instant” nature seemed preferable for starting and stopping recordings at the exact time. |
Okay, I'm happy to pursue this approach then :) Is this otherwise ready to be merged? |
I'm sufficiently satisfied with the implementation for the time being, and I don't intend to add anything else unless asked to. I'm not sure that implies "ready to be merged" though 😅 -- I'd feel more comfortable saying so after a reviewer does. |
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.
Okay, I'm happy with the approach and the code quality is good. It needs a bit of care with docs: an example would be helpful, and we definitely need to explain that these are triggered as observers.
The other thing to do is to add a note in RELEASES.md :)
Thanks a bunch for taking the time @alice-i-cecile! I'll be able to finish this up after the weekend. |
Okay, back again. I finished up the examples -- turns out I hadn't completely wired up After the last updates, all the examples should be fixed up to run as intended (I think). I've included some doc updates and the additional wiring to actually override serialized window entities when provided. (I'd have broken up the commits but I had a little trouble with the environment while traveling -- my apologies if I end up having to throw up a few commits after this one lol.) To be honest though, the code in the |
Also, congrats on 0.15! I'll follow this up with an update for that when I'm home. |
realized I forgot the note in RELEASES -- adding something now |
Great! I'll ship this out with the new Bevy version bump this week. |
@alice-i-cecile actually, I got most of the way through a 0.15 PR while working on this yesterday -- just had to finish up some work in the I'll put that up now and see if I can wrap it up as well -- there are one or two details I wasn't sure how to resolve best yet, but hopefully it will still save you some work. |
Issue
#34 - Refactor to allow users to trigger capture/playback as-needed
This is an extension of #36 using observers.
Changes
The solution here is very similar to #36 except that, because Observers are used to trigger the initialization of playback and startup, the systems that previously initialized the behavior are now observer systems. This means they don't have to be ordered, which I suppose is nice.
In the future I'd like to explore how reasonable it would be to spawn entities that handle the playback/capture rather than spawning resources, e.g. in case users wanted to record multiple windows simultaneously or store captures in the world for later playback/editing.
Questions
Which approach is preferred?
TODOs