Fusion
Fusion copied to clipboard
Centralise RunService connections
Right now, multiple parts of the Fusion codebase connect to RunService independently of each other. While this is fine for simplicity, this limits how Fusion can be used - in particular, Fusion can’t be easily adapted to run on the server, as multiple parts of the codebase need to be changed. In addition, we can’t throttle updates - see #5.
It could be a good idea to centralise all RunService connections, so we only have one place where we e.g. connect to RenderStepped, and then just delegate to each part of Fusion that needs to run code on those events. This means we can easily move all the code to another event (like Heartbeat on the server) or even allow the user to manage updates manually, for example only updating Fusion while a plugin widget is visible.
I think for now it's best to keep this as an internal detail, but perhaps we could investigate exposing this in a separate issue if desired.
The primary use case here is adding server support for Fusion by allowing Fusion to use Heartbeat or Stepped instead of RenderStepped for updates.
If we create a singleton that manages the RunService connections, and all connections go through that, it should be fairly easy to add something like an :Override(Signal)
method. That being said, with all the different Signal classes out there I'm not sure how clear it would be to implement something like that.
For now I'm going to have to agree with you on keeping it as an internal detail and potentially exposing it at a later date for the above reason.
Working on adding this right now. Please direct code-specific feedback to the draft PR, and general questions/comments about this issue here.