Fusion icon indicating copy to clipboard operation
Fusion copied to clipboard

Centralise RunService connections

Open dphfox opened this issue 3 years ago • 2 comments

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.

dphfox avatar Sep 29 '21 20:09 dphfox

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.

dphfox avatar Nov 03 '21 21:11 dphfox

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.

nottirb avatar Dec 18 '21 04:12 nottirb